summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/c/private/ppb_nacl_private.h8
-rw-r--r--ppapi/native_client/src/trusted/plugin/module_ppapi.cc14
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