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 #include "chrome/common/service_process_util_posix.h" | 5 #include "chrome/common/service_process_util_posix.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 #include <launch.h> | 8 #include <launch.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // We're killing a file. | 68 // We're killing a file. |
69 base::ThreadRestrictions::AssertIOAllowed(); | 69 base::ThreadRestrictions::AssertIOAllowed(); |
70 base::mac::ScopedCFTypeRef<CFStringRef> name(CopyServiceProcessLaunchDName()); | 70 base::mac::ScopedCFTypeRef<CFStringRef> name(CopyServiceProcessLaunchDName()); |
71 return Launchd::GetInstance()->DeletePlist(Launchd::User, | 71 return Launchd::GetInstance()->DeletePlist(Launchd::User, |
72 Launchd::Agent, | 72 Launchd::Agent, |
73 name); | 73 name); |
74 } | 74 } |
75 | 75 |
76 class ExecFilePathWatcherDelegate : public FilePathWatcher::Delegate { | 76 class ExecFilePathWatcherDelegate : public FilePathWatcher::Delegate { |
77 public: | 77 public: |
78 ExecFilePathWatcherDelegate() { } | 78 ExecFilePathWatcherDelegate() {} |
79 virtual ~ExecFilePathWatcherDelegate() { } | |
80 | 79 |
81 bool Init(const FilePath& path); | 80 bool Init(const FilePath& path); |
82 virtual void OnFilePathChanged(const FilePath& path) OVERRIDE; | 81 virtual void OnFilePathChanged(const FilePath& path) OVERRIDE; |
83 | 82 |
84 private: | 83 private: |
| 84 virtual ~ExecFilePathWatcherDelegate() {} |
| 85 |
85 FSRef executable_fsref_; | 86 FSRef executable_fsref_; |
86 }; | 87 }; |
87 | 88 |
88 } // namespace | 89 } // namespace |
89 | 90 |
90 NSString* GetServiceProcessLaunchDSocketEnvVar() { | 91 NSString* GetServiceProcessLaunchDSocketEnvVar() { |
91 NSString *label = GetServiceProcessLaunchDLabel(); | 92 NSString *label = GetServiceProcessLaunchDLabel(); |
92 NSString *env_var = [label stringByReplacingOccurrencesOfString:@"." | 93 NSString *env_var = [label stringByReplacingOccurrencesOfString:@"." |
93 withString:@"_"]; | 94 withString:@"_"]; |
94 env_var = [env_var stringByAppendingString:@"_SOCKET"]; | 95 env_var = [env_var stringByAppendingString:@"_SOCKET"]; |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 CFErrorRef err = NULL; | 437 CFErrorRef err = NULL; |
437 if (!Launchd::GetInstance()->RemoveJob(label, &err)) { | 438 if (!Launchd::GetInstance()->RemoveJob(label, &err)) { |
438 base::mac::ScopedCFTypeRef<CFErrorRef> scoped_err(err); | 439 base::mac::ScopedCFTypeRef<CFErrorRef> scoped_err(err); |
439 DLOG(ERROR) << "RemoveJob " << err; | 440 DLOG(ERROR) << "RemoveJob " << err; |
440 // Exiting with zero, so launchd doesn't restart the process. | 441 // Exiting with zero, so launchd doesn't restart the process. |
441 exit(0); | 442 exit(0); |
442 } | 443 } |
443 } | 444 } |
444 } | 445 } |
445 } | 446 } |
OLD | NEW |