| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #include "native_client/src/shared/imc/nacl_imc_c.h" | 7 #include "native_client/src/shared/imc/nacl_imc_c.h" |
| 8 #include "native_client/src/shared/platform/nacl_time.h" | 8 #include "native_client/src/shared/platform/nacl_time.h" |
| 9 #include "native_client/src/trusted/desc/nrd_all_modules.h" | 9 #include "native_client/src/trusted/desc/nrd_all_modules.h" |
| 10 #include "native_client/src/trusted/plugin/nacl_entry_points.h" | 10 #include "native_client/src/trusted/plugin/nacl_entry_points.h" |
| 11 #include "native_client/src/trusted/plugin/plugin.h" | 11 #include "native_client/src/trusted/plugin/plugin.h" |
| 12 | 12 |
| 13 #include "ppapi/c/private/ppb_nacl_private.h" | 13 #include "ppapi/c/private/ppb_nacl_private.h" |
| 14 #include "ppapi/cpp/module.h" | 14 #include "ppapi/cpp/module.h" |
| 15 | 15 |
| 16 GetURandomFDFunc get_urandom_fd; | |
| 17 | |
| 18 namespace plugin { | 16 namespace plugin { |
| 19 | 17 |
| 20 class ModulePpapi : public pp::Module { | 18 class ModulePpapi : public pp::Module { |
| 21 public: | 19 public: |
| 22 ModulePpapi() : pp::Module(), | 20 ModulePpapi() : pp::Module(), |
| 23 init_was_successful_(false), | 21 init_was_successful_(false), |
| 24 private_interface_(NULL) { | 22 private_interface_(NULL) { |
| 25 MODULE_PRINTF(("ModulePpapi::ModulePpapi (this=%p)\n", | 23 MODULE_PRINTF(("ModulePpapi::ModulePpapi (this=%p)\n", |
| 26 static_cast<void*>(this))); | 24 static_cast<void*>(this))); |
| 27 } | 25 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 41 GetBrowserInterface(PPB_NACL_PRIVATE_INTERFACE)); | 39 GetBrowserInterface(PPB_NACL_PRIVATE_INTERFACE)); |
| 42 | 40 |
| 43 if (NULL == private_interface_) { | 41 if (NULL == private_interface_) { |
| 44 MODULE_PRINTF(("ModulePpapi::Init failed: " | 42 MODULE_PRINTF(("ModulePpapi::Init failed: " |
| 45 "GetBrowserInterface returned NULL\n")); | 43 "GetBrowserInterface returned NULL\n")); |
| 46 return false; | 44 return false; |
| 47 } | 45 } |
| 48 | 46 |
| 49 launch_nacl_process = reinterpret_cast<LaunchNaClProcessFunc>( | 47 launch_nacl_process = reinterpret_cast<LaunchNaClProcessFunc>( |
| 50 private_interface_->LaunchSelLdr); | 48 private_interface_->LaunchSelLdr); |
| 51 // TODO(mseaborn): Remove this get_urandom_fd global variable once | |
| 52 // the NaCl side no longer depends on it. | |
| 53 get_urandom_fd = private_interface_->UrandomFD; | |
| 54 | 49 |
| 55 #if NACL_LINUX || NACL_OSX | 50 #if NACL_LINUX || NACL_OSX |
| 51 // Note that currently we do not need random numbers inside the |
| 52 // NaCl trusted plugin on Unix, but NaClSecureRngModuleInit() is |
| 53 // strict and will raise a fatal error unless we provide it with a |
| 54 // /dev/urandom FD beforehand. |
| 56 NaClSecureRngModuleSetUrandomFd(dup(private_interface_->UrandomFD())); | 55 NaClSecureRngModuleSetUrandomFd(dup(private_interface_->UrandomFD())); |
| 57 #endif | 56 #endif |
| 58 | 57 |
| 59 // In the plugin, we don't need high resolution time of day. | 58 // In the plugin, we don't need high resolution time of day. |
| 60 NaClAllowLowResolutionTimeOfDay(); | 59 NaClAllowLowResolutionTimeOfDay(); |
| 61 NaClNrdAllModulesInit(); | 60 NaClNrdAllModulesInit(); |
| 62 NaClSrpcModuleInit(); | 61 NaClSrpcModuleInit(); |
| 63 | 62 |
| 64 #if NACL_WINDOWS && !defined(NACL_STANDALONE) | 63 #if NACL_WINDOWS && !defined(NACL_STANDALONE) |
| 65 NaClSetBrokerDuplicateHandleFunc(private_interface_->BrokerDuplicateHandle); | 64 NaClSetBrokerDuplicateHandleFunc(private_interface_->BrokerDuplicateHandle); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 90 | 89 |
| 91 | 90 |
| 92 namespace pp { | 91 namespace pp { |
| 93 | 92 |
| 94 Module* CreateModule() { | 93 Module* CreateModule() { |
| 95 MODULE_PRINTF(("CreateModule ()\n")); | 94 MODULE_PRINTF(("CreateModule ()\n")); |
| 96 return new plugin::ModulePpapi(); | 95 return new plugin::ModulePpapi(); |
| 97 } | 96 } |
| 98 | 97 |
| 99 } // namespace pp | 98 } // namespace pp |
| OLD | NEW |