| 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 <stdint.h> |
| 9 |
| 8 #include <queue> | 10 #include <queue> |
| 9 #include <set> | 11 #include <set> |
| 10 #include <string> | 12 #include <string> |
| 11 #include <vector> | 13 #include <vector> |
| 12 | 14 |
| 13 #include "base/basictypes.h" | |
| 14 #include "base/callback.h" | 15 #include "base/callback.h" |
| 15 #include "base/cancelable_callback.h" | 16 #include "base/cancelable_callback.h" |
| 16 #include "base/id_map.h" | 17 #include "base/id_map.h" |
| 17 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/singleton.h" | 19 #include "base/memory/singleton.h" |
| 19 #include "base/process/process.h" | 20 #include "base/process/process.h" |
| 21 #include "build/build_config.h" |
| 20 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
| 21 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
| 22 #include "ipc/ipc_channel_proxy.h" | 24 #include "ipc/ipc_channel_proxy.h" |
| 23 #include "ipc/ipc_listener.h" | 25 #include "ipc/ipc_listener.h" |
| 24 #include "ipc/ipc_sender.h" | 26 #include "ipc/ipc_sender.h" |
| 25 | 27 |
| 26 namespace base { | 28 namespace base { |
| 27 class CommandLine; | 29 class CommandLine; |
| 28 } | 30 } |
| 29 | 31 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // Virtual for testing. | 94 // Virtual for testing. |
| 93 virtual void Launch(const base::Closure& success_task, | 95 virtual void Launch(const base::Closure& success_task, |
| 94 const base::Closure& failure_task); | 96 const base::Closure& failure_task); |
| 95 | 97 |
| 96 // Disconnect the IPC channel from the service process. | 98 // Disconnect the IPC channel from the service process. |
| 97 // Virtual for testing. | 99 // Virtual for testing. |
| 98 virtual void Disconnect(); | 100 virtual void Disconnect(); |
| 99 | 101 |
| 100 // IPC::Listener implementation. | 102 // IPC::Listener implementation. |
| 101 bool OnMessageReceived(const IPC::Message& message) override; | 103 bool OnMessageReceived(const IPC::Message& message) override; |
| 102 void OnChannelConnected(int32 peer_pid) override; | 104 void OnChannelConnected(int32_t peer_pid) override; |
| 103 void OnChannelError() override; | 105 void OnChannelError() override; |
| 104 | 106 |
| 105 // IPC::Sender implementation | 107 // IPC::Sender implementation |
| 106 bool Send(IPC::Message* message) override; | 108 bool Send(IPC::Message* message) override; |
| 107 | 109 |
| 108 // content::NotificationObserver implementation. | 110 // content::NotificationObserver implementation. |
| 109 void Observe(int type, | 111 void Observe(int type, |
| 110 const content::NotificationSource& source, | 112 const content::NotificationSource& source, |
| 111 const content::NotificationDetails& details) override; | 113 const content::NotificationDetails& details) override; |
| 112 | 114 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 161 |
| 160 #if !defined(OS_MACOSX) | 162 #if !defined(OS_MACOSX) |
| 161 void DoDetectLaunched(); | 163 void DoDetectLaunched(); |
| 162 #endif // !OS_MACOSX | 164 #endif // !OS_MACOSX |
| 163 | 165 |
| 164 void DoRun(); | 166 void DoRun(); |
| 165 void Notify(); | 167 void Notify(); |
| 166 scoped_ptr<base::CommandLine> cmd_line_; | 168 scoped_ptr<base::CommandLine> cmd_line_; |
| 167 base::Closure notify_task_; | 169 base::Closure notify_task_; |
| 168 bool launched_; | 170 bool launched_; |
| 169 uint32 retry_count_; | 171 uint32_t retry_count_; |
| 170 base::Process process_; | 172 base::Process process_; |
| 171 }; | 173 }; |
| 172 | 174 |
| 173 friend class MockServiceProcessControl; | 175 friend class MockServiceProcessControl; |
| 174 friend class CloudPrintProxyPolicyStartupTest; | 176 friend class CloudPrintProxyPolicyStartupTest; |
| 175 | 177 |
| 176 ServiceProcessControl(); | 178 ServiceProcessControl(); |
| 177 ~ServiceProcessControl() override; | 179 ~ServiceProcessControl() override; |
| 178 | 180 |
| 179 friend struct base::DefaultSingletonTraits<ServiceProcessControl>; | 181 friend struct base::DefaultSingletonTraits<ServiceProcessControl>; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // the service process. | 228 // the service process. |
| 227 base::Closure histograms_callback_; | 229 base::Closure histograms_callback_; |
| 228 | 230 |
| 229 content::NotificationRegistrar registrar_; | 231 content::NotificationRegistrar registrar_; |
| 230 | 232 |
| 231 // Callback that gets invoked if service didn't reply in time. | 233 // Callback that gets invoked if service didn't reply in time. |
| 232 base::CancelableClosure histograms_timeout_callback_; | 234 base::CancelableClosure histograms_timeout_callback_; |
| 233 }; | 235 }; |
| 234 | 236 |
| 235 #endif // CHROME_BROWSER_SERVICE_PROCESS_SERVICE_PROCESS_CONTROL_H_ | 237 #endif // CHROME_BROWSER_SERVICE_PROCESS_SERVICE_PROCESS_CONTROL_H_ |
| OLD | NEW |