From 56f0f264ff866052ebcb24e75147cb600e6547a1 Mon Sep 17 00:00:00 2001 From: "dmaclach@chromium.org" Date: Thu, 24 Feb 2011 17:14:36 +0000 Subject: Get service process running standalone on the mac by hooking it into launchd. BUG=NONE TEST=BUILD Review URL: http://codereview.chromium.org/6482016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75893 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/service/service_ipc_server.cc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'chrome/service/service_ipc_server.cc') diff --git a/chrome/service/service_ipc_server.cc b/chrome/service/service_ipc_server.cc index 5e503c8..5257eec 100644 --- a/chrome/service/service_ipc_server.cc +++ b/chrome/service/service_ipc_server.cc @@ -9,8 +9,8 @@ #include "chrome/service/service_process.h" #include "ipc/ipc_logging.h" -ServiceIPCServer::ServiceIPCServer(const std::string& channel_name) - : channel_name_(channel_name), client_connected_(false) { +ServiceIPCServer::ServiceIPCServer(const IPC::ChannelHandle& channel_handle) + : channel_handle_(channel_handle), client_connected_(false) { } bool ServiceIPCServer::Init() { @@ -24,7 +24,7 @@ bool ServiceIPCServer::Init() { } void ServiceIPCServer::CreateChannel() { - channel_.reset(new IPC::SyncChannel(channel_name_, + channel_.reset(new IPC::SyncChannel(channel_handle_, IPC::Channel::MODE_NAMED_SERVER, this, g_service_process->io_thread()->message_loop(), true, g_service_process->shutdown_event())); @@ -63,8 +63,16 @@ void ServiceIPCServer::OnChannelError() { client_connected_ = false; // TODO(sanjeevr): Instead of invoking the service process for such handlers, // define a Client interface that the ServiceProcess can implement. - if (client_was_connected && g_service_process->HandleClientDisconnect()) { - CreateChannel(); + if (client_was_connected) { + if (g_service_process->HandleClientDisconnect()) { + CreateChannel(); + } + } else { + // If the client was never even connected we had an error connecting. + if (!client_connected_) { + LOG(ERROR) << "Unable to open service ipc channel " + << "named: " << channel_handle_.name; + } } } -- cgit v1.1