Chromium Code Reviews| 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 #include "ppapi/native_client/src/trusted/plugin/plugin.h" | 5 #include "ppapi/native_client/src/trusted/plugin/plugin.h" |
| 6 | 6 |
| 7 #include <sys/stat.h> | 7 #include <sys/stat.h> |
| 8 #include <sys/types.h> | 8 #include <sys/types.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 kTimeSmallMin, kTimeSmallMax, | 65 kTimeSmallMin, kTimeSmallMax, |
| 66 kTimeSmallBuckets); | 66 kTimeSmallBuckets); |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool Plugin::LoadNaClModuleFromBackgroundThread( | 69 bool Plugin::LoadNaClModuleFromBackgroundThread( |
| 70 PP_FileHandle file_handle, | 70 PP_FileHandle file_handle, |
| 71 NaClSubprocess* subprocess, | 71 NaClSubprocess* subprocess, |
| 72 const SelLdrStartParams& params) { | 72 const SelLdrStartParams& params) { |
| 73 CHECK(!pp::Module::Get()->core()->IsMainThread()); | 73 CHECK(!pp::Module::Get()->core()->IsMainThread()); |
| 74 ServiceRuntime* service_runtime = | 74 ServiceRuntime* service_runtime = |
| 75 new ServiceRuntime(this, false, uses_nonsfi_mode_, | 75 new ServiceRuntime(this, |
| 76 false, // No main_service_runtime. | |
| 77 false, // No non-SFI mode (i.e. in SFI-mode). | |
|
Mark Seaborn
2014/06/17 15:16:55
It's not obvious why it's OK to change this to 'fa
hidehiko
2014/06/17 16:47:03
Renamed the method name as Justin suggested. Also
| |
| 76 pp::BlockUntilComplete(), pp::BlockUntilComplete()); | 78 pp::BlockUntilComplete(), pp::BlockUntilComplete()); |
| 77 subprocess->set_service_runtime(service_runtime); | 79 subprocess->set_service_runtime(service_runtime); |
| 78 PLUGIN_PRINTF(("Plugin::LoadNaClModuleFromBackgroundThread " | 80 PLUGIN_PRINTF(("Plugin::LoadNaClModuleFromBackgroundThread " |
| 79 "(service_runtime=%p)\n", | 81 "(service_runtime=%p)\n", |
| 80 static_cast<void*>(service_runtime))); | 82 static_cast<void*>(service_runtime))); |
| 81 | 83 |
| 82 // Now start the SelLdr instance. This must be created on the main thread. | 84 // Now start the SelLdr instance. This must be created on the main thread. |
| 83 bool service_runtime_started = false; | 85 bool service_runtime_started = false; |
| 84 pp::CompletionCallback sel_ldr_callback = | 86 pp::CompletionCallback sel_ldr_callback = |
| 85 callback_factory_.NewCallback(&Plugin::SignalStartSelLdrDone, | 87 callback_factory_.NewCallback(&Plugin::SignalStartSelLdrDone, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 // the ServiceRuntime object for an existing subprocess, and that any | 165 // the ServiceRuntime object for an existing subprocess, and that any |
| 164 // associated listener threads do not go unjoined because if they | 166 // associated listener threads do not go unjoined because if they |
| 165 // outlive the Plugin object, they will not be memory safe. | 167 // outlive the Plugin object, they will not be memory safe. |
| 166 ShutDownSubprocesses(); | 168 ShutDownSubprocesses(); |
| 167 pp::Var manifest_base_url = | 169 pp::Var manifest_base_url = |
| 168 pp::Var(pp::PASS_REF, nacl_interface_->GetManifestBaseURL(pp_instance())); | 170 pp::Var(pp::PASS_REF, nacl_interface_->GetManifestBaseURL(pp_instance())); |
| 169 std::string manifest_base_url_str = manifest_base_url.AsString(); | 171 std::string manifest_base_url_str = manifest_base_url.AsString(); |
| 170 SelLdrStartParams params(manifest_base_url_str, | 172 SelLdrStartParams params(manifest_base_url_str, |
| 171 true /* uses_irt */, | 173 true /* uses_irt */, |
| 172 true /* uses_ppapi */, | 174 true /* uses_ppapi */, |
| 173 uses_nonsfi_mode, | |
| 174 enable_dyncode_syscalls, | 175 enable_dyncode_syscalls, |
| 175 enable_exception_handling, | 176 enable_exception_handling, |
| 176 enable_crash_throttling); | 177 enable_crash_throttling); |
| 177 ErrorInfo error_info; | 178 ErrorInfo error_info; |
| 178 ServiceRuntime* service_runtime = | 179 ServiceRuntime* service_runtime = new ServiceRuntime( |
| 179 new ServiceRuntime(this, true, uses_nonsfi_mode, | 180 this, true, uses_nonsfi_mode, init_done_cb, crash_cb); |
| 180 init_done_cb, crash_cb); | |
| 181 main_subprocess_.set_service_runtime(service_runtime); | 181 main_subprocess_.set_service_runtime(service_runtime); |
| 182 PLUGIN_PRINTF(("Plugin::LoadNaClModule (service_runtime=%p)\n", | 182 PLUGIN_PRINTF(("Plugin::LoadNaClModule (service_runtime=%p)\n", |
| 183 static_cast<void*>(service_runtime))); | 183 static_cast<void*>(service_runtime))); |
| 184 if (NULL == service_runtime) { | 184 if (NULL == service_runtime) { |
| 185 error_info.SetReport( | 185 error_info.SetReport( |
| 186 PP_NACL_ERROR_SEL_LDR_INIT, | 186 PP_NACL_ERROR_SEL_LDR_INIT, |
| 187 "sel_ldr init failure " + main_subprocess_.description()); | 187 "sel_ldr init failure " + main_subprocess_.description()); |
| 188 ReportLoadError(error_info); | 188 ReportLoadError(error_info); |
| 189 return; | 189 return; |
| 190 } | 190 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 return NULL; | 244 return NULL; |
| 245 } | 245 } |
| 246 | 246 |
| 247 // Do not report UMA stats for translator-related nexes. | 247 // Do not report UMA stats for translator-related nexes. |
| 248 // TODO(sehr): define new UMA stats for translator related nexe events. | 248 // TODO(sehr): define new UMA stats for translator related nexe events. |
| 249 // NOTE: The PNaCl translator nexes are not built to use the IRT. This is | 249 // NOTE: The PNaCl translator nexes are not built to use the IRT. This is |
| 250 // done to save on address space and swap space. | 250 // done to save on address space and swap space. |
| 251 SelLdrStartParams params(helper_url, | 251 SelLdrStartParams params(helper_url, |
| 252 false /* uses_irt */, | 252 false /* uses_irt */, |
| 253 false /* uses_ppapi */, | 253 false /* uses_ppapi */, |
| 254 false /* uses_nonsfi_mode */, | |
| 255 false /* enable_dyncode_syscalls */, | 254 false /* enable_dyncode_syscalls */, |
| 256 false /* enable_exception_handling */, | 255 false /* enable_exception_handling */, |
| 257 true /* enable_crash_throttling */); | 256 true /* enable_crash_throttling */); |
| 258 | 257 |
| 259 // Helper NaCl modules always use the PNaCl manifest, as there is no | 258 // Helper NaCl modules always use the PNaCl manifest, as there is no |
| 260 // corresponding NMF. | 259 // corresponding NMF. |
| 261 if (!LoadNaClModuleFromBackgroundThread(file_handle, nacl_subprocess.get(), | 260 if (!LoadNaClModuleFromBackgroundThread(file_handle, nacl_subprocess.get(), |
| 262 params)) { | 261 params)) { |
| 263 return NULL; | 262 return NULL; |
| 264 } | 263 } |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 529 | 528 |
| 530 void Plugin::SetExitStatusOnMainThread(int32_t pp_error, | 529 void Plugin::SetExitStatusOnMainThread(int32_t pp_error, |
| 531 int exit_status) { | 530 int exit_status) { |
| 532 DCHECK(pp::Module::Get()->core()->IsMainThread()); | 531 DCHECK(pp::Module::Get()->core()->IsMainThread()); |
| 533 DCHECK(nacl_interface_); | 532 DCHECK(nacl_interface_); |
| 534 nacl_interface_->SetExitStatus(pp_instance(), exit_status); | 533 nacl_interface_->SetExitStatus(pp_instance(), exit_status); |
| 535 } | 534 } |
| 536 | 535 |
| 537 | 536 |
| 538 } // namespace plugin | 537 } // namespace plugin |
| OLD | NEW |