Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Side by Side Diff: ppapi/native_client/src/trusted/plugin/plugin.cc

Issue 11428063: Add a flag to LaunchSelLdr to skip grabbing a routing_id. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reduce mod Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifdef _MSC_VER 5 #ifdef _MSC_VER
6 // Do not warn about use of std::copy with raw pointers. 6 // Do not warn about use of std::copy with raw pointers.
7 #pragma warning(disable : 4996) 7 #pragma warning(disable : 4996)
8 #endif 8 #endif
9 9
10 #include "native_client/src/trusted/plugin/plugin.h" 10 #include "native_client/src/trusted/plugin/plugin.h"
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 main_subprocess_.Shutdown(); 537 main_subprocess_.Shutdown();
538 538
539 PLUGIN_PRINTF(("Plugin::ShutDownSubprocess (this=%p, return)\n", 539 PLUGIN_PRINTF(("Plugin::ShutDownSubprocess (this=%p, return)\n",
540 static_cast<void*>(this))); 540 static_cast<void*>(this)));
541 } 541 }
542 542
543 bool Plugin::LoadNaClModuleCommon(nacl::DescWrapper* wrapper, 543 bool Plugin::LoadNaClModuleCommon(nacl::DescWrapper* wrapper,
544 NaClSubprocess* subprocess, 544 NaClSubprocess* subprocess,
545 const Manifest* manifest, 545 const Manifest* manifest,
546 bool should_report_uma, 546 bool should_report_uma,
547 bool uses_ppapi,
547 ErrorInfo* error_info, 548 ErrorInfo* error_info,
548 pp::CompletionCallback init_done_cb, 549 pp::CompletionCallback init_done_cb,
549 pp::CompletionCallback crash_cb) { 550 pp::CompletionCallback crash_cb) {
550 ServiceRuntime* new_service_runtime = 551 ServiceRuntime* new_service_runtime =
551 new ServiceRuntime(this, manifest, should_report_uma, init_done_cb, 552 new ServiceRuntime(this, manifest, should_report_uma, init_done_cb,
552 crash_cb); 553 crash_cb);
553 subprocess->set_service_runtime(new_service_runtime); 554 subprocess->set_service_runtime(new_service_runtime);
554 PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon (service_runtime=%p)\n", 555 PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon (service_runtime=%p)\n",
555 static_cast<void*>(new_service_runtime))); 556 static_cast<void*>(new_service_runtime)));
556 if (NULL == new_service_runtime) { 557 if (NULL == new_service_runtime) {
557 error_info->SetReport(ERROR_SEL_LDR_INIT, 558 error_info->SetReport(ERROR_SEL_LDR_INIT,
558 "sel_ldr init failure " + subprocess->description()); 559 "sel_ldr init failure " + subprocess->description());
559 return false; 560 return false;
560 } 561 }
561 562
562 bool service_runtime_started = 563 bool service_runtime_started =
563 new_service_runtime->Start(wrapper, 564 new_service_runtime->Start(wrapper,
564 error_info, 565 error_info,
565 manifest_base_url(), 566 manifest_base_url(),
567 uses_ppapi,
566 enable_dev_interfaces_, 568 enable_dev_interfaces_,
567 crash_cb); 569 crash_cb);
568 PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon (service_runtime_started=%d)\n", 570 PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon (service_runtime_started=%d)\n",
569 service_runtime_started)); 571 service_runtime_started));
570 if (!service_runtime_started) { 572 if (!service_runtime_started) {
571 return false; 573 return false;
572 } 574 }
573 return true; 575 return true;
574 } 576 }
575 577
576 bool Plugin::LoadNaClModule(nacl::DescWrapper* wrapper, 578 bool Plugin::LoadNaClModule(nacl::DescWrapper* wrapper,
577 ErrorInfo* error_info, 579 ErrorInfo* error_info,
578 pp::CompletionCallback init_done_cb, 580 pp::CompletionCallback init_done_cb,
579 pp::CompletionCallback crash_cb) { 581 pp::CompletionCallback crash_cb) {
580 // Before forking a new sel_ldr process, ensure that we do not leak 582 // Before forking a new sel_ldr process, ensure that we do not leak
581 // the ServiceRuntime object for an existing subprocess, and that any 583 // the ServiceRuntime object for an existing subprocess, and that any
582 // associated listener threads do not go unjoined because if they 584 // associated listener threads do not go unjoined because if they
583 // outlive the Plugin object, they will not be memory safe. 585 // outlive the Plugin object, they will not be memory safe.
584 ShutDownSubprocesses(); 586 ShutDownSubprocesses();
585 if (!LoadNaClModuleCommon(wrapper, &main_subprocess_, manifest_.get(), 587 if (!LoadNaClModuleCommon(wrapper, &main_subprocess_, manifest_.get(),
586 true, error_info, init_done_cb, crash_cb)) { 588 true /* should_report_uma */,
589 true /* uses_ppapi */,
590 error_info, init_done_cb, crash_cb)) {
587 return false; 591 return false;
588 } 592 }
589 PLUGIN_PRINTF(("Plugin::LoadNaClModule (%s)\n", 593 PLUGIN_PRINTF(("Plugin::LoadNaClModule (%s)\n",
590 main_subprocess_.detailed_description().c_str())); 594 main_subprocess_.detailed_description().c_str()));
591 return true; 595 return true;
592 } 596 }
593 597
594 bool Plugin::LoadNaClModuleContinuationIntern(ErrorInfo* error_info) { 598 bool Plugin::LoadNaClModuleContinuationIntern(ErrorInfo* error_info) {
595 if (!main_subprocess_.StartSrpcServices()) { 599 if (!main_subprocess_.StartSrpcServices()) {
596 error_info->SetReport(ERROR_SRPC_CONNECTION_FAIL, 600 error_info->SetReport(ERROR_SRPC_CONNECTION_FAIL,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 new NaClSubprocess("helper module", NULL, NULL)); 638 new NaClSubprocess("helper module", NULL, NULL));
635 if (NULL == nacl_subprocess.get()) { 639 if (NULL == nacl_subprocess.get()) {
636 error_info->SetReport(ERROR_SEL_LDR_INIT, 640 error_info->SetReport(ERROR_SEL_LDR_INIT,
637 "unable to allocate helper subprocess."); 641 "unable to allocate helper subprocess.");
638 return NULL; 642 return NULL;
639 } 643 }
640 644
641 // Do not report UMA stats for translator-related nexes. 645 // Do not report UMA stats for translator-related nexes.
642 // TODO(sehr): define new UMA stats for translator related nexe events. 646 // TODO(sehr): define new UMA stats for translator related nexe events.
643 if (!LoadNaClModuleCommon(wrapper, nacl_subprocess.get(), manifest, 647 if (!LoadNaClModuleCommon(wrapper, nacl_subprocess.get(), manifest,
644 false, error_info, 648 false /* should_report_uma */,
649 false /* uses_ppapi */,
650 error_info,
645 pp::BlockUntilComplete(), 651 pp::BlockUntilComplete(),
646 pp::BlockUntilComplete())) { 652 pp::BlockUntilComplete())) {
647 return NULL; 653 return NULL;
648 } 654 }
649 // We need not wait for the init_done callback. We can block 655 // We need not wait for the init_done callback. We can block
650 // here in StartSrpcServices, since helper NaCl modules 656 // here in StartSrpcServices, since helper NaCl modules
651 // are spawned from a private thread. 657 // are spawned from a private thread.
652 // 658 //
653 // TODO(bsy): if helper module crashes, we should abort. 659 // TODO(bsy): if helper module crashes, we should abort.
654 // crash_cb is not used here, so we are relying on crashes 660 // crash_cb is not used here, so we are relying on crashes
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1904 static_cast<uint32_t>(text.size())); 1910 static_cast<uint32_t>(text.size()));
1905 const PPB_Console_Dev* console_interface = 1911 const PPB_Console_Dev* console_interface =
1906 static_cast<const PPB_Console_Dev*>( 1912 static_cast<const PPB_Console_Dev*>(
1907 module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE)); 1913 module->GetBrowserInterface(PPB_CONSOLE_DEV_INTERFACE));
1908 console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str); 1914 console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str);
1909 var_interface->Release(prefix); 1915 var_interface->Release(prefix);
1910 var_interface->Release(str); 1916 var_interface->Release(str);
1911 } 1917 }
1912 1918
1913 } // namespace plugin 1919 } // namespace plugin
OLDNEW
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/plugin.h ('k') | ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698