| 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 return false; | 318 return false; |
| 319 } | 319 } |
| 320 | 320 |
| 321 FilePath executable_path = FilePath([exe_path fileSystemRepresentation]); | 321 FilePath executable_path = FilePath([exe_path fileSystemRepresentation]); |
| 322 scoped_refptr<ExecFilePathWatcherDelegate> delegate( | 322 scoped_refptr<ExecFilePathWatcherDelegate> delegate( |
| 323 new ExecFilePathWatcherDelegate); | 323 new ExecFilePathWatcherDelegate); |
| 324 if (!delegate->Init(executable_path)) { | 324 if (!delegate->Init(executable_path)) { |
| 325 DLOG(ERROR) << "executable_watcher_.Init " << executable_path.value(); | 325 DLOG(ERROR) << "executable_watcher_.Init " << executable_path.value(); |
| 326 return false; | 326 return false; |
| 327 } | 327 } |
| 328 if (!executable_watcher_.Watch(executable_path, delegate)) { | 328 if (!executable_watcher_.Watch(executable_path, false, delegate)) { |
| 329 DLOG(ERROR) << "executable_watcher_.watch " << executable_path.value(); | 329 DLOG(ERROR) << "executable_watcher_.watch " << executable_path.value(); |
| 330 return false; | 330 return false; |
| 331 } | 331 } |
| 332 return true; | 332 return true; |
| 333 } | 333 } |
| 334 | 334 |
| 335 bool ExecFilePathWatcherDelegate::Init(const FilePath& path) { | 335 bool ExecFilePathWatcherDelegate::Init(const FilePath& path) { |
| 336 return base::mac::FSRefFromPath(path.value(), &executable_fsref_); | 336 return base::mac::FSRefFromPath(path.value(), &executable_fsref_); |
| 337 } | 337 } |
| 338 | 338 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 CFErrorRef err = NULL; | 436 CFErrorRef err = NULL; |
| 437 if (!Launchd::GetInstance()->RemoveJob(label, &err)) { | 437 if (!Launchd::GetInstance()->RemoveJob(label, &err)) { |
| 438 base::mac::ScopedCFTypeRef<CFErrorRef> scoped_err(err); | 438 base::mac::ScopedCFTypeRef<CFErrorRef> scoped_err(err); |
| 439 DLOG(ERROR) << "RemoveJob " << err; | 439 DLOG(ERROR) << "RemoveJob " << err; |
| 440 // Exiting with zero, so launchd doesn't restart the process. | 440 // Exiting with zero, so launchd doesn't restart the process. |
| 441 exit(0); | 441 exit(0); |
| 442 } | 442 } |
| 443 } | 443 } |
| 444 } | 444 } |
| 445 } | 445 } |
| OLD | NEW |