summaryrefslogtreecommitdiffstats
path: root/chrome/service/service_process.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/service/service_process.cc')
-rw-r--r--chrome/service/service_process.cc20
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();
}