| 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 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 base::FileDescriptor fd(socket, false); | 190 base::FileDescriptor fd(socket, false); |
| 191 return IPC::ChannelHandle(std::string(), fd); | 191 return IPC::ChannelHandle(std::string(), fd); |
| 192 } | 192 } |
| 193 | 193 |
| 194 bool CheckServiceProcessReady() { | 194 bool CheckServiceProcessReady() { |
| 195 std::string version; | 195 std::string version; |
| 196 pid_t pid; | 196 pid_t pid; |
| 197 if (!GetServiceProcessData(&version, &pid)) { | 197 if (!GetServiceProcessData(&version, &pid)) { |
| 198 return false; | 198 return false; |
| 199 } | 199 } |
| 200 Version service_version(version); | 200 base::Version service_version(version); |
| 201 bool ready = true; | 201 bool ready = true; |
| 202 if (!service_version.IsValid()) { | 202 if (!service_version.IsValid()) { |
| 203 ready = false; | 203 ready = false; |
| 204 } else { | 204 } else { |
| 205 Version running_version(version_info::GetVersionNumber()); | 205 base::Version running_version(version_info::GetVersionNumber()); |
| 206 if (!running_version.IsValid()) { | 206 if (!running_version.IsValid()) { |
| 207 // Our own version is invalid. This is an error case. Pretend that we | 207 // Our own version is invalid. This is an error case. Pretend that we |
| 208 // are out of date. | 208 // are out of date. |
| 209 NOTREACHED(); | 209 NOTREACHED(); |
| 210 ready = true; | 210 ready = true; |
| 211 } else if (running_version.CompareTo(service_version) > 0) { | 211 } else if (running_version.CompareTo(service_version) > 0) { |
| 212 ready = false; | 212 ready = false; |
| 213 } else { | 213 } else { |
| 214 ready = true; | 214 ready = true; |
| 215 } | 215 } |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 CFErrorRef err = NULL; | 430 CFErrorRef err = NULL; |
| 431 if (!Launchd::GetInstance()->RemoveJob(label, &err)) { | 431 if (!Launchd::GetInstance()->RemoveJob(label, &err)) { |
| 432 base::ScopedCFTypeRef<CFErrorRef> scoped_err(err); | 432 base::ScopedCFTypeRef<CFErrorRef> scoped_err(err); |
| 433 DLOG(ERROR) << "RemoveJob " << err; | 433 DLOG(ERROR) << "RemoveJob " << err; |
| 434 // Exiting with zero, so launchd doesn't restart the process. | 434 // Exiting with zero, so launchd doesn't restart the process. |
| 435 exit(0); | 435 exit(0); |
| 436 } | 436 } |
| 437 } | 437 } |
| 438 } | 438 } |
| 439 } | 439 } |
| OLD | NEW |