summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-21 00:41:22 +0000
committersehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-21 00:41:22 +0000
commitd4362e74b269497a790eb19da357ed76fb0a2357 (patch)
tree37e1431c660612dbd1274c5a14fffa2d09d9b8ec
parent111ddfd416270b46727961a82ba531c931f2c8f5 (diff)
downloadchromium_src-d4362e74b269497a790eb19da357ed76fb0a2357.zip
chromium_src-d4362e74b269497a790eb19da357ed76fb0a2357.tar.gz
chromium_src-d4362e74b269497a790eb19da357ed76fb0a2357.tar.bz2
Revert 118553 - 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 TBR=sehr@google.com Review URL: https://chromiumcodereview.appspot.com/9131027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118565 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/renderer/chrome_ppapi_interfaces.cc21
-rw-r--r--content/public/renderer/render_thread.h4
-rw-r--r--content/renderer/render_thread_impl.cc4
-rw-r--r--content/renderer/render_thread_impl.h1
-rw-r--r--content/test/mock_render_thread.cc4
-rw-r--r--content/test/mock_render_thread.h1
-rw-r--r--ppapi/c/private/ppb_nacl_private.h8
-rw-r--r--ppapi/native_client/src/trusted/plugin/module_ppapi.cc14
8 files changed, 10 insertions, 47 deletions
diff --git a/chrome/renderer/chrome_ppapi_interfaces.cc b/chrome/renderer/chrome_ppapi_interfaces.cc
index 2d5ab99..a01c1ee 100644
--- a/chrome/renderer/chrome_ppapi_interfaces.cc
+++ b/chrome/renderer/chrome_ppapi_interfaces.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -6,14 +6,12 @@
#include "base/command_line.h"
#include "base/logging.h"
-#include "base/lazy_instance.h"
#include "base/rand_util_c.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/render_messages.h"
#include "chrome/renderer/chrome_ppb_pdf_impl.h"
#include "content/public/common/content_switches.h"
#include "content/public/renderer/render_thread.h"
-#include "ipc/ipc_sync_message_filter.h"
#include "ppapi/c/private/ppb_nacl_private.h"
#include "ppapi/c/private/ppb_pdf.h"
#include "webkit/plugins/ppapi/ppapi_interface_factory.h"
@@ -27,11 +25,6 @@ using content::RenderThread;
namespace chrome {
-namespace {
-base::LazyInstance<scoped_refptr<IPC::SyncMessageFilter> >
- g_background_thread_sender = LAZY_INSTANCE_INITIALIZER;
-} // namespace
-
#if !defined(DISABLE_NACL)
// Launch NaCl's sel_ldr process.
bool LaunchSelLdr(const char* alleged_url, int socket_count,
@@ -39,11 +32,7 @@ bool LaunchSelLdr(const char* alleged_url, int socket_count,
int* nacl_process_id) {
std::vector<nacl::FileDescriptor> sockets;
base::ProcessHandle nacl_process;
- IPC::Message::Sender* sender = RenderThread::Get();
- if (sender == NULL) {
- sender = g_background_thread_sender.Pointer()->get();
- }
- if (!sender->Send(
+ if (!RenderThread::Get()->Send(
new ChromeViewHostMsg_LaunchNaCl(
ASCIIToWide(alleged_url),
socket_count,
@@ -73,16 +62,10 @@ bool Are3DInterfacesDisabled() {
return CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisable3DAPIs);
}
-void EnableBackgroundSelLdrLaunch() {
- g_background_thread_sender.Get() =
- RenderThread::Get()->GetSyncMessageFilter();
-}
-
const PPB_NaCl_Private ppb_nacl = {
&LaunchSelLdr,
&UrandomFD,
&Are3DInterfacesDisabled,
- &EnableBackgroundSelLdrLaunch,
};
class PPB_NaCl_Impl {
diff --git a/content/public/renderer/render_thread.h b/content/public/renderer/render_thread.h
index db26824..2140e70 100644
--- a/content/public/renderer/render_thread.h
+++ b/content/public/renderer/render_thread.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -18,7 +18,6 @@ class MessageLoop;
namespace IPC {
class SyncChannel;
-class SyncMessageFilter;
}
namespace v8 {
@@ -42,7 +41,6 @@ class CONTENT_EXPORT RenderThread : public IPC::Message::Sender {
virtual MessageLoop* GetMessageLoop() = 0;
virtual IPC::SyncChannel* GetChannel() = 0;
virtual std::string GetLocale() = 0;
- virtual IPC::SyncMessageFilter* GetSyncMessageFilter() = 0;
// Called to add or remove a listener for a particular message routing ID.
// These methods normally get delegated to a MessageRouter.
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index a041531..ff7df27 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -361,10 +361,6 @@ std::string RenderThreadImpl::GetLocale() {
return lang;
}
-IPC::SyncMessageFilter* RenderThreadImpl::GetSyncMessageFilter() {
- return sync_message_filter();
-}
-
void RenderThreadImpl::AddRoute(int32 routing_id,
IPC::Channel::Listener* listener) {
widget_count_++;
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index 1b2e58e..f3f82a1 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -85,7 +85,6 @@ class CONTENT_EXPORT RenderThreadImpl : public content::RenderThread,
virtual MessageLoop* GetMessageLoop() OVERRIDE;
virtual IPC::SyncChannel* GetChannel() OVERRIDE;
virtual std::string GetLocale() OVERRIDE;
- virtual IPC::SyncMessageFilter* GetSyncMessageFilter() OVERRIDE;
virtual void AddRoute(int32 routing_id,
IPC::Channel::Listener* listener) OVERRIDE;
virtual void RemoveRoute(int32 routing_id) OVERRIDE;
diff --git a/content/test/mock_render_thread.cc b/content/test/mock_render_thread.cc
index 1663531..0dc5ca0 100644
--- a/content/test/mock_render_thread.cc
+++ b/content/test/mock_render_thread.cc
@@ -67,10 +67,6 @@ std::string MockRenderThread::GetLocale() {
return std::string();
}
-IPC::SyncMessageFilter* MockRenderThread::GetSyncMessageFilter() {
- return NULL;
-}
-
void MockRenderThread::AddRoute(int32 routing_id,
IPC::Channel::Listener* listener) {
EXPECT_EQ(routing_id_, routing_id);
diff --git a/content/test/mock_render_thread.h b/content/test/mock_render_thread.h
index d89ea73..0c083a7 100644
--- a/content/test/mock_render_thread.h
+++ b/content/test/mock_render_thread.h
@@ -39,7 +39,6 @@ class MockRenderThread : public content::RenderThread {
virtual MessageLoop* GetMessageLoop() OVERRIDE;
virtual IPC::SyncChannel* GetChannel() OVERRIDE;
virtual std::string GetLocale() OVERRIDE;
- virtual IPC::SyncMessageFilter* GetSyncMessageFilter() OVERRIDE;
virtual void AddRoute(int32 routing_id,
IPC::Channel::Listener* listener) OVERRIDE;
virtual void RemoveRoute(int32 routing_id) OVERRIDE;
diff --git a/ppapi/c/private/ppb_nacl_private.h b/ppapi/c/private/ppb_nacl_private.h
index 3723f0e..b741ae2 100644
--- a/ppapi/c/private/ppb_nacl_private.h
+++ b/ppapi/c/private/ppb_nacl_private.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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,8 +16,7 @@ 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|. Unless EnableBackgroundSelLdrLaunch is called, this
- // method must be invoked from the main thread.
+ // |nacl_process_id|.
bool (*LaunchSelLdr)(const char* alleged_url, int socket_count,
void* imc_handles, void* nacl_process_handle,
int* nacl_process_id);
@@ -30,9 +29,6 @@ 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 a59dcad..894dc37 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) 2012 The Chromium Authors. All rights reserved.
+ * Copyright (c) 2011 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
- private_interface_ = reinterpret_cast<const PPB_NaCl_Private*>(
+ const PPB_NaCl_Private* ptr = reinterpret_cast<const PPB_NaCl_Private*>(
GetBrowserInterface(PPB_NACL_PRIVATE_INTERFACE));
- if (NULL == private_interface_) {
+ if (NULL == ptr) {
MODULE_PRINTF(("ModulePpapi::Init failed: "
"GetBrowserInterface returned NULL\n"));
return false;
}
launch_nacl_process = reinterpret_cast<LaunchNaClProcessFunc>(
- private_interface_->LaunchSelLdr);
- get_urandom_fd = private_interface_->UrandomFD;
+ ptr->LaunchSelLdr);
+ get_urandom_fd = ptr->UrandomFD;
// In the plugin, we don't need high resolution time of day.
NaClAllowLowResolutionTimeOfDay();
@@ -63,9 +63,6 @@ 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)));
@@ -74,7 +71,6 @@ class ModulePpapi : public pp::Module {
private:
bool init_was_successful_;
- const PPB_NaCl_Private* private_interface_;
};
} // namespace plugin