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_COMMON_SERVICE_PROCESS_UTIL_H_ | 5 #ifndef CHROME_COMMON_SERVICE_PROCESS_UTIL_H_ |
6 #define CHROME_COMMON_SERVICE_PROCESS_UTIL_H_ | 6 #define CHROME_COMMON_SERVICE_PROCESS_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/shared_memory.h" | 13 #include "base/memory/shared_memory.h" |
14 #include "base/process/process.h" | 14 #include "base/process/process.h" |
15 #include "ipc/ipc_channel_handle.h" | 15 #include "ipc/ipc_channel_handle.h" |
16 | 16 |
17 class MultiProcessLock; | 17 class MultiProcessLock; |
18 | 18 |
19 #if defined(OS_MACOSX) | 19 #if defined(OS_MACOSX) |
20 #ifdef __OBJC__ | 20 #ifdef __OBJC__ |
21 @class NSString; | 21 @class NSString; |
22 #else | 22 #else |
23 class NSString; | 23 class NSString; |
24 #endif | 24 #endif |
25 #endif | 25 #endif |
26 | 26 |
27 namespace base { | 27 namespace base { |
28 class CommandLine; | 28 class CommandLine; |
29 class MessageLoopProxy; | 29 class SingleThreadTaskRunner; |
30 } | 30 } |
31 | 31 |
32 // Return the IPC channel to connect to the service process. | 32 // Return the IPC channel to connect to the service process. |
33 IPC::ChannelHandle GetServiceProcessChannel(); | 33 IPC::ChannelHandle GetServiceProcessChannel(); |
34 | 34 |
35 // Return a name that is scoped to this instance of the service process. We | 35 // Return a name that is scoped to this instance of the service process. We |
36 // use the user-data-dir as a scoping prefix. | 36 // use the user-data-dir as a scoping prefix. |
37 std::string GetServiceProcessScopedName(const std::string& append_str); | 37 std::string GetServiceProcessScopedName(const std::string& append_str); |
38 | 38 |
39 #if !defined(OS_MACOSX) | 39 #if !defined(OS_MACOSX) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 ~ServiceProcessState(); | 81 ~ServiceProcessState(); |
82 | 82 |
83 // Tries to become the sole service process for the current user data dir. | 83 // Tries to become the sole service process for the current user data dir. |
84 // Returns false if another service process is already running. | 84 // Returns false if another service process is already running. |
85 bool Initialize(); | 85 bool Initialize(); |
86 | 86 |
87 // Signal that the service process is ready. | 87 // Signal that the service process is ready. |
88 // This method is called when the service process is running and initialized. | 88 // This method is called when the service process is running and initialized. |
89 // |terminate_task| is invoked when we get a terminate request from another | 89 // |terminate_task| is invoked when we get a terminate request from another |
90 // process (in the same thread that called SignalReady). It can be NULL. | 90 // process (in the same thread that called SignalReady). It can be NULL. |
91 // |message_loop_proxy| must be of type IO and is the loop that POSIX uses | 91 // |task_runner| must be of type IO and is the loop that POSIX uses |
92 // to monitor the service process. | 92 // to monitor the service process. |
93 bool SignalReady( | 93 bool SignalReady(base::SingleThreadTaskRunner* task_runner, |
94 base::MessageLoopProxy* message_loop_proxy, | 94 const base::Closure& terminate_task); |
95 const base::Closure& terminate_task); | |
96 | 95 |
97 // Signal that the service process is stopped. | 96 // Signal that the service process is stopped. |
98 void SignalStopped(); | 97 void SignalStopped(); |
99 | 98 |
100 // Register the service process to run on startup. | 99 // Register the service process to run on startup. |
101 bool AddToAutoRun(); | 100 bool AddToAutoRun(); |
102 | 101 |
103 // Unregister the service process to run on startup. | 102 // Unregister the service process to run on startup. |
104 bool RemoveFromAutoRun(); | 103 bool RemoveFromAutoRun(); |
105 | 104 |
(...skipping 22 matching lines...) Expand all Loading... |
128 | 127 |
129 // An opaque object that maintains state. The actual definition of this is | 128 // An opaque object that maintains state. The actual definition of this is |
130 // platform dependent. | 129 // platform dependent. |
131 struct StateData; | 130 struct StateData; |
132 StateData* state_; | 131 StateData* state_; |
133 scoped_ptr<base::SharedMemory> shared_mem_service_data_; | 132 scoped_ptr<base::SharedMemory> shared_mem_service_data_; |
134 scoped_ptr<base::CommandLine> autorun_command_line_; | 133 scoped_ptr<base::CommandLine> autorun_command_line_; |
135 }; | 134 }; |
136 | 135 |
137 #endif // CHROME_COMMON_SERVICE_PROCESS_UTIL_H_ | 136 #endif // CHROME_COMMON_SERVICE_PROCESS_UTIL_H_ |
OLD | NEW |