| 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 #ifndef DISABLE_NACL | 7 #ifndef DISABLE_NACL |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 // Launch NaCl's sel_ldr process. | 105 // Launch NaCl's sel_ldr process. |
| 106 void LaunchSelLdr(PP_Instance instance, | 106 void LaunchSelLdr(PP_Instance instance, |
| 107 const char* alleged_url, | 107 const char* alleged_url, |
| 108 PP_Bool uses_irt, | 108 PP_Bool uses_irt, |
| 109 PP_Bool uses_ppapi, | 109 PP_Bool uses_ppapi, |
| 110 PP_Bool enable_ppapi_dev, | 110 PP_Bool enable_ppapi_dev, |
| 111 PP_Bool enable_dyncode_syscalls, | 111 PP_Bool enable_dyncode_syscalls, |
| 112 PP_Bool enable_exception_handling, | 112 PP_Bool enable_exception_handling, |
| 113 PP_Bool enable_crash_throttling, | 113 PP_Bool enable_crash_throttling, |
| 114 PP_Bool enable_nonsfi, |
| 114 void* imc_handle, | 115 void* imc_handle, |
| 115 struct PP_Var* error_message, | 116 struct PP_Var* error_message, |
| 116 PP_CompletionCallback callback) { | 117 PP_CompletionCallback callback) { |
| 117 CHECK(ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()-> | 118 CHECK(ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()-> |
| 118 BelongsToCurrentThread()); | 119 BelongsToCurrentThread()); |
| 119 | 120 |
| 120 nacl::FileDescriptor result_socket; | 121 nacl::FileDescriptor result_socket; |
| 121 IPC::Sender* sender = content::RenderThread::Get(); | 122 IPC::Sender* sender = content::RenderThread::Get(); |
| 122 DCHECK(sender); | 123 DCHECK(sender); |
| 123 *error_message = PP_MakeUndefined(); | 124 *error_message = PP_MakeUndefined(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 151 std::string error_message_string; | 152 std::string error_message_string; |
| 152 nacl::NaClLaunchResult launch_result; | 153 nacl::NaClLaunchResult launch_result; |
| 153 | 154 |
| 154 if (!sender->Send(new NaClHostMsg_LaunchNaCl( | 155 if (!sender->Send(new NaClHostMsg_LaunchNaCl( |
| 155 nacl::NaClLaunchParams(instance_info.url.spec(), | 156 nacl::NaClLaunchParams(instance_info.url.spec(), |
| 156 routing_id, | 157 routing_id, |
| 157 perm_bits, | 158 perm_bits, |
| 158 PP_ToBool(uses_irt), | 159 PP_ToBool(uses_irt), |
| 159 PP_ToBool(enable_dyncode_syscalls), | 160 PP_ToBool(enable_dyncode_syscalls), |
| 160 PP_ToBool(enable_exception_handling), | 161 PP_ToBool(enable_exception_handling), |
| 161 PP_ToBool(enable_crash_throttling)), | 162 PP_ToBool(enable_crash_throttling), |
| 163 PP_ToBool(enable_nonsfi)), |
| 162 &launch_result, | 164 &launch_result, |
| 163 &error_message_string))) { | 165 &error_message_string))) { |
| 164 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( | 166 ppapi::PpapiGlobals::Get()->GetMainThreadMessageLoop()->PostTask( |
| 165 FROM_HERE, | 167 FROM_HERE, |
| 166 base::Bind(callback.func, callback.user_data, | 168 base::Bind(callback.func, callback.user_data, |
| 167 static_cast<int32_t>(PP_ERROR_FAILED))); | 169 static_cast<int32_t>(PP_ERROR_FAILED))); |
| 168 return; | 170 return; |
| 169 } | 171 } |
| 170 if (!error_message_string.empty()) { | 172 if (!error_message_string.empty()) { |
| 171 *error_message = ppapi::StringVar::StringToPPVar(error_message_string); | 173 *error_message = ppapi::StringVar::StringToPPVar(error_message_string); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 int32_t GetNumberOfProcessors() { | 297 int32_t GetNumberOfProcessors() { |
| 296 int32_t num_processors; | 298 int32_t num_processors; |
| 297 IPC::Sender* sender = content::RenderThread::Get(); | 299 IPC::Sender* sender = content::RenderThread::Get(); |
| 298 DCHECK(sender); | 300 DCHECK(sender); |
| 299 if(!sender->Send(new NaClHostMsg_NaClGetNumProcessors(&num_processors))) { | 301 if(!sender->Send(new NaClHostMsg_NaClGetNumProcessors(&num_processors))) { |
| 300 return 1; | 302 return 1; |
| 301 } | 303 } |
| 302 return num_processors; | 304 return num_processors; |
| 303 } | 305 } |
| 304 | 306 |
| 307 PP_Bool IsNonSFIEnabled() { |
| 308 bool enabled; |
| 309 IPC::Sender* sender = content::RenderThread::Get(); |
| 310 DCHECK(sender); |
| 311 if (!sender->Send(new NaClHostMsg_NaClIsNonSFIEnabled(&enabled))) { |
| 312 return PP_FALSE; |
| 313 } |
| 314 return PP_FromBool(enabled); |
| 315 } |
| 316 |
| 305 int32_t GetNexeFd(PP_Instance instance, | 317 int32_t GetNexeFd(PP_Instance instance, |
| 306 const char* pexe_url, | 318 const char* pexe_url, |
| 307 uint32_t abi_version, | 319 uint32_t abi_version, |
| 308 uint32_t opt_level, | 320 uint32_t opt_level, |
| 309 const char* last_modified, | 321 const char* last_modified, |
| 310 const char* etag, | 322 const char* etag, |
| 311 PP_Bool has_no_store_header, | 323 PP_Bool has_no_store_header, |
| 312 const char* sandbox_isa, | 324 const char* sandbox_isa, |
| 313 const char* extra_flags, | 325 const char* extra_flags, |
| 314 PP_Bool* is_hit, | 326 PP_Bool* is_hit, |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 | 554 |
| 543 const PPB_NaCl_Private nacl_interface = { | 555 const PPB_NaCl_Private nacl_interface = { |
| 544 &LaunchSelLdr, | 556 &LaunchSelLdr, |
| 545 &StartPpapiProxy, | 557 &StartPpapiProxy, |
| 546 &UrandomFD, | 558 &UrandomFD, |
| 547 &Are3DInterfacesDisabled, | 559 &Are3DInterfacesDisabled, |
| 548 &BrokerDuplicateHandle, | 560 &BrokerDuplicateHandle, |
| 549 &GetReadonlyPnaclFD, | 561 &GetReadonlyPnaclFD, |
| 550 &CreateTemporaryFile, | 562 &CreateTemporaryFile, |
| 551 &GetNumberOfProcessors, | 563 &GetNumberOfProcessors, |
| 564 &IsNonSFIEnabled, |
| 552 &GetNexeFd, | 565 &GetNexeFd, |
| 553 &ReportTranslationFinished, | 566 &ReportTranslationFinished, |
| 554 &OpenNaClExecutable, | 567 &OpenNaClExecutable, |
| 555 &DispatchEvent, | 568 &DispatchEvent, |
| 556 &SetReadOnlyProperty, | 569 &SetReadOnlyProperty, |
| 557 &ReportLoadError, | 570 &ReportLoadError, |
| 558 &InstanceDestroyed | 571 &InstanceDestroyed |
| 559 }; | 572 }; |
| 560 | 573 |
| 561 } // namespace | 574 } // namespace |
| 562 | 575 |
| 563 namespace nacl { | 576 namespace nacl { |
| 564 | 577 |
| 565 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 578 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
| 566 return &nacl_interface; | 579 return &nacl_interface; |
| 567 } | 580 } |
| 568 | 581 |
| 569 } // namespace nacl | 582 } // namespace nacl |
| 570 | 583 |
| 571 #endif // DISABLE_NACL | 584 #endif // DISABLE_NACL |
| OLD | NEW |