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