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 #import <Foundation/Foundation.h> | 5 #import <Foundation/Foundation.h> |
6 #include <launch.h> | 6 #include <launch.h> |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/mac/bundle_locations.h" | 14 #include "base/mac/bundle_locations.h" |
15 #include "base/mac/foundation_util.h" | 15 #include "base/mac/foundation_util.h" |
16 #include "base/mac/mac_util.h" | 16 #include "base/mac/mac_util.h" |
17 #include "base/mac/scoped_nsautorelease_pool.h" | 17 #include "base/mac/scoped_nsautorelease_pool.h" |
18 #include "base/mac/scoped_nsobject.h" | 18 #include "base/mac/scoped_nsobject.h" |
19 #include "base/metrics/histogram_macros.h" | 19 #include "base/metrics/histogram_macros.h" |
20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
22 #include "base/strings/sys_string_conversions.h" | 22 #include "base/strings/sys_string_conversions.h" |
23 #include "base/threading/thread_restrictions.h" | 23 #include "base/threading/thread_restrictions.h" |
24 #include "base/version.h" | 24 #include "base/version.h" |
25 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
27 #include "chrome/common/mac/launchd.h" | 27 #include "chrome/common/mac/launchd.h" |
28 #include "chrome/common/service_process_util_posix.h" | 28 #include "chrome/common/service_process_util_posix.h" |
29 #include "components/version_info/version_info.h" | 29 #include "components/version_info/version_info.h" |
30 #include "ipc/unix_domain_socket_util.h" | 30 #include "mojo/edk/embedder/named_platform_handle_utils.h" |
31 | 31 |
32 @interface NSFileManager (YosemiteSDK) | 32 @interface NSFileManager (YosemiteSDK) |
33 - (BOOL)getRelationship:(NSURLRelationship*)outRelationship | 33 - (BOOL)getRelationship:(NSURLRelationship*)outRelationship |
34 ofDirectory:(NSSearchPathDirectory)directory | 34 ofDirectory:(NSSearchPathDirectory)directory |
35 inDomain:(NSSearchPathDomainMask)domainMask | 35 inDomain:(NSSearchPathDomainMask)domainMask |
36 toItemAtURL:(NSURL*)url | 36 toItemAtURL:(NSURL*)url |
37 error:(NSError**)error; | 37 error:(NSError**)error; |
38 @end | 38 @end |
39 | 39 |
40 using ::base::FilePathWatcher; | 40 using ::base::FilePathWatcher; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 private: | 88 private: |
89 base::scoped_nsobject<NSURL> executable_fsref_; | 89 base::scoped_nsobject<NSURL> executable_fsref_; |
90 }; | 90 }; |
91 | 91 |
92 base::FilePath GetServiceProcessSocketName() { | 92 base::FilePath GetServiceProcessSocketName() { |
93 base::FilePath socket_name; | 93 base::FilePath socket_name; |
94 PathService::Get(base::DIR_TEMP, &socket_name); | 94 PathService::Get(base::DIR_TEMP, &socket_name); |
95 std::string pipe_name = GetServiceProcessScopedName("srv"); | 95 std::string pipe_name = GetServiceProcessScopedName("srv"); |
96 socket_name = socket_name.Append(pipe_name); | 96 socket_name = socket_name.Append(pipe_name); |
97 CHECK_LT(socket_name.value().size(), IPC::kMaxSocketNameLength); | 97 CHECK_LT(socket_name.value().size(), mojo::edk::kMaxSocketNameLength); |
98 return socket_name; | 98 return socket_name; |
99 } | 99 } |
100 | 100 |
101 } // namespace | 101 } // namespace |
102 | 102 |
103 mojo::edk::NamedPlatformHandle GetServiceProcessChannel() { | 103 mojo::edk::NamedPlatformHandle GetServiceProcessChannel() { |
104 base::FilePath socket_name = GetServiceProcessSocketName(); | 104 base::FilePath socket_name = GetServiceProcessSocketName(); |
105 VLOG(1) << "ServiceProcessChannel: " << socket_name.value(); | 105 VLOG(1) << "ServiceProcessChannel: " << socket_name.value(); |
106 return mojo::edk::NamedPlatformHandle(socket_name.value()); | 106 return mojo::edk::NamedPlatformHandle(socket_name.value()); |
107 } | 107 } |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 CFErrorRef err = NULL; | 461 CFErrorRef err = NULL; |
462 if (!Launchd::GetInstance()->RemoveJob(label, &err)) { | 462 if (!Launchd::GetInstance()->RemoveJob(label, &err)) { |
463 base::ScopedCFTypeRef<CFErrorRef> scoped_err(err); | 463 base::ScopedCFTypeRef<CFErrorRef> scoped_err(err); |
464 DLOG(ERROR) << "RemoveJob " << err; | 464 DLOG(ERROR) << "RemoveJob " << err; |
465 // Exiting with zero, so launchd doesn't restart the process. | 465 // Exiting with zero, so launchd doesn't restart the process. |
466 exit(0); | 466 exit(0); |
467 } | 467 } |
468 } | 468 } |
469 } | 469 } |
470 } | 470 } |
OLD | NEW |