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

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

Issue 176813010: Avoid blocking the PNaCl translator processes when chrome NaCl GDB flag is on. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 6 years, 9 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 "ppapi/native_client/src/trusted/plugin/plugin.h" 10 #include "ppapi/native_client/src/trusted/plugin/plugin.h"
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 } else if (ipc_result == PP_EXTERNAL_PLUGIN_ERROR_INSTANCE) { 428 } else if (ipc_result == PP_EXTERNAL_PLUGIN_ERROR_INSTANCE) {
429 error_info->SetReport(PP_NACL_ERROR_START_PROXY_INSTANCE, 429 error_info->SetReport(PP_NACL_ERROR_START_PROXY_INSTANCE,
430 "could not create instance."); 430 "could not create instance.");
431 return false; 431 return false;
432 } 432 }
433 PLUGIN_PRINTF(("Plugin::LoadNaClModule (%s)\n", 433 PLUGIN_PRINTF(("Plugin::LoadNaClModule (%s)\n",
434 main_subprocess_.detailed_description().c_str())); 434 main_subprocess_.detailed_description().c_str()));
435 return true; 435 return true;
436 } 436 }
437 437
438 NaClSubprocess* Plugin::LoadHelperNaClModule(nacl::DescWrapper* wrapper, 438 NaClSubprocess* Plugin::LoadHelperNaClModule(const nacl::string& helper_url,
439 nacl::DescWrapper* wrapper,
439 const Manifest* manifest, 440 const Manifest* manifest,
440 ErrorInfo* error_info) { 441 ErrorInfo* error_info) {
441 nacl::scoped_ptr<NaClSubprocess> nacl_subprocess( 442 nacl::scoped_ptr<NaClSubprocess> nacl_subprocess(
442 new NaClSubprocess("helper module", NULL, NULL)); 443 new NaClSubprocess("helper module", NULL, NULL));
443 if (NULL == nacl_subprocess.get()) { 444 if (NULL == nacl_subprocess.get()) {
444 error_info->SetReport(PP_NACL_ERROR_SEL_LDR_INIT, 445 error_info->SetReport(PP_NACL_ERROR_SEL_LDR_INIT,
445 "unable to allocate helper subprocess."); 446 "unable to allocate helper subprocess.");
446 return NULL; 447 return NULL;
447 } 448 }
448 449
449 // Do not report UMA stats for translator-related nexes. 450 // Do not report UMA stats for translator-related nexes.
450 // TODO(sehr): define new UMA stats for translator related nexe events. 451 // TODO(sehr): define new UMA stats for translator related nexe events.
451 // NOTE: The PNaCl translator nexes are not built to use the IRT. This is 452 // NOTE: The PNaCl translator nexes are not built to use the IRT. This is
452 // done to save on address space and swap space. 453 // done to save on address space and swap space.
453 // TODO(jvoung): See if we still need the uses_ppapi variable, now that 454 // TODO(jvoung): See if we still need the uses_ppapi variable, now that
454 // LaunchSelLdr always happens on the main thread. 455 // LaunchSelLdr always happens on the main thread.
455 SelLdrStartParams params(manifest_base_url(), 456 SelLdrStartParams params(helper_url,
456 false /* uses_irt */, 457 false /* uses_irt */,
457 false /* uses_ppapi */, 458 false /* uses_ppapi */,
458 enable_dev_interfaces_, 459 enable_dev_interfaces_,
459 false /* enable_dyncode_syscalls */, 460 false /* enable_dyncode_syscalls */,
460 false /* enable_exception_handling */, 461 false /* enable_exception_handling */,
461 true /* enable_crash_throttling */); 462 true /* enable_crash_throttling */);
462 if (!LoadNaClModuleFromBackgroundThread(wrapper, nacl_subprocess.get(), 463 if (!LoadNaClModuleFromBackgroundThread(wrapper, nacl_subprocess.get(),
463 manifest, params)) { 464 manifest, params)) {
464 return NULL; 465 return NULL;
465 } 466 }
466 // We need not wait for the init_done callback. We can block 467 // We need not wait for the init_done callback. We can block
467 // here in StartSrpcServices, since helper NaCl modules 468 // here in StartSrpcServices, since helper NaCl modules
468 // are spawned from a private thread. 469 // are spawned from a private thread.
469 // 470 //
470 // TODO(bsy): if helper module crashes, we should abort. 471 // TODO(bsy): if helper module crashes, we should abort.
471 // crash_cb is not used here, so we are relying on crashes 472 // crash_cb is not used here, so we are relying on crashes
472 // being detected in StartSrpcServices or later. 473 // being detected in StartSrpcServices or later.
473 // 474 //
474 // NB: More refactoring might be needed, however, if helper 475 // NB: More refactoring might be needed, however, if helper
475 // NaCl modules have their own manifest. Currently the 476 // NaCl modules have their own manifest. Currently the
476 // manifest is a per-plugin-instance object, not a per 477 // manifest is a per-plugin-instance object, not a per
477 // NaClSubprocess object. 478 // NaClSubprocess object.
478 if (!nacl_subprocess->StartSrpcServices()) { 479 if (!nacl_subprocess->StartSrpcServices()) {
479 error_info->SetReport(PP_NACL_ERROR_SRPC_CONNECTION_FAIL, 480 error_info->SetReport(PP_NACL_ERROR_SRPC_CONNECTION_FAIL,
480 "SRPC connection failure for " + 481 "SRPC connection failure for " +
481 nacl_subprocess->description()); 482 nacl_subprocess->description());
482 return NULL; 483 return NULL;
483 } 484 }
484 485
485 PLUGIN_PRINTF(("Plugin::LoadHelperNaClModule (%s)\n", 486 PLUGIN_PRINTF(("Plugin::LoadHelperNaClModule (%s, %s)\n",
487 helper_url.c_str(),
486 nacl_subprocess.get()->detailed_description().c_str())); 488 nacl_subprocess.get()->detailed_description().c_str()));
487 489
488 return nacl_subprocess.release(); 490 return nacl_subprocess.release();
489 } 491 }
490 492
491 std::string Plugin::LookupArgument(const std::string& key) const { 493 std::string Plugin::LookupArgument(const std::string& key) const {
492 std::map<std::string, std::string>::const_iterator it = args_.find(key); 494 std::map<std::string, std::string>::const_iterator it = args_.find(key);
493 if (it != args_.end()) 495 if (it != args_.end())
494 return it->second; 496 return it->second;
495 return std::string(); 497 return std::string();
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 DCHECK(pp::Module::Get()->core()->IsMainThread()); 1479 DCHECK(pp::Module::Get()->core()->IsMainThread());
1478 DCHECK(nacl_interface_); 1480 DCHECK(nacl_interface_);
1479 exit_status_ = exit_status; 1481 exit_status_ = exit_status;
1480 nacl_interface_->SetReadOnlyProperty(pp_instance(), 1482 nacl_interface_->SetReadOnlyProperty(pp_instance(),
1481 pp::Var("exitStatus").pp_var(), 1483 pp::Var("exitStatus").pp_var(),
1482 pp::Var(exit_status_).pp_var()); 1484 pp::Var(exit_status_).pp_var());
1483 } 1485 }
1484 1486
1485 1487
1486 } // namespace plugin 1488 } // namespace plugin
OLDNEW
« no previous file with comments | « ppapi/native_client/src/trusted/plugin/plugin.h ('k') | ppapi/native_client/src/trusted/plugin/pnacl_resources.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698