Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/nacl/renderer/ppb_nacl_private_impl.h" | 5 #include "components/nacl/renderer/ppb_nacl_private_impl.h" |
| 6 | 6 |
| 7 #include <numeric> | 7 #include <numeric> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 user_data_ = NULL; | 245 user_data_ = NULL; |
| 246 } | 246 } |
| 247 | 247 |
| 248 PPP_ManifestService manifest_service_; | 248 PPP_ManifestService manifest_service_; |
| 249 void* user_data_; | 249 void* user_data_; |
| 250 DISALLOW_COPY_AND_ASSIGN(ManifestServiceProxy); | 250 DISALLOW_COPY_AND_ASSIGN(ManifestServiceProxy); |
| 251 }; | 251 }; |
| 252 | 252 |
| 253 // Launch NaCl's sel_ldr process. | 253 // Launch NaCl's sel_ldr process. |
| 254 void LaunchSelLdr(PP_Instance instance, | 254 void LaunchSelLdr(PP_Instance instance, |
| 255 PP_Bool main_service_runtime, | |
| 255 const char* alleged_url, | 256 const char* alleged_url, |
| 256 PP_Bool uses_irt, | 257 PP_Bool uses_irt, |
| 257 PP_Bool uses_ppapi, | 258 PP_Bool uses_ppapi, |
| 258 PP_Bool uses_nonsfi_mode, | 259 PP_Bool uses_nonsfi_mode, |
| 259 PP_Bool enable_ppapi_dev, | 260 PP_Bool enable_ppapi_dev, |
| 260 PP_Bool enable_dyncode_syscalls, | 261 PP_Bool enable_dyncode_syscalls, |
| 261 PP_Bool enable_exception_handling, | 262 PP_Bool enable_exception_handling, |
| 262 PP_Bool enable_crash_throttling, | 263 PP_Bool enable_crash_throttling, |
| 263 const PPP_ManifestService* manifest_service_interface, | 264 const PPP_ManifestService* manifest_service_interface, |
| 264 void* manifest_service_user_data, | 265 void* manifest_service_user_data, |
| 265 void* imc_handle, | 266 void* imc_handle, |
| 266 struct PP_Var* error_message, | |
| 267 PP_CompletionCallback callback) { | 267 PP_CompletionCallback callback) { |
| 268 CHECK(ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()-> | 268 CHECK(ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()-> |
| 269 BelongsToCurrentThread()); | 269 BelongsToCurrentThread()); |
| 270 | 270 |
| 271 // Create the manifest service proxy here, so on error case, it will be | 271 // Create the manifest service proxy here, so on error case, it will be |
| 272 // destructed (without passing it to ManifestServiceChannel), and QUIT | 272 // destructed (without passing it to ManifestServiceChannel), and QUIT |
| 273 // will be called in its destructor so that the caller of this function | 273 // will be called in its destructor so that the caller of this function |
| 274 // can free manifest_service_user_data properly. | 274 // can free manifest_service_user_data properly. |
| 275 scoped_ptr<ManifestServiceChannel::Delegate> manifest_service_proxy( | 275 scoped_ptr<ManifestServiceChannel::Delegate> manifest_service_proxy( |
| 276 new ManifestServiceProxy(manifest_service_interface, | 276 new ManifestServiceProxy(manifest_service_interface, |
| 277 manifest_service_user_data)); | 277 manifest_service_user_data)); |
| 278 | 278 |
| 279 FileDescriptor result_socket; | 279 FileDescriptor result_socket; |
| 280 IPC::Sender* sender = content::RenderThread::Get(); | 280 IPC::Sender* sender = content::RenderThread::Get(); |
| 281 DCHECK(sender); | 281 DCHECK(sender); |
| 282 *error_message = PP_MakeUndefined(); | |
| 283 int routing_id = 0; | 282 int routing_id = 0; |
| 284 // If the nexe uses ppapi APIs, we need a routing ID. | 283 // If the nexe uses ppapi APIs, we need a routing ID. |
| 285 // To get the routing ID, we must be on the main thread. | 284 // To get the routing ID, we must be on the main thread. |
| 286 // Some nexes do not use ppapi and launch from the background thread, | 285 // Some nexes do not use ppapi and launch from the background thread, |
| 287 // so those nexes can skip finding a routing_id. | 286 // so those nexes can skip finding a routing_id. |
| 288 if (uses_ppapi) { | 287 if (uses_ppapi) { |
| 289 routing_id = GetRoutingID(instance); | 288 routing_id = GetRoutingID(instance); |
| 290 if (!routing_id) { | 289 if (!routing_id) { |
| 291 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 290 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
| 292 FROM_HERE, | 291 FROM_HERE, |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 321 PP_ToBool(enable_crash_throttling)), | 320 PP_ToBool(enable_crash_throttling)), |
| 322 &launch_result, | 321 &launch_result, |
| 323 &error_message_string))) { | 322 &error_message_string))) { |
| 324 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 323 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
| 325 FROM_HERE, | 324 FROM_HERE, |
| 326 base::Bind(callback.func, callback.user_data, | 325 base::Bind(callback.func, callback.user_data, |
| 327 static_cast<int32_t>(PP_ERROR_FAILED))); | 326 static_cast<int32_t>(PP_ERROR_FAILED))); |
| 328 return; | 327 return; |
| 329 } | 328 } |
| 330 if (!error_message_string.empty()) { | 329 if (!error_message_string.empty()) { |
| 331 *error_message = ppapi::StringVar::StringToPPVar(error_message_string); | 330 if (PP_ToBool(main_service_runtime)) { |
| 331 NexeLoadManager* load_manager = GetNexeLoadManager(instance); | |
| 332 if (load_manager) | |
|
bbudge
2014/05/12 20:50:15
brackets?
| |
| 333 load_manager->ReportLoadError(PP_NACL_ERROR_SEL_LDR_LAUNCH, | |
| 334 "ServiceRuntime: failed to start", | |
| 335 error_message_string); | |
| 336 } | |
| 332 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 337 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
| 333 FROM_HERE, | 338 FROM_HERE, |
| 334 base::Bind(callback.func, callback.user_data, | 339 base::Bind(callback.func, callback.user_data, |
| 335 static_cast<int32_t>(PP_ERROR_FAILED))); | 340 static_cast<int32_t>(PP_ERROR_FAILED))); |
| 336 return; | 341 return; |
| 337 } | 342 } |
| 338 result_socket = launch_result.imc_channel_handle; | 343 result_socket = launch_result.imc_channel_handle; |
| 339 instance_info.channel_handle = launch_result.ppapi_ipc_channel_handle; | 344 instance_info.channel_handle = launch_result.ppapi_ipc_channel_handle; |
| 340 instance_info.plugin_pid = launch_result.plugin_pid; | 345 instance_info.plugin_pid = launch_result.plugin_pid; |
| 341 instance_info.plugin_child_id = launch_result.plugin_child_id; | 346 instance_info.plugin_child_id = launch_result.plugin_child_id; |
| (...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1308 &PostMessageToJavaScript | 1313 &PostMessageToJavaScript |
| 1309 }; | 1314 }; |
| 1310 | 1315 |
| 1311 } // namespace | 1316 } // namespace |
| 1312 | 1317 |
| 1313 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 1318 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
| 1314 return &nacl_interface; | 1319 return &nacl_interface; |
| 1315 } | 1320 } |
| 1316 | 1321 |
| 1317 } // namespace nacl | 1322 } // namespace nacl |
| OLD | NEW |