diff options
author | dschuff@chromium.org <dschuff@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-26 01:01:50 +0000 |
---|---|---|
committer | dschuff@chromium.org <dschuff@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-26 01:01:50 +0000 |
commit | a9fff89ed1eb5dbb3da0e559e115dec23cec6d91 (patch) | |
tree | 62917d9101c4b3fde98645fe0c11b6bed9f433ba /ppapi/native_client | |
parent | af049ddb7826794bdaf5fbfd22f07fa7a743e2bc (diff) | |
download | chromium_src-a9fff89ed1eb5dbb3da0e559e115dec23cec6d91.zip chromium_src-a9fff89ed1eb5dbb3da0e559e115dec23cec6d91.tar.gz chromium_src-a9fff89ed1eb5dbb3da0e559e115dec23cec6d91.tar.bz2 |
Cache Nacl Plugin private interface instead of calling GetnaclInterface on every process launch
This fixes nacl subprocess creation off the main thread for LoadHelperNaClModule (used by pnacl coordinator).
GetNaclInterface calls GetBrowserInterface, which is required to be called from the main thread. So we call it
once and cache the result for calling off the main thread
(only for starting nacl helper processes).
R=dmichael@chromium.org,jvoung@chromium.org
BUG=(broken nacl/chrome integration bots)
TEST=nacl_integration
Review URL: https://chromiumcodereview.appspot.com/10665036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144083 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/native_client')
-rw-r--r-- | ppapi/native_client/src/trusted/plugin/plugin.cc | 10 | ||||
-rw-r--r-- | ppapi/native_client/src/trusted/plugin/plugin.h | 3 |
2 files changed, 9 insertions, 4 deletions
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc index 856b31d..8a88489 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.cc +++ b/ppapi/native_client/src/trusted/plugin/plugin.cc @@ -122,7 +122,7 @@ const int64_t kSizeKBMin = 1; const int64_t kSizeKBMax = 512*1024; // very large .nexe const uint32_t kSizeKBBuckets = 100; -const PPB_NaCl_Private* GetNaclInterface() { +const PPB_NaCl_Private* GetNaClInterface() { pp::Module *module = pp::Module::Get(); CHECK(module); return static_cast<const PPB_NaCl_Private*>( @@ -622,8 +622,7 @@ bool Plugin::LoadNaClModuleCommon(nacl::DescWrapper* wrapper, } // Try to start the Chrome IPC-based proxy. - const PPB_NaCl_Private* ppb_nacl = GetNaclInterface(); - if (ppb_nacl->StartPpapiProxy(pp_instance())) { + if (nacl_interface_->StartPpapiProxy(pp_instance())) { using_ipc_proxy_ = true; // We need to explicitly schedule this here. It is normally called in // response to starting the SRPC proxy. @@ -890,11 +889,14 @@ Plugin::Plugin(PP_Instance pp_instance) ready_time_(0), nexe_size_(0), time_of_last_progress_event_(0), - using_ipc_proxy_(false) { + using_ipc_proxy_(false), + nacl_interface_(NULL) { PLUGIN_PRINTF(("Plugin::Plugin (this=%p, pp_instance=%" NACL_PRId32")\n", static_cast<void*>(this), pp_instance)); callback_factory_.Initialize(this); nexe_downloader_.Initialize(this); + nacl_interface_ = GetNaClInterface(); + CHECK(nacl_interface_ != NULL); } diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h index 1a709d8..253cfd5 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.h +++ b/ppapi/native_client/src/trusted/plugin/plugin.h @@ -25,6 +25,7 @@ #include "native_client/src/trusted/plugin/service_runtime.h" #include "native_client/src/trusted/plugin/utility.h" +#include "ppapi/c/private/ppb_nacl_private.h" #include "ppapi/cpp/private/var_private.h" // for pp::VarPrivate #include "ppapi/cpp/private/instance_private.h" @@ -520,6 +521,8 @@ class Plugin : public pp::InstancePrivate { // Whether we are using IPC-based PPAPI proxy. bool using_ipc_proxy_; + + const PPB_NaCl_Private* nacl_interface_; }; } // namespace plugin |