| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SERVICE_PROCESS_CONTROL_H_ | 5 #ifndef CHROME_BROWSER_SERVICE_SERVICE_PROCESS_CONTROL_H_ |
| 6 #define CHROME_BROWSER_SERVICE_SERVICE_PROCESS_CONTROL_H_ | 6 #define CHROME_BROWSER_SERVICE_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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 bool GetCloudPrintProxyInfo( | 94 bool GetCloudPrintProxyInfo( |
| 95 const CloudPrintProxyInfoHandler& cloud_print_status_callback); | 95 const CloudPrintProxyInfoHandler& cloud_print_status_callback); |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 // This class is responsible for launching the service process on the | 98 // This class is responsible for launching the service process on the |
| 99 // PROCESS_LAUNCHER thread. | 99 // PROCESS_LAUNCHER thread. |
| 100 class Launcher | 100 class Launcher |
| 101 : public base::RefCountedThreadSafe<ServiceProcessControl::Launcher> { | 101 : public base::RefCountedThreadSafe<ServiceProcessControl::Launcher> { |
| 102 public: | 102 public: |
| 103 Launcher(ServiceProcessControl* process, CommandLine* cmd_line); | 103 Launcher(ServiceProcessControl* process, CommandLine* cmd_line); |
| 104 // Execute the command line to start the process asynchronously. | 104 // Execute the command line to start the process asynchronously. After the |
| 105 // After the comamnd is executed |task| is called with the process handle on | 105 // command is executed |task| is called with the process handle on the UI |
| 106 // the UI thread. | 106 // thread. |
| 107 void Run(Task* task); | 107 void Run(const base::Closure& task); |
| 108 | 108 |
| 109 bool launched() const { return launched_; } | 109 bool launched() const { return launched_; } |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 friend class base::RefCountedThreadSafe<ServiceProcessControl::Launcher>; | 112 friend class base::RefCountedThreadSafe<ServiceProcessControl::Launcher>; |
| 113 virtual ~Launcher(); | 113 virtual ~Launcher(); |
| 114 | 114 |
| 115 #if !defined(OS_MACOSX) | 115 #if !defined(OS_MACOSX) |
| 116 void DoDetectLaunched(); | 116 void DoDetectLaunched(); |
| 117 #endif // !OS_MACOSX | 117 #endif // !OS_MACOSX |
| 118 | 118 |
| 119 void DoRun(); | 119 void DoRun(); |
| 120 void Notify(); | 120 void Notify(); |
| 121 ServiceProcessControl* process_; | 121 ServiceProcessControl* process_; |
| 122 scoped_ptr<CommandLine> cmd_line_; | 122 scoped_ptr<CommandLine> cmd_line_; |
| 123 scoped_ptr<Task> notify_task_; | 123 base::Closure notify_task_; |
| 124 bool launched_; | 124 bool launched_; |
| 125 uint32 retry_count_; | 125 uint32 retry_count_; |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 ServiceProcessControl(); | 128 ServiceProcessControl(); |
| 129 virtual ~ServiceProcessControl(); | 129 virtual ~ServiceProcessControl(); |
| 130 | 130 |
| 131 friend struct DefaultSingletonTraits<ServiceProcessControl>; | 131 friend struct DefaultSingletonTraits<ServiceProcessControl>; |
| 132 | 132 |
| 133 typedef std::vector<base::Closure> TaskList; | 133 typedef std::vector<base::Closure> TaskList; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 155 TaskList connect_failure_tasks_; | 155 TaskList connect_failure_tasks_; |
| 156 | 156 |
| 157 // Callback that gets invoked when a status message is received from | 157 // Callback that gets invoked when a status message is received from |
| 158 // the cloud print proxy. | 158 // the cloud print proxy. |
| 159 CloudPrintProxyInfoHandler cloud_print_info_callback_; | 159 CloudPrintProxyInfoHandler cloud_print_info_callback_; |
| 160 | 160 |
| 161 content::NotificationRegistrar registrar_; | 161 content::NotificationRegistrar registrar_; |
| 162 }; | 162 }; |
| 163 | 163 |
| 164 #endif // CHROME_BROWSER_SERVICE_SERVICE_PROCESS_CONTROL_H_ | 164 #endif // CHROME_BROWSER_SERVICE_SERVICE_PROCESS_CONTROL_H_ |
| OLD | NEW |