| 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.h" | 5 #include "chrome/common/service_process_util.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // us reading bogus data from shared memory for an app that has died. | 71 // us reading bogus data from shared memory for an app that has died. |
| 72 if (!CheckServiceProcessReady()) { | 72 if (!CheckServiceProcessReady()) { |
| 73 return SERVICE_NOT_RUNNING; | 73 return SERVICE_NOT_RUNNING; |
| 74 } | 74 } |
| 75 #endif // defined(OS_POSIX) | 75 #endif // defined(OS_POSIX) |
| 76 | 76 |
| 77 // At this time we have a version string. Set the out param if it exists. | 77 // At this time we have a version string. Set the out param if it exists. |
| 78 if (service_version_out) | 78 if (service_version_out) |
| 79 *service_version_out = version; | 79 *service_version_out = version; |
| 80 | 80 |
| 81 Version service_version(version); | 81 base::Version service_version(version); |
| 82 // If the version string is invalid, treat it like an older version. | 82 // If the version string is invalid, treat it like an older version. |
| 83 if (!service_version.IsValid()) | 83 if (!service_version.IsValid()) |
| 84 return SERVICE_OLDER_VERSION_RUNNING; | 84 return SERVICE_OLDER_VERSION_RUNNING; |
| 85 | 85 |
| 86 // Get the version of the currently *running* instance of Chrome. | 86 // Get the version of the currently *running* instance of Chrome. |
| 87 Version running_version(version_info::GetVersionNumber()); | 87 base::Version running_version(version_info::GetVersionNumber()); |
| 88 if (!running_version.IsValid()) { | 88 if (!running_version.IsValid()) { |
| 89 NOTREACHED() << "Failed to parse version info"; | 89 NOTREACHED() << "Failed to parse version info"; |
| 90 // Our own version is invalid. This is an error case. Pretend that we | 90 // Our own version is invalid. This is an error case. Pretend that we |
| 91 // are out of date. | 91 // are out of date. |
| 92 return SERVICE_NEWER_VERSION_RUNNING; | 92 return SERVICE_NEWER_VERSION_RUNNING; |
| 93 } | 93 } |
| 94 | 94 |
| 95 if (running_version.CompareTo(service_version) > 0) { | 95 if (running_version.CompareTo(service_version) > 0) { |
| 96 return SERVICE_OLDER_VERSION_RUNNING; | 96 return SERVICE_OLDER_VERSION_RUNNING; |
| 97 } else if (service_version.CompareTo(running_version) > 0) { | 97 } else if (service_version.CompareTo(running_version) > 0) { |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 shared_data->service_process_pid = base::GetCurrentProcId(); | 277 shared_data->service_process_pid = base::GetCurrentProcId(); |
| 278 shared_mem_service_data_.reset(shared_mem_service_data.release()); | 278 shared_mem_service_data_.reset(shared_mem_service_data.release()); |
| 279 return true; | 279 return true; |
| 280 } | 280 } |
| 281 | 281 |
| 282 IPC::ChannelHandle ServiceProcessState::GetServiceProcessChannel() { | 282 IPC::ChannelHandle ServiceProcessState::GetServiceProcessChannel() { |
| 283 return ::GetServiceProcessChannel(); | 283 return ::GetServiceProcessChannel(); |
| 284 } | 284 } |
| 285 | 285 |
| 286 #endif // !OS_MACOSX | 286 #endif // !OS_MACOSX |
| OLD | NEW |