summaryrefslogtreecommitdiffstats
path: root/chrome/common/ipc_channel_proxy.cc
diff options
context:
space:
mode:
authorjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-22 22:43:41 +0000
committerjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-22 22:43:41 +0000
commite74488ce038ed78956cae3bd26daf61c722f9b39 (patch)
tree715dede1a6120e4b8e6ec845f8f336f0d4f792ae /chrome/common/ipc_channel_proxy.cc
parentbc2274f796a84892829b4dbdb7f57dde34ed6f21 (diff)
downloadchromium_src-e74488ce038ed78956cae3bd26daf61c722f9b39.zip
chromium_src-e74488ce038ed78956cae3bd26daf61c722f9b39.tar.gz
chromium_src-e74488ce038ed78956cae3bd26daf61c722f9b39.tar.bz2
Bring up IPC::ChannelProxy on POSIX.
Review URL: http://codereview.chromium.org/16426 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7385 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/ipc_channel_proxy.cc')
-rw-r--r--chrome/common/ipc_channel_proxy.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/chrome/common/ipc_channel_proxy.cc b/chrome/common/ipc_channel_proxy.cc
index 23d8ea9..11fdb9b 100644
--- a/chrome/common/ipc_channel_proxy.cc
+++ b/chrome/common/ipc_channel_proxy.cc
@@ -5,11 +5,19 @@
#include "base/message_loop.h"
#include "base/thread.h"
#include "chrome/common/ipc_channel_proxy.h"
+#if defined(OS_WIN)
+// TODO(playmobil): remove ifdef once ObjectWatcher is ported
#include "chrome/common/ipc_logging.h"
+#endif
#include "chrome/common/ipc_message_utils.h"
namespace IPC {
+#if defined(OS_POSIX)
+// TODO(playmobil): remove once ObjectWatcher is ported
+#undef IPC_MESSAGE_LOG_ENABLED
+#endif
+
//-----------------------------------------------------------------------------
ChannelProxy::Context::Context(Channel::Listener* listener,
@@ -216,6 +224,19 @@ void ChannelProxy::Init(const std::wstring& channel_id, Channel::Mode mode,
// to connect and get an error since the pipe doesn't exist yet.
context_->CreateChannel(channel_id, mode);
} else {
+#if defined(OS_POSIX)
+ // TODO(playmobil): On POSIX, IPC::Channel uses a socketpair(), one side of
+ // which needs to be mapped into the child process' address space.
+ // To know the value of the client side FD we need to have already
+ // created a socketpair which currently occurs in IPC::Channel's
+ // constructor.
+ // If we lazilly construct the IPC::Channel then the caller has no way
+ // of knowing the FD #.
+ //
+ // We can solve this either by having the Channel's creation launch the
+ // subprocess itself or by creating the socketpair() externally.
+ NOTIMPLEMENTED();
+#endif // defined(OS_POSIX)
context_->ipc_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
context_.get(), &Context::CreateChannel, channel_id, mode));
}
@@ -260,6 +281,24 @@ void ChannelProxy::RemoveFilter(MessageFilter* filter) {
context_.get(), &Context::OnRemoveFilter, filter));
}
+#if defined(OS_POSIX)
+// See the TODO regarding lazy initialization of the channel in
+// ChannelProxy::Init().
+// We assume that IPC::Channel::GetClientFileDescriptorMapping() is thread-safe.
+void ChannelProxy::GetClientFileDescriptorMapping(int *src_fd, int *dest_fd) {
+ Channel *channel = context_.get()->channel_;
+ DCHECK(channel); // Channel must have been created first.
+ channel->GetClientFileDescriptorMapping(src_fd, dest_fd);
+}
+
+// We assume that IP::Channel::OnClientConnected() is thread-safe.
+void ChannelProxy::OnClientConnected() {
+ Channel *channel = context_.get()->channel_;
+ DCHECK(channel); // Channel must have been created first.
+ channel->OnClientConnected();
+}
+#endif
+
//-----------------------------------------------------------------------------
} // namespace IPC