| 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 "chrome/renderer/pepper/ppb_nacl_private_impl.h" | 5 #include "chrome/renderer/pepper/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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 uint32_t options) { | 197 uint32_t options) { |
| 198 #if defined(OS_WIN) | 198 #if defined(OS_WIN) |
| 199 return content::BrokerDuplicateHandle(source_handle, process_id, | 199 return content::BrokerDuplicateHandle(source_handle, process_id, |
| 200 target_handle, desired_access, | 200 target_handle, desired_access, |
| 201 options); | 201 options); |
| 202 #else | 202 #else |
| 203 return 0; | 203 return 0; |
| 204 #endif | 204 #endif |
| 205 } | 205 } |
| 206 | 206 |
| 207 int32_t EnsurePnaclInstalled(PP_Instance instance, | |
| 208 PP_CompletionCallback callback) { | |
| 209 ppapi::thunk::EnterInstance enter(instance, callback); | |
| 210 if (enter.failed()) | |
| 211 return enter.retval(); | |
| 212 if (!InitializePnaclResourceHost()) | |
| 213 return enter.SetResult(PP_ERROR_FAILED); | |
| 214 g_pnacl_resource_host.Get()->EnsurePnaclInstalled( | |
| 215 instance, | |
| 216 enter.callback()); | |
| 217 return enter.SetResult(PP_OK_COMPLETIONPENDING); | |
| 218 } | |
| 219 | |
| 220 PP_FileHandle GetReadonlyPnaclFD(const char* filename) { | 207 PP_FileHandle GetReadonlyPnaclFD(const char* filename) { |
| 221 IPC::PlatformFileForTransit out_fd = IPC::InvalidPlatformFileForTransit(); | 208 IPC::PlatformFileForTransit out_fd = IPC::InvalidPlatformFileForTransit(); |
| 222 IPC::Sender* sender = content::RenderThread::Get(); | 209 IPC::Sender* sender = content::RenderThread::Get(); |
| 223 DCHECK(sender); | 210 DCHECK(sender); |
| 224 if (!sender->Send(new NaClHostMsg_GetReadonlyPnaclFD( | 211 if (!sender->Send(new NaClHostMsg_GetReadonlyPnaclFD( |
| 225 std::string(filename), | 212 std::string(filename), |
| 226 &out_fd))) { | 213 &out_fd))) { |
| 227 return base::kInvalidPlatformFileValue; | 214 return base::kInvalidPlatformFileValue; |
| 228 } | 215 } |
| 229 if (out_fd == IPC::InvalidPlatformFileForTransit()) { | 216 if (out_fd == IPC::InvalidPlatformFileForTransit()) { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 IPC::PlatformFileForTransitToPlatformFile(out_fd); | 335 IPC::PlatformFileForTransitToPlatformFile(out_fd); |
| 349 return handle; | 336 return handle; |
| 350 } | 337 } |
| 351 | 338 |
| 352 const PPB_NaCl_Private nacl_interface = { | 339 const PPB_NaCl_Private nacl_interface = { |
| 353 &LaunchSelLdr, | 340 &LaunchSelLdr, |
| 354 &StartPpapiProxy, | 341 &StartPpapiProxy, |
| 355 &UrandomFD, | 342 &UrandomFD, |
| 356 &Are3DInterfacesDisabled, | 343 &Are3DInterfacesDisabled, |
| 357 &BrokerDuplicateHandle, | 344 &BrokerDuplicateHandle, |
| 358 &EnsurePnaclInstalled, | |
| 359 &GetReadonlyPnaclFD, | 345 &GetReadonlyPnaclFD, |
| 360 &CreateTemporaryFile, | 346 &CreateTemporaryFile, |
| 361 &GetNexeFd, | 347 &GetNexeFd, |
| 362 &ReportTranslationFinished, | 348 &ReportTranslationFinished, |
| 363 &IsOffTheRecord, | 349 &IsOffTheRecord, |
| 364 &ReportNaClError, | 350 &ReportNaClError, |
| 365 &OpenNaClExecutable | 351 &OpenNaClExecutable |
| 366 }; | 352 }; |
| 367 | 353 |
| 368 } // namespace | 354 } // namespace |
| 369 | 355 |
| 370 const PPB_NaCl_Private* PPB_NaCl_Private_Impl::GetInterface() { | 356 const PPB_NaCl_Private* PPB_NaCl_Private_Impl::GetInterface() { |
| 371 return &nacl_interface; | 357 return &nacl_interface; |
| 372 } | 358 } |
| 373 | 359 |
| 374 #endif // DISABLE_NACL | 360 #endif // DISABLE_NACL |
| OLD | NEW |