Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: chrome/common/service_process_util_posix.h

Issue 6660001: Getting service process on Mac to handle having things moved/changed underneath it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed up phajdan's comments, got things working properly Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/message_pump_libevent.h" 14 #include "base/message_pump_libevent.h"
15 #include "base/scoped_ptr.h" 15 #include "base/scoped_ptr.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/file_path_component_watcher.h"
23 #include "base/mac/scoped_cftyperef.h" 24 #include "base/mac/scoped_cftyperef.h"
25
24 class CommandLine; 26 class CommandLine;
25 CFDictionaryRef CreateServiceProcessLaunchdPlist(CommandLine* cmd_line, 27 CFDictionaryRef CreateServiceProcessLaunchdPlist(CommandLine* cmd_line,
26 bool for_auto_launch); 28 bool for_auto_launch);
27 #endif // OS_MACOSX 29 #endif // OS_MACOSX
28 30
29 // 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
30 // watching. When it reads |kShutDownMessage|, it performs |shutdown_task_|. 32 // watching. When it reads |kShutDownMessage|, it performs |shutdown_task_|.
31 // Used here to monitor the socket listening to g_signal_socket. 33 // Used here to monitor the socket listening to g_signal_socket.
32 class ServiceProcessShutdownMonitor 34 class ServiceProcessShutdownMonitor
33 : public base::MessagePumpLibevent::Watcher { 35 : public base::MessagePumpLibevent::Watcher {
(...skipping 17 matching lines...) Expand all
51 struct ServiceProcessState::StateData 53 struct ServiceProcessState::StateData
52 : public base::RefCountedThreadSafe<ServiceProcessState::StateData> { 54 : public base::RefCountedThreadSafe<ServiceProcessState::StateData> {
53 StateData(); 55 StateData();
54 56
55 // WatchFileDescriptor needs to be set up by the thread that is going 57 // WatchFileDescriptor needs to be set up by the thread that is going
56 // to be monitoring it. 58 // to be monitoring it.
57 void SignalReady(); 59 void SignalReady();
58 60
59 #if defined(OS_MACOSX) 61 #if defined(OS_MACOSX)
60 base::mac::ScopedCFTypeRef<CFDictionaryRef> launchd_conf_; 62 base::mac::ScopedCFTypeRef<CFDictionaryRef> launchd_conf_;
63 base::FilePathComponentWatcher executable_watcher_;
61 #endif // OS_MACOSX 64 #endif // OS_MACOSX
62 #if defined(OS_LINUX) 65 #if defined(OS_LINUX)
63 scoped_ptr<MultiProcessLock> initializing_lock_; 66 scoped_ptr<MultiProcessLock> initializing_lock_;
64 scoped_ptr<MultiProcessLock> running_lock_; 67 scoped_ptr<MultiProcessLock> running_lock_;
65 #endif // OS_LINUX 68 #endif // OS_LINUX
66 scoped_ptr<ServiceProcessShutdownMonitor> shut_down_monitor_; 69 scoped_ptr<ServiceProcessShutdownMonitor> shut_down_monitor_;
67 base::MessagePumpLibevent::FileDescriptorWatcher watcher_; 70 base::MessagePumpLibevent::FileDescriptorWatcher watcher_;
68 int sockets_[2]; 71 int sockets_[2];
69 struct sigaction old_action_; 72 struct sigaction old_action_;
70 bool set_action_; 73 bool set_action_;
71 74
72 protected: 75 protected:
73 friend class base::RefCountedThreadSafe<ServiceProcessState::StateData>; 76 friend class base::RefCountedThreadSafe<ServiceProcessState::StateData>;
74 virtual ~StateData(); 77 virtual ~StateData();
75 }; 78 };
76 79
77 #endif // CHROME_COMMON_SERVICE_PROCESS_UTIL_POSIX_H_ 80 #endif // CHROME_COMMON_SERVICE_PROCESS_UTIL_POSIX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698