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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/rand_util.h" | 12 #include "base/rand_util.h" |
| 13 #include "base/sys_info.h" |
13 #include "components/nacl/common/nacl_host_messages.h" | 14 #include "components/nacl/common/nacl_host_messages.h" |
14 #include "components/nacl/common/nacl_types.h" | 15 #include "components/nacl/common/nacl_types.h" |
15 #include "components/nacl/renderer/pnacl_translation_resource_host.h" | 16 #include "components/nacl/renderer/pnacl_translation_resource_host.h" |
16 #include "content/public/common/content_client.h" | 17 #include "content/public/common/content_client.h" |
17 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
18 #include "content/public/common/sandbox_init.h" | 19 #include "content/public/common/sandbox_init.h" |
19 #include "content/public/renderer/pepper_plugin_instance.h" | 20 #include "content/public/renderer/pepper_plugin_instance.h" |
20 #include "content/public/renderer/render_thread.h" | 21 #include "content/public/renderer/render_thread.h" |
21 #include "content/public/renderer/render_view.h" | 22 #include "content/public/renderer/render_view.h" |
22 #include "content/public/renderer/renderer_ppapi_host.h" | 23 #include "content/public/renderer/renderer_ppapi_host.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 250 |
250 if (transit_fd == IPC::InvalidPlatformFileForTransit()) { | 251 if (transit_fd == IPC::InvalidPlatformFileForTransit()) { |
251 return base::kInvalidPlatformFileValue; | 252 return base::kInvalidPlatformFileValue; |
252 } | 253 } |
253 | 254 |
254 base::PlatformFile handle = IPC::PlatformFileForTransitToPlatformFile( | 255 base::PlatformFile handle = IPC::PlatformFileForTransitToPlatformFile( |
255 transit_fd); | 256 transit_fd); |
256 return handle; | 257 return handle; |
257 } | 258 } |
258 | 259 |
| 260 int32_t GetNumberOfProcessors() { |
| 261 return base::SysInfo::NumberOfProcessors(); |
| 262 } |
| 263 |
259 int32_t GetNexeFd(PP_Instance instance, | 264 int32_t GetNexeFd(PP_Instance instance, |
260 const char* pexe_url, | 265 const char* pexe_url, |
261 uint32_t abi_version, | 266 uint32_t abi_version, |
262 uint32_t opt_level, | 267 uint32_t opt_level, |
263 const char* last_modified, | 268 const char* last_modified, |
264 const char* etag, | 269 const char* etag, |
265 PP_Bool has_no_store_header, | 270 PP_Bool has_no_store_header, |
266 PP_Bool* is_hit, | 271 PP_Bool* is_hit, |
267 PP_FileHandle* handle, | 272 PP_FileHandle* handle, |
268 struct PP_CompletionCallback callback) { | 273 struct PP_CompletionCallback callback) { |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 } | 463 } |
459 | 464 |
460 const PPB_NaCl_Private nacl_interface = { | 465 const PPB_NaCl_Private nacl_interface = { |
461 &LaunchSelLdr, | 466 &LaunchSelLdr, |
462 &StartPpapiProxy, | 467 &StartPpapiProxy, |
463 &UrandomFD, | 468 &UrandomFD, |
464 &Are3DInterfacesDisabled, | 469 &Are3DInterfacesDisabled, |
465 &BrokerDuplicateHandle, | 470 &BrokerDuplicateHandle, |
466 &GetReadonlyPnaclFD, | 471 &GetReadonlyPnaclFD, |
467 &CreateTemporaryFile, | 472 &CreateTemporaryFile, |
| 473 &GetNumberOfProcessors, |
468 &GetNexeFd, | 474 &GetNexeFd, |
469 &ReportTranslationFinished, | 475 &ReportTranslationFinished, |
470 &ReportNaClError, | 476 &ReportNaClError, |
471 &OpenNaClExecutable, | 477 &OpenNaClExecutable, |
472 &DispatchEvent, | 478 &DispatchEvent, |
473 &SetReadOnlyProperty | 479 &SetReadOnlyProperty |
474 }; | 480 }; |
475 | 481 |
476 } // namespace | 482 } // namespace |
477 | 483 |
478 namespace nacl { | 484 namespace nacl { |
479 | 485 |
480 const PPB_NaCl_Private* GetNaClPrivateInterface() { | 486 const PPB_NaCl_Private* GetNaClPrivateInterface() { |
481 return &nacl_interface; | 487 return &nacl_interface; |
482 } | 488 } |
483 | 489 |
484 } // namespace nacl | 490 } // namespace nacl |
485 | 491 |
486 #endif // DISABLE_NACL | 492 #endif // DISABLE_NACL |
OLD | NEW |