| 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" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // a true return value only means that some process shared data was available, | 67 // a true return value only means that some process shared data was available, |
| 68 // and not that the process is ready to receive IPC commands, or even running. | 68 // and not that the process is ready to receive IPC commands, or even running. |
| 69 // This method is only exposed for testing. | 69 // This method is only exposed for testing. |
| 70 bool GetServiceProcessData(std::string* version, base::ProcessId* pid); | 70 bool GetServiceProcessData(std::string* version, base::ProcessId* pid); |
| 71 // -------------------------------------------------------------------------- | 71 // -------------------------------------------------------------------------- |
| 72 | 72 |
| 73 // Forces a service process matching the specified version to shut down. | 73 // Forces a service process matching the specified version to shut down. |
| 74 bool ForceServiceProcessShutdown(const std::string& version, | 74 bool ForceServiceProcessShutdown(const std::string& version, |
| 75 base::ProcessId process_id); | 75 base::ProcessId process_id); |
| 76 | 76 |
| 77 // Creates command-line to run the service process. |
| 78 scoped_ptr<base::CommandLine> CreateServiceProcessCommandLine(); |
| 79 |
| 77 // This is a class that is used by the service process to signal events and | 80 // This is a class that is used by the service process to signal events and |
| 78 // share data with external clients. This class lives in this file because the | 81 // share data with external clients. This class lives in this file because the |
| 79 // internal data structures and mechanisms used by the utility methods above | 82 // internal data structures and mechanisms used by the utility methods above |
| 80 // and this class are shared. | 83 // and this class are shared. |
| 81 class ServiceProcessState { | 84 class ServiceProcessState { |
| 82 public: | 85 public: |
| 83 ServiceProcessState(); | 86 ServiceProcessState(); |
| 84 ~ServiceProcessState(); | 87 ~ServiceProcessState(); |
| 85 | 88 |
| 86 // Tries to become the sole service process for the current user data dir. | 89 // Tries to become the sole service process for the current user data dir. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // means that a service process instance is already running. | 125 // means that a service process instance is already running. |
| 123 bool TakeSingletonLock(); | 126 bool TakeSingletonLock(); |
| 124 #endif // !OS_MACOSX | 127 #endif // !OS_MACOSX |
| 125 | 128 |
| 126 // Creates the platform specific state. | 129 // Creates the platform specific state. |
| 127 void CreateState(); | 130 void CreateState(); |
| 128 | 131 |
| 129 // Tear down the platform specific state. | 132 // Tear down the platform specific state. |
| 130 void TearDownState(); | 133 void TearDownState(); |
| 131 | 134 |
| 132 // Initializes the command-line that can be used to autorun the service | |
| 133 // process. | |
| 134 void CreateAutoRunCommandLine(); | |
| 135 | |
| 136 // An opaque object that maintains state. The actual definition of this is | 135 // An opaque object that maintains state. The actual definition of this is |
| 137 // platform dependent. | 136 // platform dependent. |
| 138 struct StateData; | 137 struct StateData; |
| 139 StateData* state_; | 138 StateData* state_; |
| 140 scoped_ptr<base::SharedMemory> shared_mem_service_data_; | 139 scoped_ptr<base::SharedMemory> shared_mem_service_data_; |
| 141 scoped_ptr<base::CommandLine> autorun_command_line_; | 140 scoped_ptr<base::CommandLine> autorun_command_line_; |
| 142 }; | 141 }; |
| 143 | 142 |
| 144 #endif // CHROME_COMMON_SERVICE_PROCESS_UTIL_H_ | 143 #endif // CHROME_COMMON_SERVICE_PROCESS_UTIL_H_ |
| OLD | NEW |