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