Skip to content

Commit

Permalink
Revert "Connect PPAPI IPC channels for non-SFI mode."
Browse files Browse the repository at this point in the history
This reverts commit 3d41a2a.

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252506 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
loislo@chromium.org committed Feb 21, 2014
1 parent 3d41a2a commit 48977db
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 233 deletions.
5 changes: 0 additions & 5 deletions components/nacl.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -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)',
Expand All @@ -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',
Expand All @@ -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', {
Expand Down
3 changes: 0 additions & 3 deletions components/nacl/loader/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
52 changes: 8 additions & 44 deletions components/nacl/loader/nacl_listener.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.";
Expand Down
3 changes: 0 additions & 3 deletions components/nacl/loader/nonsfi/DEPS

This file was deleted.

1 change: 0 additions & 1 deletion components/nacl/loader/nonsfi/irt_interfaces.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion components/nacl/loader/nonsfi/irt_interfaces.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
44 changes: 0 additions & 44 deletions components/nacl/loader/nonsfi/irt_ppapi.cc

This file was deleted.

61 changes: 15 additions & 46 deletions components/nacl/loader/nonsfi/nonsfi_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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);
Expand All @@ -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[] = {
Expand Down
6 changes: 0 additions & 6 deletions ipc/ipc_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,6 @@ class IPC_EXPORT Channel : public Sender {
ChannelImpl *channel_impl_;
};

#if defined(OS_POSIX)
// SocketPair() creates a pair of socket FDs suitable for using with
// IPC::Channel.
IPC_EXPORT bool SocketPair(int* fd1, int* fd2);
#endif

} // namespace IPC

#endif // IPC_IPC_CHANNEL_H_
3 changes: 3 additions & 0 deletions ppapi/native_client/src/shared/ppapi_proxy/ppruntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ EXTERN_C_BEGIN
// The entry point for the main thread of the PPAPI plugin process.
int PpapiPluginMain(void);

void PpapiPluginRegisterThreadCreator(
const struct PP_ThreadFunctions* new_funcs);

EXTERN_C_END

#endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PPRUNTIME_H_
3 changes: 1 addition & 2 deletions ppapi/ppapi_proxy.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
'proxy/plugin_dispatcher.h',
'proxy/plugin_globals.cc',
'proxy/plugin_globals.h',
'proxy/plugin_main_nacl.cc',
'proxy/plugin_message_filter.cc',
'proxy/plugin_message_filter.h',
'proxy/plugin_resource.cc',
Expand Down Expand Up @@ -243,8 +244,6 @@
['>(nacl_untrusted_build)==1', {
'sources': [
'proxy/irt_ppapi.c',
'proxy/plugin_main_irt.cc',
'proxy/plugin_main_irt.h',
],
'sources!': [
'proxy/audio_input_resource.cc',
Expand Down
2 changes: 1 addition & 1 deletion ppapi/proxy/irt_ppapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "native_client/src/untrusted/irt/irt.h"
#include "native_client/src/untrusted/irt/irt_private.h"
#include "ppapi/nacl_irt/irt_ppapi.h"
#include "ppapi/proxy/plugin_main_irt.h"
#include "ppapi/native_client/src/shared/ppapi_proxy/ppruntime.h"

struct PP_StartFunctions g_pp_functions;

Expand Down
31 changes: 0 additions & 31 deletions ppapi/proxy/plugin_main_irt.h

This file was deleted.

Loading

0 comments on commit 48977db

Please sign in to comment.