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

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

Issue 11761025: When launching PNaCl helper nexes, explicitly disable IRT loading. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: don't forget to serialize Created 7 years, 11 months 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_irt,
547 bool uses_ppapi, 548 bool uses_ppapi,
548 ErrorInfo* error_info, 549 ErrorInfo* error_info,
549 pp::CompletionCallback init_done_cb, 550 pp::CompletionCallback init_done_cb,
550 pp::CompletionCallback crash_cb) { 551 pp::CompletionCallback crash_cb) {
551 ServiceRuntime* new_service_runtime = 552 ServiceRuntime* new_service_runtime =
552 new ServiceRuntime(this, manifest, should_report_uma, init_done_cb, 553 new ServiceRuntime(this, manifest, should_report_uma, init_done_cb,
553 crash_cb); 554 crash_cb);
554 subprocess->set_service_runtime(new_service_runtime); 555 subprocess->set_service_runtime(new_service_runtime);
555 PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon (service_runtime=%p)\n", 556 PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon (service_runtime=%p)\n",
556 static_cast<void*>(new_service_runtime))); 557 static_cast<void*>(new_service_runtime)));
557 if (NULL == new_service_runtime) { 558 if (NULL == new_service_runtime) {
558 error_info->SetReport(ERROR_SEL_LDR_INIT, 559 error_info->SetReport(ERROR_SEL_LDR_INIT,
559 "sel_ldr init failure " + subprocess->description()); 560 "sel_ldr init failure " + subprocess->description());
560 return false; 561 return false;
561 } 562 }
562 563
563 bool service_runtime_started = 564 bool service_runtime_started =
564 new_service_runtime->Start(wrapper, 565 new_service_runtime->Start(wrapper,
565 error_info, 566 error_info,
566 manifest_base_url(), 567 manifest_base_url(),
568 uses_irt,
567 uses_ppapi, 569 uses_ppapi,
568 enable_dev_interfaces_, 570 enable_dev_interfaces_,
569 crash_cb); 571 crash_cb);
570 PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon (service_runtime_started=%d)\n", 572 PLUGIN_PRINTF(("Plugin::LoadNaClModuleCommon (service_runtime_started=%d)\n",
571 service_runtime_started)); 573 service_runtime_started));
572 if (!service_runtime_started) { 574 if (!service_runtime_started) {
573 return false; 575 return false;
574 } 576 }
575 return true; 577 return true;
576 } 578 }
577 579
578 bool Plugin::LoadNaClModule(nacl::DescWrapper* wrapper, 580 bool Plugin::LoadNaClModule(nacl::DescWrapper* wrapper,
579 ErrorInfo* error_info, 581 ErrorInfo* error_info,
580 pp::CompletionCallback init_done_cb, 582 pp::CompletionCallback init_done_cb,
581 pp::CompletionCallback crash_cb) { 583 pp::CompletionCallback crash_cb) {
582 // Before forking a new sel_ldr process, ensure that we do not leak 584 // Before forking a new sel_ldr process, ensure that we do not leak
583 // the ServiceRuntime object for an existing subprocess, and that any 585 // the ServiceRuntime object for an existing subprocess, and that any
584 // associated listener threads do not go unjoined because if they 586 // associated listener threads do not go unjoined because if they
585 // outlive the Plugin object, they will not be memory safe. 587 // outlive the Plugin object, they will not be memory safe.
586 ShutDownSubprocesses(); 588 ShutDownSubprocesses();
587 if (!LoadNaClModuleCommon(wrapper, &main_subprocess_, manifest_.get(), 589 if (!LoadNaClModuleCommon(wrapper, &main_subprocess_, manifest_.get(),
588 true /* should_report_uma */, 590 true /* should_report_uma */,
591 true /* uses_irt */,
589 true /* uses_ppapi */, 592 true /* uses_ppapi */,
590 error_info, init_done_cb, crash_cb)) { 593 error_info, init_done_cb, crash_cb)) {
591 return false; 594 return false;
592 } 595 }
593 PLUGIN_PRINTF(("Plugin::LoadNaClModule (%s)\n", 596 PLUGIN_PRINTF(("Plugin::LoadNaClModule (%s)\n",
594 main_subprocess_.detailed_description().c_str())); 597 main_subprocess_.detailed_description().c_str()));
595 return true; 598 return true;
596 } 599 }
597 600
598 bool Plugin::LoadNaClModuleContinuationIntern(ErrorInfo* error_info) { 601 bool Plugin::LoadNaClModuleContinuationIntern(ErrorInfo* error_info) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 nacl::scoped_ptr<NaClSubprocess> nacl_subprocess( 643 nacl::scoped_ptr<NaClSubprocess> nacl_subprocess(
641 new NaClSubprocess("helper module", NULL, NULL)); 644 new NaClSubprocess("helper module", NULL, NULL));
642 if (NULL == nacl_subprocess.get()) { 645 if (NULL == nacl_subprocess.get()) {
643 error_info->SetReport(ERROR_SEL_LDR_INIT, 646 error_info->SetReport(ERROR_SEL_LDR_INIT,
644 "unable to allocate helper subprocess."); 647 "unable to allocate helper subprocess.");
645 return NULL; 648 return NULL;
646 } 649 }
647 650
648 // Do not report UMA stats for translator-related nexes. 651 // Do not report UMA stats for translator-related nexes.
649 // TODO(sehr): define new UMA stats for translator related nexe events. 652 // TODO(sehr): define new UMA stats for translator related nexe events.
653 // NOTE: The PNaCl translator nexes are not built to use the IRT. This is
654 // done to save on address space and swap space. The PNaCl translator
655 // nexes also do not use PPAPI. That allows the nexes to be launched
656 // off of the main thread and not block the UI.
650 if (!LoadNaClModuleCommon(wrapper, nacl_subprocess.get(), manifest, 657 if (!LoadNaClModuleCommon(wrapper, nacl_subprocess.get(), manifest,
651 false /* should_report_uma */, 658 false /* should_report_uma */,
659 false /* uses_irt */,
652 false /* uses_ppapi */, 660 false /* uses_ppapi */,
653 error_info, 661 error_info,
654 pp::BlockUntilComplete(), 662 pp::BlockUntilComplete(),
655 pp::BlockUntilComplete())) { 663 pp::BlockUntilComplete())) {
656 return NULL; 664 return NULL;
657 } 665 }
658 // We need not wait for the init_done callback. We can block 666 // We need not wait for the init_done callback. We can block
659 // here in StartSrpcServices, since helper NaCl modules 667 // here in StartSrpcServices, since helper NaCl modules
660 // are spawned from a private thread. 668 // are spawned from a private thread.
661 // 669 //
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 static_cast<uint32_t>(text.size())); 1936 static_cast<uint32_t>(text.size()));
1929 const PPB_Console* console_interface = 1937 const PPB_Console* console_interface =
1930 static_cast<const PPB_Console*>( 1938 static_cast<const PPB_Console*>(
1931 module->GetBrowserInterface(PPB_CONSOLE_INTERFACE)); 1939 module->GetBrowserInterface(PPB_CONSOLE_INTERFACE));
1932 console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str); 1940 console_interface->LogWithSource(pp_instance(), PP_LOGLEVEL_LOG, prefix, str);
1933 var_interface->Release(prefix); 1941 var_interface->Release(prefix);
1934 var_interface->Release(str); 1942 var_interface->Release(str);
1935 } 1943 }
1936 1944
1937 } // namespace plugin 1945 } // 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