summaryrefslogtreecommitdiffstats
path: root/chrome/service/service_ipc_server.cc
diff options
context:
space:
mode:
authorsanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-04 22:09:41 +0000
committersanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-04 22:09:41 +0000
commitff1d173e3ff3eddd867ed20bbef9fa2375d8580b (patch)
tree8077ecdd2e2b93cab1e93855fb539630a2d55720 /chrome/service/service_ipc_server.cc
parent0376e364459cc52fd417eeda5d071a012bb10ee7 (diff)
downloadchromium_src-ff1d173e3ff3eddd867ed20bbef9fa2375d8580b.zip
chromium_src-ff1d173e3ff3eddd867ed20bbef9fa2375d8580b.tar.gz
chromium_src-ff1d173e3ff3eddd867ed20bbef9fa2375d8580b.tar.bz2
The service process now enables a timebomb on startup to check if its services are needed. If not, it shuts down. Also the ShutdownIfNeeded method checks to see if clients are connected before shutting down. And we only try to recreate the channel if we were previously connected to a client.
BUG=None. TEST=Run the service process without any enabled services. It should die within a minute. Review URL: http://codereview.chromium.org/3562004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61421 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service/service_ipc_server.cc')
-rw-r--r--chrome/service/service_ipc_server.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/chrome/service/service_ipc_server.cc b/chrome/service/service_ipc_server.cc
index 958eade..f912701 100644
--- a/chrome/service/service_ipc_server.cc
+++ b/chrome/service/service_ipc_server.cc
@@ -10,7 +10,7 @@
#include "ipc/ipc_logging.h"
ServiceIPCServer::ServiceIPCServer(const std::string& channel_name)
- : channel_name_(channel_name) {
+ : channel_name_(channel_name), client_connected_(false) {
}
bool ServiceIPCServer::Init() {
@@ -50,11 +50,19 @@ ServiceIPCServer::~ServiceIPCServer() {
channel_->ClearIPCMessageLoop();
}
+void ServiceIPCServer::OnChannelConnected(int32 peer_pid) {
+ DCHECK(!client_connected_);
+ client_connected_ = true;
+}
+
void ServiceIPCServer::OnChannelError() {
// When a client (typically a browser process) disconnects, the pipe is
// closed and we get an OnChannelError. Since we want to keep servicing
// client requests, we will recreate the channel.
- CreateChannel();
+ bool client_was_connected = client_connected_;
+ client_connected_ = false;
+ if (client_was_connected)
+ CreateChannel();
}
bool ServiceIPCServer::Send(IPC::Message* msg) {