diff options
author | sehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-20 23:58:19 +0000 |
---|---|---|
committer | sehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-20 23:58:19 +0000 |
commit | 7447a989fc54631a6bbc5616844eddd1d482f01f (patch) | |
tree | 4adbaf56c46a55ccac4a73a8189b984399f719f6 /ppapi | |
parent | 62df7bb0355940a004564f455f6df63384017826 (diff) | |
download | chromium_src-7447a989fc54631a6bbc5616844eddd1d482f01f.zip chromium_src-7447a989fc54631a6bbc5616844eddd1d482f01f.tar.gz chromium_src-7447a989fc54631a6bbc5616844eddd1d482f01f.tar.bz2 |
Add nacl private interface and state for process creation.
After invoking an interface method this will allow creation from other than
RenderThread.
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/9265027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118553 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/c/private/ppb_nacl_private.h | 8 | ||||
-rw-r--r-- | ppapi/native_client/src/trusted/plugin/module_ppapi.cc | 14 |
2 files changed, 15 insertions, 7 deletions
diff --git a/ppapi/c/private/ppb_nacl_private.h b/ppapi/c/private/ppb_nacl_private.h index b741ae2..3723f0e 100644 --- a/ppapi/c/private/ppb_nacl_private.h +++ b/ppapi/c/private/ppb_nacl_private.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,7 +16,8 @@ struct PPB_NaCl_Private { // write |socket_count| nacl::Handles to imc_handles and will write the // nacl::Handle of the created process to |nacl_process_handle|. Finally, // the function will write the process ID of the created process to - // |nacl_process_id|. + // |nacl_process_id|. Unless EnableBackgroundSelLdrLaunch is called, this + // method must be invoked from the main thread. bool (*LaunchSelLdr)(const char* alleged_url, int socket_count, void* imc_handles, void* nacl_process_handle, int* nacl_process_id); @@ -29,6 +30,9 @@ struct PPB_NaCl_Private { // proxy. This is so paranoid admins can effectively prevent untrusted shader // code to be processed by the graphics stack. bool (*Are3DInterfacesDisabled)(); + + // Enables the creation of sel_ldr processes from other than the main thread. + void (*EnableBackgroundSelLdrLaunch)(); }; #endif // PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_ diff --git a/ppapi/native_client/src/trusted/plugin/module_ppapi.cc b/ppapi/native_client/src/trusted/plugin/module_ppapi.cc index 894dc37..a59dcad 100644 --- a/ppapi/native_client/src/trusted/plugin/module_ppapi.cc +++ b/ppapi/native_client/src/trusted/plugin/module_ppapi.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Copyright (c) 2012 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ @@ -35,18 +35,18 @@ class ModulePpapi : public pp::Module { virtual bool Init() { // Ask the browser for an interface which provides missing functions - const PPB_NaCl_Private* ptr = reinterpret_cast<const PPB_NaCl_Private*>( + private_interface_ = reinterpret_cast<const PPB_NaCl_Private*>( GetBrowserInterface(PPB_NACL_PRIVATE_INTERFACE)); - if (NULL == ptr) { + if (NULL == private_interface_) { MODULE_PRINTF(("ModulePpapi::Init failed: " "GetBrowserInterface returned NULL\n")); return false; } launch_nacl_process = reinterpret_cast<LaunchNaClProcessFunc>( - ptr->LaunchSelLdr); - get_urandom_fd = ptr->UrandomFD; + private_interface_->LaunchSelLdr); + get_urandom_fd = private_interface_->UrandomFD; // In the plugin, we don't need high resolution time of day. NaClAllowLowResolutionTimeOfDay(); @@ -63,6 +63,9 @@ class ModulePpapi : public pp::Module { virtual pp::Instance* CreateInstance(PP_Instance pp_instance) { MODULE_PRINTF(("ModulePpapi::CreateInstance (pp_instance=%"NACL_PRId32")\n", pp_instance)); + // This must be called from here rather than Init, as it relies on + // chrome state that is not set at the time Init runs. + private_interface_->EnableBackgroundSelLdrLaunch(); Plugin* plugin = Plugin::New(pp_instance); MODULE_PRINTF(("ModulePpapi::CreateInstance (return %p)\n", static_cast<void* >(plugin))); @@ -71,6 +74,7 @@ class ModulePpapi : public pp::Module { private: bool init_was_successful_; + const PPB_NaCl_Private* private_interface_; }; } // namespace plugin |