| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/service/service_process.h" | 5 #include "chrome/service/service_process.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 if (cloud_print_proxy_enabled) { | 134 if (cloud_print_proxy_enabled) { |
| 135 GetCloudPrintProxy()->EnableForUser(lsid); | 135 GetCloudPrintProxy()->EnableForUser(lsid); |
| 136 } | 136 } |
| 137 | 137 |
| 138 VLOG(1) << "Starting Service Process IPC Server"; | 138 VLOG(1) << "Starting Service Process IPC Server"; |
| 139 ipc_server_.reset(new ServiceIPCServer(GetServiceProcessChannelName())); | 139 ipc_server_.reset(new ServiceIPCServer(GetServiceProcessChannelName())); |
| 140 ipc_server_->Init(); | 140 ipc_server_->Init(); |
| 141 | 141 |
| 142 // After the IPC server has started we signal that the service process is | 142 // After the IPC server has started we signal that the service process is |
| 143 // ready. | 143 // ready. |
| 144 ServiceProcessState::GetInstance()->SignalReady( | 144 if (!ServiceProcessState::GetInstance()->SignalReady( |
| 145 NewRunnableMethod(this, &ServiceProcess::Shutdown)); | 145 io_thread_->message_loop(), |
| 146 NewRunnableMethod(this, &ServiceProcess::Shutdown))) { |
| 147 return false; |
| 148 } |
| 146 | 149 |
| 147 // See if we need to stay running. | 150 // See if we need to stay running. |
| 148 ScheduleShutdownCheck(); | 151 ScheduleShutdownCheck(); |
| 149 return true; | 152 return true; |
| 150 } | 153 } |
| 151 | 154 |
| 152 bool ServiceProcess::Teardown() { | 155 bool ServiceProcess::Teardown() { |
| 153 service_prefs_.reset(); | 156 service_prefs_.reset(); |
| 154 cloud_print_proxy_.reset(); | 157 cloud_print_proxy_.reset(); |
| 155 | 158 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 } | 263 } |
| 261 | 264 |
| 262 ServiceProcess::~ServiceProcess() { | 265 ServiceProcess::~ServiceProcess() { |
| 263 Teardown(); | 266 Teardown(); |
| 264 g_service_process = NULL; | 267 g_service_process = NULL; |
| 265 } | 268 } |
| 266 | 269 |
| 267 // Disable refcounting for runnable method because it is really not needed | 270 // Disable refcounting for runnable method because it is really not needed |
| 268 // when we post tasks on the main message loop. | 271 // when we post tasks on the main message loop. |
| 269 DISABLE_RUNNABLE_METHOD_REFCOUNT(ServiceProcess); | 272 DISABLE_RUNNABLE_METHOD_REFCOUNT(ServiceProcess); |
| OLD | NEW |