summaryrefslogtreecommitdiffstats
path: root/chrome/nacl
diff options
context:
space:
mode:
authorbbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-30 14:31:38 +0000
committerbbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-30 14:31:38 +0000
commit852605a47dc698bf22e606d6e9a188908e7ec6e0 (patch)
tree725ab74881f642c8afe8e83f821908ce72bd89ff /chrome/nacl
parent10fa18cdbb4306ecea0df1469f89e73c52b4dc09 (diff)
downloadchromium_src-852605a47dc698bf22e606d6e9a188908e7ec6e0.zip
chromium_src-852605a47dc698bf22e606d6e9a188908e7ec6e0.tar.gz
chromium_src-852605a47dc698bf22e606d6e9a188908e7ec6e0.tar.bz2
Revert 154134 - Change NaCl IPC PPAPI proxy startup to support a NaCl-Browser process
channel. This fails to build on cros_daisy because of OVERRIDE. NaClProcessHost now creates an initial NaCl-Browser channel, then uses it to send a message to create the NaCl-Renderer channel. The main() for the IPC-IRT creates a PpapiDispatcher object to manage this channel and manage the PluginDispatchers for each renderer. BUG=116317 TEST=manual Review URL: https://chromiumcodereview.appspot.com/10883047 TBR=bbudge@chromium.org Review URL: https://chromiumcodereview.appspot.com/10913007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154141 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/nacl')
-rw-r--r--chrome/nacl/nacl_ipc_adapter.cc43
-rw-r--r--chrome/nacl/nacl_listener.cc26
2 files changed, 18 insertions, 51 deletions
diff --git a/chrome/nacl/nacl_ipc_adapter.cc b/chrome/nacl/nacl_ipc_adapter.cc
index 71b5cc56..4f4f328 100644
--- a/chrome/nacl/nacl_ipc_adapter.cc
+++ b/chrome/nacl/nacl_ipc_adapter.cc
@@ -89,9 +89,9 @@ void DeleteChannel(IPC::Channel* channel) {
delete channel;
}
-void WriteHandle(int handle_index,
- const ppapi::proxy::SerializedHandle& handle,
- IPC::Message* message) {
+void WriteFileDescriptor(int handle_index,
+ const ppapi::proxy::SerializedHandle& handle,
+ IPC::Message* message) {
ppapi::proxy::SerializedHandle::WriteHeader(handle.header(), message);
// Now write the handle itself in POSIX style.
@@ -108,7 +108,7 @@ void ConvertHandle(const ppapi::proxy::SerializedHandle& handle,
Handles* handles, IPC::Message* msg, int* handle_index) {
handles->push_back(handle);
if (msg)
- WriteHandle((*handle_index)++, handle, msg);
+ WriteFileDescriptor((*handle_index)++, handle, msg);
}
// This overload is to catch all types other than SerializedHandle. On Windows,
@@ -434,7 +434,6 @@ int NaClIPCAdapter::TakeClientFileDescriptor() {
return false; \
break; \
}
-
bool NaClIPCAdapter::OnMessageReceived(const IPC::Message& msg) {
{
base::AutoLock lock(lock_);
@@ -444,21 +443,12 @@ bool NaClIPCAdapter::OnMessageReceived(const IPC::Message& msg) {
// Pointer to the "new" message we will rewrite on Windows. On posix, this
// isn't necessary, so it will stay NULL.
IPC::Message* new_msg_ptr = NULL;
- IPC::Message new_msg(msg.routing_id(), msg.type(), msg.priority());
#if defined(OS_WIN)
+ IPC::Message new_msg(msg.routing_id(), msg.type(), msg.priority());
new_msg_ptr = &new_msg;
-#else
- // Even on POSIX, we have to rewrite messages to create channels, because
- // these contain a handle with an invalid (place holder) descriptor. The
- // message sending code sees this and doesn't pass the descriptor over
- // correctly.
- if (msg.type() == PpapiMsg_CreateNaClChannel::ID)
- new_msg_ptr = &new_msg;
#endif
-
Handles handles;
switch (msg.type()) {
- CASE_FOR_MESSAGE(PpapiMsg_CreateNaClChannel)
CASE_FOR_MESSAGE(PpapiMsg_PPBAudio_NotifyAudioStreamCreated)
CASE_FOR_MESSAGE(PpapiMsg_PPBAudioInput_OpenACK)
case IPC_REPLY_ID: {
@@ -512,33 +502,10 @@ bool NaClIPCAdapter::OnMessageReceived(const IPC::Message& msg) {
iter->descriptor().fd
#endif
));
- break;
- }
- case ppapi::proxy::SerializedHandle::CHANNEL_HANDLE: {
- // Check that this came from a PpapiMsg_CreateNaClChannel message.
- // This code here is only appropriate for that message.
- DCHECK(msg.type() == PpapiMsg_CreateNaClChannel::ID);
- IPC::ChannelHandle channel_handle =
- IPC::Channel::GenerateVerifiedChannelID("nacl");
- scoped_refptr<NaClIPCAdapter> ipc_adapter(
- new NaClIPCAdapter(channel_handle, task_runner_));
-#if defined(OS_POSIX)
- channel_handle.socket = base::FileDescriptor(
- ipc_adapter->TakeClientFileDescriptor(), true);
-#endif
- nacl_desc.reset(factory.MakeGeneric(ipc_adapter->MakeNaClDesc()));
- // Send back a message that the channel was created.
- scoped_ptr<IPC::Message> response(
- new PpapiHostMsg_ChannelCreated(channel_handle));
- task_runner_->PostTask(FROM_HERE,
- base::Bind(&NaClIPCAdapter::SendMessageOnIOThread, this,
- base::Passed(&response)));
- break;
}
case ppapi::proxy::SerializedHandle::INVALID: {
// Nothing to do. TODO(dmichael): Should we log this? Or is it
// sometimes okay to pass an INVALID handle?
- break;
}
// No default, so the compiler will warn us if new types get added.
}
diff --git a/chrome/nacl/nacl_listener.cc b/chrome/nacl/nacl_listener.cc
index 7d1fde6..34991ec 100644
--- a/chrome/nacl/nacl_listener.cc
+++ b/chrome/nacl/nacl_listener.cc
@@ -198,22 +198,22 @@ void NaClListener::OnMsgStart(const nacl::NaClStartParams& params) {
}
if (params.enable_ipc_proxy) {
- // Create the initial PPAPI IPC channel between the NaCl IRT and the
- // browser process. The IRT uses this channel to communicate with the
- // browser and to create additional IPC channels to renderer processes.
- IPC::ChannelHandle handle =
+ // Create the server side of the channel and notify the process host so it
+ // can reply to the renderer, which will connect as client.
+ IPC::ChannelHandle channel_handle =
IPC::Channel::GenerateVerifiedChannelID("nacl");
- scoped_refptr<NaClIPCAdapter> ipc_adapter(
- new NaClIPCAdapter(handle, io_thread_.message_loop_proxy()));
- // Pass a NaClDesc to the untrusted side. This will hold a ref to the
- // NaClIPCAdapter.
- args->initial_ipc_desc = ipc_adapter->MakeNaClDesc();
+
+ scoped_refptr<NaClIPCAdapter> ipc_adapter(new NaClIPCAdapter(
+ channel_handle, io_thread_.message_loop_proxy()));
+ args->initial_ipc_desc = ipc_adapter.get()->MakeNaClDesc();
+
#if defined(OS_POSIX)
- handle.socket = base::FileDescriptor(
- ipc_adapter->TakeClientFileDescriptor(), true);
+ channel_handle.socket = base::FileDescriptor(
+ ipc_adapter.get()->TakeClientFileDescriptor(), true);
#endif
- if (!Send(new NaClProcessHostMsg_PpapiChannelCreated(handle)))
- LOG(ERROR) << "Failed to send IPC channel handle to NaClProcessHost.";
+
+ if (!Send(new NaClProcessHostMsg_PpapiChannelCreated(channel_handle)))
+ LOG(ERROR) << "Failed to send IPC channel handle to renderer.";
}
std::vector<nacl::FileDescriptor> handles = params.handles;