| 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_COMMON_SERVICE_PROCESS_UTIL_POSIX_H_ | 5 #ifndef CHROME_COMMON_SERVICE_PROCESS_UTIL_POSIX_H_ |
| 6 #define CHROME_COMMON_SERVICE_PROCESS_UTIL_POSIX_H_ | 6 #define CHROME_COMMON_SERVICE_PROCESS_UTIL_POSIX_H_ |
| 7 | 7 |
| 8 #include "service_process_util.h" | 8 #include "service_process_util.h" |
| 9 | 9 |
| 10 #include <signal.h> | 10 #include <signal.h> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "base/message_pump_libevent.h" | 15 #include "base/message_pump_libevent.h" |
| 16 | 16 |
| 17 #if defined(OS_LINUX) | 17 #if defined(OS_LINUX) |
| 18 #include "chrome/common/multi_process_lock.h" | 18 #include "chrome/common/multi_process_lock.h" |
| 19 MultiProcessLock* TakeServiceRunningLock(bool waiting); | 19 MultiProcessLock* TakeServiceRunningLock(bool waiting); |
| 20 #endif // OS_LINUX | 20 #endif // OS_LINUX |
| 21 | 21 |
| 22 #if defined(OS_MACOSX) | 22 #if defined(OS_MACOSX) |
| 23 #include "base/mac/scoped_cftyperef.h" | 23 #include "base/mac/scoped_cftyperef.h" |
| 24 #include "base/message_loop_proxy.h" | |
| 25 #include "content/common/file_path_watcher/file_path_watcher.h" | 24 #include "content/common/file_path_watcher/file_path_watcher.h" |
| 26 | 25 |
| 27 class CommandLine; | 26 class CommandLine; |
| 28 CFDictionaryRef CreateServiceProcessLaunchdPlist(CommandLine* cmd_line, | 27 CFDictionaryRef CreateServiceProcessLaunchdPlist(CommandLine* cmd_line, |
| 29 bool for_auto_launch); | 28 bool for_auto_launch); |
| 30 #endif // OS_MACOSX | 29 #endif // OS_MACOSX |
| 31 | 30 |
| 32 // Watches for |kShutDownMessage| to be written to the file descriptor it is | 31 // Watches for |kShutDownMessage| to be written to the file descriptor it is |
| 33 // watching. When it reads |kShutDownMessage|, it performs |shutdown_task_|. | 32 // watching. When it reads |kShutDownMessage|, it performs |shutdown_task_|. |
| 34 // Used here to monitor the socket listening to g_signal_socket. | 33 // Used here to monitor the socket listening to g_signal_socket. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 61 | 60 |
| 62 | 61 |
| 63 // TODO(jhawkins): Either make this a class or rename these public member | 62 // TODO(jhawkins): Either make this a class or rename these public member |
| 64 // variables to remove the trailing underscore. | 63 // variables to remove the trailing underscore. |
| 65 | 64 |
| 66 #if defined(OS_MACOSX) | 65 #if defined(OS_MACOSX) |
| 67 bool WatchExecutable(); | 66 bool WatchExecutable(); |
| 68 | 67 |
| 69 base::mac::ScopedCFTypeRef<CFDictionaryRef> launchd_conf_; | 68 base::mac::ScopedCFTypeRef<CFDictionaryRef> launchd_conf_; |
| 70 FilePathWatcher executable_watcher_; | 69 FilePathWatcher executable_watcher_; |
| 71 scoped_refptr<base::MessageLoopProxy> ui_message_loop_; | |
| 72 #endif // OS_MACOSX | 70 #endif // OS_MACOSX |
| 73 #if defined(OS_LINUX) | 71 #if defined(OS_LINUX) |
| 74 scoped_ptr<MultiProcessLock> initializing_lock_; | 72 scoped_ptr<MultiProcessLock> initializing_lock_; |
| 75 scoped_ptr<MultiProcessLock> running_lock_; | 73 scoped_ptr<MultiProcessLock> running_lock_; |
| 76 #endif // OS_LINUX | 74 #endif // OS_LINUX |
| 77 scoped_ptr<ServiceProcessShutdownMonitor> shut_down_monitor_; | 75 scoped_ptr<ServiceProcessShutdownMonitor> shut_down_monitor_; |
| 78 base::MessagePumpLibevent::FileDescriptorWatcher watcher_; | 76 base::MessagePumpLibevent::FileDescriptorWatcher watcher_; |
| 79 int sockets_[2]; | 77 int sockets_[2]; |
| 80 struct sigaction old_action_; | 78 struct sigaction old_action_; |
| 81 bool set_action_; | 79 bool set_action_; |
| 82 | 80 |
| 83 protected: | 81 protected: |
| 84 friend class base::RefCountedThreadSafe<ServiceProcessState::StateData>; | 82 friend class base::RefCountedThreadSafe<ServiceProcessState::StateData>; |
| 85 virtual ~StateData(); | 83 virtual ~StateData(); |
| 86 }; | 84 }; |
| 87 | 85 |
| 88 #endif // CHROME_COMMON_SERVICE_PROCESS_UTIL_POSIX_H_ | 86 #endif // CHROME_COMMON_SERVICE_PROCESS_UTIL_POSIX_H_ |
| OLD | NEW |