| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_SERVICE_PROCESS_SERVICE_PROCESS_CONTROL_H_ | 5 #ifndef CHROME_BROWSER_SERVICE_PROCESS_SERVICE_PROCESS_CONTROL_H_ |
| 6 #define CHROME_BROWSER_SERVICE_PROCESS_SERVICE_PROCESS_CONTROL_H_ | 6 #define CHROME_BROWSER_SERVICE_PROCESS_SERVICE_PROCESS_CONTROL_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 // reply from service. The method resets any previous callback. | 138 // reply from service. The method resets any previous callback. |
| 139 // This call starts service if needed. | 139 // This call starts service if needed. |
| 140 bool GetPrinters(const PrintersCallback& enumerate_printers_callback); | 140 bool GetPrinters(const PrintersCallback& enumerate_printers_callback); |
| 141 | 141 |
| 142 private: | 142 private: |
| 143 // This class is responsible for launching the service process on the | 143 // This class is responsible for launching the service process on the |
| 144 // PROCESS_LAUNCHER thread. | 144 // PROCESS_LAUNCHER thread. |
| 145 class Launcher | 145 class Launcher |
| 146 : public base::RefCountedThreadSafe<ServiceProcessControl::Launcher> { | 146 : public base::RefCountedThreadSafe<ServiceProcessControl::Launcher> { |
| 147 public: | 147 public: |
| 148 Launcher(ServiceProcessControl* process, | 148 explicit Launcher(scoped_ptr<base::CommandLine> cmd_line); |
| 149 scoped_ptr<base::CommandLine> cmd_line); | |
| 150 // Execute the command line to start the process asynchronously. After the | 149 // Execute the command line to start the process asynchronously. After the |
| 151 // command is executed |task| is called with the process handle on the UI | 150 // command is executed |task| is called with the process handle on the UI |
| 152 // thread. | 151 // thread. |
| 153 void Run(const base::Closure& task); | 152 void Run(const base::Closure& task); |
| 154 | 153 |
| 155 bool launched() const { return launched_; } | 154 bool launched() const { return launched_; } |
| 156 | 155 |
| 157 private: | 156 private: |
| 158 friend class base::RefCountedThreadSafe<ServiceProcessControl::Launcher>; | 157 friend class base::RefCountedThreadSafe<ServiceProcessControl::Launcher>; |
| 159 virtual ~Launcher(); | 158 virtual ~Launcher(); |
| 160 | 159 |
| 161 #if !defined(OS_MACOSX) | 160 #if !defined(OS_MACOSX) |
| 162 void DoDetectLaunched(); | 161 void DoDetectLaunched(); |
| 163 #endif // !OS_MACOSX | 162 #endif // !OS_MACOSX |
| 164 | 163 |
| 165 void DoRun(); | 164 void DoRun(); |
| 166 void Notify(); | 165 void Notify(); |
| 167 ServiceProcessControl* process_control_; | |
| 168 scoped_ptr<base::CommandLine> cmd_line_; | 166 scoped_ptr<base::CommandLine> cmd_line_; |
| 169 base::Closure notify_task_; | 167 base::Closure notify_task_; |
| 170 bool launched_; | 168 bool launched_; |
| 171 uint32 retry_count_; | 169 uint32 retry_count_; |
| 172 base::Process process_; | 170 base::Process process_; |
| 173 }; | 171 }; |
| 174 | 172 |
| 175 friend class MockServiceProcessControl; | 173 friend class MockServiceProcessControl; |
| 176 friend class CloudPrintProxyPolicyStartupTest; | 174 friend class CloudPrintProxyPolicyStartupTest; |
| 177 | 175 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 // the service process. | 226 // the service process. |
| 229 base::Closure histograms_callback_; | 227 base::Closure histograms_callback_; |
| 230 | 228 |
| 231 content::NotificationRegistrar registrar_; | 229 content::NotificationRegistrar registrar_; |
| 232 | 230 |
| 233 // Callback that gets invoked if service didn't reply in time. | 231 // Callback that gets invoked if service didn't reply in time. |
| 234 base::CancelableClosure histograms_timeout_callback_; | 232 base::CancelableClosure histograms_timeout_callback_; |
| 235 }; | 233 }; |
| 236 | 234 |
| 237 #endif // CHROME_BROWSER_SERVICE_PROCESS_SERVICE_PROCESS_CONTROL_H_ | 235 #endif // CHROME_BROWSER_SERVICE_PROCESS_SERVICE_PROCESS_CONTROL_H_ |
| OLD | NEW |