diff options
author | dmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-22 05:19:29 +0000 |
---|---|---|
committer | dmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-22 05:19:29 +0000 |
commit | 4130d9e2ee756e06aae9861eb4658b0578ee67bd (patch) | |
tree | 18d47b0dac25e8bf76783ce524d37b21dc9bcbe1 /chrome/service/service_process.cc | |
parent | 9b8dea2472f7df4036f07f370ab4321f24823c8c (diff) | |
download | chromium_src-4130d9e2ee756e06aae9861eb4658b0578ee67bd.zip chromium_src-4130d9e2ee756e06aae9861eb4658b0578ee67bd.tar.gz chromium_src-4130d9e2ee756e06aae9861eb4658b0578ee67bd.tar.bz2 |
Getting service process on Mac to handle having things moved/changed underneath it.
BUG=74983
TEST=See http://code.google.com/p/chromium/issues/detail?id=74983#c16
Review URL: http://codereview.chromium.org/6660001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78967 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service/service_process.cc')
-rw-r--r-- | chrome/service/service_process.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/chrome/service/service_process.cc b/chrome/service/service_process.cc index d559c46..ae98500 100644 --- a/chrome/service/service_process.cc +++ b/chrome/service/service_process.cc @@ -125,11 +125,13 @@ ServiceProcess::ServiceProcess() } bool ServiceProcess::Initialize(MessageLoopForUI* message_loop, - const CommandLine& command_line) { + const CommandLine& command_line, + ServiceProcessState* state) { #if defined(TOOLKIT_USES_GTK) gfx::GtkInitFromCommandLine(command_line); #endif main_message_loop_ = message_loop; + service_process_state_.reset(state); network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); base::Thread::Options options; options.message_loop_type = MessageLoop::TYPE_IO; @@ -199,8 +201,8 @@ bool ServiceProcess::Initialize(MessageLoopForUI* message_loop, } VLOG(1) << "Starting Service Process IPC Server"; - ServiceProcessState* state = ServiceProcessState::GetInstance(); - ipc_server_.reset(new ServiceIPCServer(state->GetServiceProcessChannel())); + ipc_server_.reset(new ServiceIPCServer( + service_process_state_->GetServiceProcessChannel())); ipc_server_->Init(); // After the IPC server has started we signal that the service process is @@ -229,7 +231,7 @@ bool ServiceProcess::Teardown() { // might use it have been shut down. network_change_notifier_.reset(); - ServiceProcessState::GetInstance()->SignalStopped(); + service_process_state_->SignalStopped(); return true; } @@ -311,7 +313,10 @@ void ServiceProcess::OnServiceEnabled() { if ((1 == enabled_services_) && !CommandLine::ForCurrentProcess()->HasSwitch( switches::kNoServiceAutorun)) { - ServiceProcessState::GetInstance()->AddToAutoRun(); + if (!service_process_state_->AddToAutoRun()) { + // TODO(scottbyer/sanjeevr/dmaclach): Handle error condition + LOG(ERROR) << "Unable to AddToAutoRun"; + } } } @@ -319,7 +324,10 @@ void ServiceProcess::OnServiceDisabled() { DCHECK_NE(enabled_services_, 0); enabled_services_--; if (0 == enabled_services_) { - ServiceProcessState::GetInstance()->RemoveFromAutoRun(); + if (!service_process_state_->RemoveFromAutoRun()) { + // TODO(scottbyer/sanjeevr/dmaclach): Handle error condition + LOG(ERROR) << "Unable to RemoveFromAutoRun"; + } // We will wait for some time to respond to IPCs before shutting down. ScheduleShutdownCheck(); } |