| OLD | NEW |
| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 bool result = PP_ToBool(nacl_interface_->StartPpapiProxy(pp_instance())); | 246 bool result = PP_ToBool(nacl_interface_->StartPpapiProxy(pp_instance())); |
| 247 if (result) { | 247 if (result) { |
| 248 PLUGIN_PRINTF(("Plugin::LoadNaClModule (%s)\n", | 248 PLUGIN_PRINTF(("Plugin::LoadNaClModule (%s)\n", |
| 249 main_subprocess_.detailed_description().c_str())); | 249 main_subprocess_.detailed_description().c_str())); |
| 250 } | 250 } |
| 251 return result; | 251 return result; |
| 252 } | 252 } |
| 253 | 253 |
| 254 NaClSubprocess* Plugin::LoadHelperNaClModule(const nacl::string& helper_url, | 254 NaClSubprocess* Plugin::LoadHelperNaClModule(const nacl::string& helper_url, |
| 255 PP_FileHandle file_handle, | 255 PP_FileHandle file_handle, |
| 256 int32_t manifest_id, | |
| 257 ErrorInfo* error_info) { | 256 ErrorInfo* error_info) { |
| 258 nacl::scoped_ptr<NaClSubprocess> nacl_subprocess( | 257 nacl::scoped_ptr<NaClSubprocess> nacl_subprocess( |
| 259 new NaClSubprocess("helper module", NULL, NULL)); | 258 new NaClSubprocess("helper module", NULL, NULL)); |
| 260 if (NULL == nacl_subprocess.get()) { | 259 if (NULL == nacl_subprocess.get()) { |
| 261 error_info->SetReport(PP_NACL_ERROR_SEL_LDR_INIT, | 260 error_info->SetReport(PP_NACL_ERROR_SEL_LDR_INIT, |
| 262 "unable to allocate helper subprocess."); | 261 "unable to allocate helper subprocess."); |
| 263 return NULL; | 262 return NULL; |
| 264 } | 263 } |
| 265 | 264 |
| 266 // Do not report UMA stats for translator-related nexes. | 265 // Do not report UMA stats for translator-related nexes. |
| 267 // TODO(sehr): define new UMA stats for translator related nexe events. | 266 // TODO(sehr): define new UMA stats for translator related nexe events. |
| 268 // NOTE: The PNaCl translator nexes are not built to use the IRT. This is | 267 // NOTE: The PNaCl translator nexes are not built to use the IRT. This is |
| 269 // done to save on address space and swap space. | 268 // done to save on address space and swap space. |
| 270 // TODO(jvoung): See if we still need the uses_ppapi variable, now that | 269 // TODO(jvoung): See if we still need the uses_ppapi variable, now that |
| 271 // LaunchSelLdr always happens on the main thread. | 270 // LaunchSelLdr always happens on the main thread. |
| 272 bool enable_dev_interfaces = | 271 bool enable_dev_interfaces = |
| 273 nacl_interface_->DevInterfacesEnabled(pp_instance()); | 272 nacl_interface_->DevInterfacesEnabled(pp_instance()); |
| 274 SelLdrStartParams params(helper_url, | 273 SelLdrStartParams params(helper_url, |
| 275 false /* uses_irt */, | 274 false /* uses_irt */, |
| 276 false /* uses_ppapi */, | 275 false /* uses_ppapi */, |
| 277 false /* uses_nonsfi_mode */, | 276 false /* uses_nonsfi_mode */, |
| 278 enable_dev_interfaces, | 277 enable_dev_interfaces, |
| 279 false /* enable_dyncode_syscalls */, | 278 false /* enable_dyncode_syscalls */, |
| 280 false /* enable_exception_handling */, | 279 false /* enable_exception_handling */, |
| 281 true /* enable_crash_throttling */); | 280 true /* enable_crash_throttling */); |
| 281 |
| 282 // Helper NaCl modules always use the PNaCl manifest, as there is no |
| 283 // corresponding NMF. |
| 284 int32_t manifest_id = nacl_interface_->CreatePnaclManifest(pp_instance()); |
| 282 if (!LoadNaClModuleFromBackgroundThread(file_handle, nacl_subprocess.get(), | 285 if (!LoadNaClModuleFromBackgroundThread(file_handle, nacl_subprocess.get(), |
| 283 manifest_id, params)) { | 286 manifest_id, params)) { |
| 284 return NULL; | 287 return NULL; |
| 285 } | 288 } |
| 286 // We need not wait for the init_done callback. We can block | 289 // We need not wait for the init_done callback. We can block |
| 287 // here in StartSrpcServices, since helper NaCl modules | 290 // here in StartSrpcServices, since helper NaCl modules |
| 288 // are spawned from a private thread. | 291 // are spawned from a private thread. |
| 289 // | 292 // |
| 290 // TODO(bsy): if helper module crashes, we should abort. | 293 // TODO(bsy): if helper module crashes, we should abort. |
| 291 // crash_cb is not used here, so we are relying on crashes | 294 // crash_cb is not used here, so we are relying on crashes |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 | 635 |
| 633 void Plugin::SetExitStatusOnMainThread(int32_t pp_error, | 636 void Plugin::SetExitStatusOnMainThread(int32_t pp_error, |
| 634 int exit_status) { | 637 int exit_status) { |
| 635 DCHECK(pp::Module::Get()->core()->IsMainThread()); | 638 DCHECK(pp::Module::Get()->core()->IsMainThread()); |
| 636 DCHECK(nacl_interface_); | 639 DCHECK(nacl_interface_); |
| 637 nacl_interface_->SetExitStatus(pp_instance(), exit_status); | 640 nacl_interface_->SetExitStatus(pp_instance(), exit_status); |
| 638 } | 641 } |
| 639 | 642 |
| 640 | 643 |
| 641 } // namespace plugin | 644 } // namespace plugin |
| OLD | NEW |