diff options
author | loislo@chromium.org <loislo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-21 06:07:53 +0000 |
---|---|---|
committer | loislo@chromium.org <loislo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-21 06:07:53 +0000 |
commit | 48977dbb85422ade0a5a488f3b9656d3c5d0bc80 (patch) | |
tree | 1eff283a23ca552e097ce6a4b7c96ace7e0011d4 /components | |
parent | 3d41a2a63bbd307fcee6e6c5547ce5fe29e2f4a5 (diff) | |
download | chromium_src-48977dbb85422ade0a5a488f3b9656d3c5d0bc80.zip chromium_src-48977dbb85422ade0a5a488f3b9656d3c5d0bc80.tar.gz chromium_src-48977dbb85422ade0a5a488f3b9656d3c5d0bc80.tar.bz2 |
Revert "Connect PPAPI IPC channels for non-SFI mode."
This reverts commit 3d41a2a63bbd307fcee6e6c5547ce5fe29e2f4a5.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252506 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
-rw-r--r-- | components/nacl.gyp | 5 | ||||
-rw-r--r-- | components/nacl/loader/DEPS | 3 | ||||
-rw-r--r-- | components/nacl/loader/nacl_listener.cc | 52 | ||||
-rw-r--r-- | components/nacl/loader/nonsfi/DEPS | 3 | ||||
-rw-r--r-- | components/nacl/loader/nonsfi/irt_interfaces.cc | 1 | ||||
-rw-r--r-- | components/nacl/loader/nonsfi/irt_interfaces.h | 1 | ||||
-rw-r--r-- | components/nacl/loader/nonsfi/irt_ppapi.cc | 44 | ||||
-rw-r--r-- | components/nacl/loader/nonsfi/nonsfi_main.cc | 61 |
8 files changed, 23 insertions, 147 deletions
diff --git a/components/nacl.gyp b/components/nacl.gyp index 3f67983..8f0ff77f 100644 --- a/components/nacl.gyp +++ b/components/nacl.gyp @@ -181,11 +181,9 @@ 'dependencies': [ 'nacl', 'nacl_common', - '../components/tracing.gyp:tracing', '../crypto/crypto.gyp:crypto', '../sandbox/sandbox.gyp:libc_urandom_override', '../sandbox/sandbox.gyp:sandbox', - '../ppapi/ppapi_internal.gyp:ppapi_proxy', ], 'defines': [ '<@(nacl_defines)', @@ -208,7 +206,6 @@ 'nacl/loader/nonsfi/irt_interfaces.cc', 'nacl/loader/nonsfi/irt_interfaces.h', 'nacl/loader/nonsfi/irt_memory.cc', - 'nacl/loader/nonsfi/irt_ppapi.cc', 'nacl/loader/nonsfi/irt_thread.cc', 'nacl/loader/nonsfi/irt_util.h', 'nacl/loader/nonsfi/nonsfi_main.cc', @@ -219,8 +216,6 @@ '../content/common/sandbox_linux/sandbox_init_linux.cc', '../content/common/sandbox_linux/sandbox_seccomp_bpf_linux.cc', '../content/public/common/content_switches.cc', - '../ppapi/proxy/plugin_main_irt.cc', - '../ppapi/proxy/plugin_main_irt.h', ], 'conditions': [ ['toolkit_uses_gtk == 1', { diff --git a/components/nacl/loader/DEPS b/components/nacl/loader/DEPS index 6167777..8345fef 100644 --- a/components/nacl/loader/DEPS +++ b/components/nacl/loader/DEPS @@ -22,9 +22,6 @@ include_rules = [ "+ppapi/proxy/nacl_message_scanner.h", "+ppapi/proxy/serialized_handle.h", - # For setting FDs in non-SFI mode. - "+ppapi/proxy/plugin_main_irt.h", - # For sending PpapiHostMsg_ChannelCreated in nacl_ipc_adapter.cc: "+ppapi/proxy/ppapi_messages.h" ] diff --git a/components/nacl/loader/nacl_listener.cc b/components/nacl/loader/nacl_listener.cc index 4bafc8c..c35d946 100644 --- a/components/nacl/loader/nacl_listener.cc +++ b/components/nacl/loader/nacl_listener.cc @@ -35,7 +35,6 @@ #if defined(OS_LINUX) #include "components/nacl/loader/nonsfi/nonsfi_main.h" #include "content/public/common/child_process_sandbox_support_linux.h" -#include "ppapi/proxy/plugin_main_irt.h" #endif #if defined(OS_WIN) @@ -280,54 +279,19 @@ void NaClListener::OnStart(const nacl::NaClStartParams& params) { } if (params.enable_ipc_proxy) { + // Create the PPAPI IPC channels between the NaCl IRT and the hosts + // (browser/renderer) processes. The IRT uses these channels to communicate + // with the host and to initialize the IPC dispatchers. IPC::ChannelHandle browser_handle = IPC::Channel::GenerateVerifiedChannelID("nacl"); + SetUpIPCAdapter(&browser_handle, io_thread_.message_loop_proxy(), + nap, NACL_CHROME_DESC_BASE); + IPC::ChannelHandle renderer_handle = IPC::Channel::GenerateVerifiedChannelID("nacl"); + SetUpIPCAdapter(&renderer_handle, io_thread_.message_loop_proxy(), + nap, NACL_CHROME_DESC_BASE + 1); -#if defined(OS_LINUX) - if (params.enable_nonsfi_mode) { - // In non-SFI mode, we neither intercept nor rewrite the message using - // NaClIPCAdapter, and the channels are connected between the plugin and - // the hosts directly. So, the IPC::Channel instances will be created in - // the plugin side, because the IPC::Listener needs to live on the - // plugin's main thread. However, on initialization (i.e. before loading - // the plugin binary), the FD needs to be passed to the hosts. So, here - // we create raw FD pairs, and pass the client side FDs to the hosts, - // and the server side FDs to the plugin. - int browser_server_ppapi_fd; - int browser_client_ppapi_fd; - int renderer_server_ppapi_fd; - int renderer_client_ppapi_fd; - if (!IPC::SocketPair( - &browser_server_ppapi_fd, &browser_client_ppapi_fd) || - !IPC::SocketPair( - &renderer_server_ppapi_fd, &renderer_client_ppapi_fd)) { - LOG(ERROR) << "Failed to create sockets for IPC."; - return; - } - - // Set the plugin IPC channel FDs. - SetIPCFileDescriptors( - browser_server_ppapi_fd, renderer_server_ppapi_fd); - - // Send back to the client side IPC channel FD to the host. - browser_handle.socket = - base::FileDescriptor(browser_client_ppapi_fd, true); - renderer_handle.socket = - base::FileDescriptor(renderer_client_ppapi_fd, true); - } else { -#endif - // Create the PPAPI IPC channels between the NaCl IRT and the host - // (browser/renderer) processes. The IRT uses these channels to - // communicate with the host and to initialize the IPC dispatchers. - SetUpIPCAdapter(&browser_handle, io_thread_.message_loop_proxy(), - nap, NACL_CHROME_DESC_BASE); - SetUpIPCAdapter(&renderer_handle, io_thread_.message_loop_proxy(), - nap, NACL_CHROME_DESC_BASE + 1); -#if defined(OS_LINUX) - } -#endif if (!Send(new NaClProcessHostMsg_PpapiChannelsCreated( browser_handle, renderer_handle))) LOG(ERROR) << "Failed to send IPC channel handle to NaClProcessHost."; diff --git a/components/nacl/loader/nonsfi/DEPS b/components/nacl/loader/nonsfi/DEPS deleted file mode 100644 index fa6de5d..0000000 --- a/components/nacl/loader/nonsfi/DEPS +++ /dev/null @@ -1,3 +0,0 @@ -include_rules = [ - "+ppapi/nacl_irt", -] diff --git a/components/nacl/loader/nonsfi/irt_interfaces.cc b/components/nacl/loader/nonsfi/irt_interfaces.cc index 4364bb8..c53c795 100644 --- a/components/nacl/loader/nonsfi/irt_interfaces.cc +++ b/components/nacl/loader/nonsfi/irt_interfaces.cc @@ -29,7 +29,6 @@ const NaClInterfaceTable kIrtInterfaces[] = { NACL_INTERFACE_TABLE(NACL_IRT_FUTEX_v0_1, kIrtFutex), NACL_INTERFACE_TABLE(NACL_IRT_TLS_v0_1, kIrtTls), NACL_INTERFACE_TABLE(NACL_IRT_CLOCK_v0_1, kIrtClock), - NACL_INTERFACE_TABLE(NACL_IRT_PPAPIHOOK_v0_1, kIrtPpapiHook), }; #undef NACL_INTERFACE_TABLE diff --git a/components/nacl/loader/nonsfi/irt_interfaces.h b/components/nacl/loader/nonsfi/irt_interfaces.h index a2bf468..78c5bf0 100644 --- a/components/nacl/loader/nonsfi/irt_interfaces.h +++ b/components/nacl/loader/nonsfi/irt_interfaces.h @@ -21,7 +21,6 @@ extern const struct nacl_irt_thread kIrtThread; extern const struct nacl_irt_futex kIrtFutex; extern const struct nacl_irt_tls kIrtTls; extern const struct nacl_irt_clock kIrtClock; -extern const struct nacl_irt_ppapihook kIrtPpapiHook; } // namespace nonsfi } // namespace nacl diff --git a/components/nacl/loader/nonsfi/irt_ppapi.cc b/components/nacl/loader/nonsfi/irt_ppapi.cc deleted file mode 100644 index ebe2893..0000000 --- a/components/nacl/loader/nonsfi/irt_ppapi.cc +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2014 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. - -#include "base/logging.h" -#include "components/nacl/loader/nonsfi/irt_interfaces.h" -#include "ppapi/c/ppp.h" -#include "ppapi/nacl_irt/irt_ppapi.h" -#include "ppapi/proxy/plugin_main_irt.h" - -namespace nacl { -namespace nonsfi { -namespace { - -struct PP_StartFunctions g_pp_functions; - -int IrtPpapiStart(const struct PP_StartFunctions* funcs) { - g_pp_functions = *funcs; - return PpapiPluginMain(); -} - -} // namespace - -const struct nacl_irt_ppapihook kIrtPpapiHook = { - IrtPpapiStart, - PpapiPluginRegisterThreadCreator, -}; - -} // namespace nonsfi -} // namespace nacl - -int32_t PPP_InitializeModule(PP_Module module_id, - PPB_GetInterface get_browser_interface) { - return nacl::nonsfi::g_pp_functions.PPP_InitializeModule( - module_id, get_browser_interface); -} - -void PPP_ShutdownModule(void) { - nacl::nonsfi::g_pp_functions.PPP_ShutdownModule(); -} - -const void *PPP_GetInterface(const char *interface_name) { - return nacl::nonsfi::g_pp_functions.PPP_GetInterface(interface_name); -} diff --git a/components/nacl/loader/nonsfi/nonsfi_main.cc b/components/nacl/loader/nonsfi/nonsfi_main.cc index 87fbc1b..d9847c52 100644 --- a/components/nacl/loader/nonsfi/nonsfi_main.cc +++ b/components/nacl/loader/nonsfi/nonsfi_main.cc @@ -4,10 +4,8 @@ #include "components/nacl/loader/nonsfi/nonsfi_main.h" -#include "base/debug/leak_annotations.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" -#include "base/threading/platform_thread.h" #include "components/nacl/loader/nonsfi/elf_loader.h" #include "components/nacl/loader/nonsfi/irt_interfaces.h" #include "native_client/src/include/elf_auxv.h" @@ -24,41 +22,6 @@ namespace nacl { namespace nonsfi { namespace { -typedef void (*EntryPointType)(uintptr_t*); - -class PluginMainDelegate : public base::PlatformThread::Delegate { - public: - explicit PluginMainDelegate(EntryPointType entry_point) - : entry_point_(entry_point) { - } - - virtual ~PluginMainDelegate() { - } - - virtual void ThreadMain() OVERRIDE { - base::PlatformThread::SetName("NaClMainThread"); - - uintptr_t info[] = { - 0, // Do not use fini. - 0, // envc. - 0, // argc. - 0, // Null terminate for argv. - 0, // Null terminate for envv. - AT_SYSINFO, - reinterpret_cast<uintptr_t>(&NaClIrtInterface), - AT_NULL, - 0, // Null terminate for auxv. - }; - entry_point_(info); - } - - private: - EntryPointType entry_point_; -}; - -// Default stack size of the plugin main thread. We heuristically chose 16M. -const size_t kStackSize = (16 << 20); - struct NaClDescUnrefer { void operator()(struct NaClDesc* desc) const { NaClDescUnref(desc); @@ -83,16 +46,22 @@ void LoadModuleRpc(struct NaClSrpcRpc* rpc, return; } - EntryPointType entry_point = - reinterpret_cast<EntryPointType>(image.entry_point()); - if (!base::PlatformThread::CreateNonJoinable( - kStackSize, new PluginMainDelegate(entry_point))) { - LOG(ERROR) << "LoadModuleRpc: Failed to create plugin main thread."; - return; - } - + uintptr_t entry_point = image.entry_point(); rpc->result = NACL_SRPC_RESULT_OK; - (*done_cls->Run)(done_cls); + + // Run for testing. TODO(hidehiko): Remove this. + uintptr_t info[] = { + 0, // Do not use fini. + 0, // envc. + 0, // argc. + 0, // Null terminate for argv. + 0, // Null terminate for envv. + AT_SYSINFO, + reinterpret_cast<uintptr_t>(&NaClIrtInterface), + AT_NULL, + 0, // Null terminate for auxv. + }; + reinterpret_cast<void (*)(uintptr_t*)>(entry_point)(info); } const static struct NaClSrpcHandlerDesc kNonSfiServiceHandlers[] = { |