| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 base::FileDescriptor fd(socket, false); | 196 base::FileDescriptor fd(socket, false); |
| 197 return IPC::ChannelHandle(std::string(), fd); | 197 return IPC::ChannelHandle(std::string(), fd); |
| 198 } | 198 } |
| 199 | 199 |
| 200 bool CheckServiceProcessReady() { | 200 bool CheckServiceProcessReady() { |
| 201 std::string version; | 201 std::string version; |
| 202 pid_t pid; | 202 pid_t pid; |
| 203 if (!GetServiceProcessData(&version, &pid)) { | 203 if (!GetServiceProcessData(&version, &pid)) { |
| 204 return false; | 204 return false; |
| 205 } | 205 } |
| 206 base::Version service_version(version); | 206 Version service_version(version); |
| 207 bool ready = true; | 207 bool ready = true; |
| 208 if (!service_version.IsValid()) { | 208 if (!service_version.IsValid()) { |
| 209 ready = false; | 209 ready = false; |
| 210 } else { | 210 } else { |
| 211 base::Version running_version(version_info::GetVersionNumber()); | 211 Version running_version(version_info::GetVersionNumber()); |
| 212 if (!running_version.IsValid()) { | 212 if (!running_version.IsValid()) { |
| 213 // Our own version is invalid. This is an error case. Pretend that we | 213 // Our own version is invalid. This is an error case. Pretend that we |
| 214 // are out of date. | 214 // are out of date. |
| 215 NOTREACHED(); | 215 NOTREACHED(); |
| 216 ready = true; | 216 ready = true; |
| 217 } else if (running_version.CompareTo(service_version) > 0) { | 217 } else if (running_version.CompareTo(service_version) > 0) { |
| 218 ready = false; | 218 ready = false; |
| 219 } else { | 219 } else { |
| 220 ready = true; | 220 ready = true; |
| 221 } | 221 } |
| (...skipping 214 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::ScopedCFTypeRef<CFErrorRef> scoped_err(err); | 438 base::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 |