| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // us reading bogus data from shared memory for an app that has died. | 64 // us reading bogus data from shared memory for an app that has died. |
| 65 if (!CheckServiceProcessReady()) { | 65 if (!CheckServiceProcessReady()) { |
| 66 return SERVICE_NOT_RUNNING; | 66 return SERVICE_NOT_RUNNING; |
| 67 } | 67 } |
| 68 #endif // defined(OS_POSIX) | 68 #endif // defined(OS_POSIX) |
| 69 | 69 |
| 70 // At this time we have a version string. Set the out param if it exists. | 70 // At this time we have a version string. Set the out param if it exists. |
| 71 if (service_version_out) | 71 if (service_version_out) |
| 72 *service_version_out = version; | 72 *service_version_out = version; |
| 73 | 73 |
| 74 base::Version service_version(version); | 74 Version service_version(version); |
| 75 // If the version string is invalid, treat it like an older version. | 75 // If the version string is invalid, treat it like an older version. |
| 76 if (!service_version.IsValid()) | 76 if (!service_version.IsValid()) |
| 77 return SERVICE_OLDER_VERSION_RUNNING; | 77 return SERVICE_OLDER_VERSION_RUNNING; |
| 78 | 78 |
| 79 // Get the version of the currently *running* instance of Chrome. | 79 // Get the version of the currently *running* instance of Chrome. |
| 80 base::Version running_version(version_info::GetVersionNumber()); | 80 Version running_version(version_info::GetVersionNumber()); |
| 81 if (!running_version.IsValid()) { | 81 if (!running_version.IsValid()) { |
| 82 NOTREACHED() << "Failed to parse version info"; | 82 NOTREACHED() << "Failed to parse version info"; |
| 83 // Our own version is invalid. This is an error case. Pretend that we | 83 // Our own version is invalid. This is an error case. Pretend that we |
| 84 // are out of date. | 84 // are out of date. |
| 85 return SERVICE_NEWER_VERSION_RUNNING; | 85 return SERVICE_NEWER_VERSION_RUNNING; |
| 86 } | 86 } |
| 87 | 87 |
| 88 if (running_version.CompareTo(service_version) > 0) { | 88 if (running_version.CompareTo(service_version) > 0) { |
| 89 return SERVICE_OLDER_VERSION_RUNNING; | 89 return SERVICE_OLDER_VERSION_RUNNING; |
| 90 } else if (service_version.CompareTo(running_version) > 0) { | 90 } else if (service_version.CompareTo(running_version) > 0) { |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 shared_data->service_process_pid = base::GetCurrentProcId(); | 264 shared_data->service_process_pid = base::GetCurrentProcId(); |
| 265 shared_mem_service_data_.reset(shared_mem_service_data.release()); | 265 shared_mem_service_data_.reset(shared_mem_service_data.release()); |
| 266 return true; | 266 return true; |
| 267 } | 267 } |
| 268 | 268 |
| 269 IPC::ChannelHandle ServiceProcessState::GetServiceProcessChannel() { | 269 IPC::ChannelHandle ServiceProcessState::GetServiceProcessChannel() { |
| 270 return ::GetServiceProcessChannel(); | 270 return ::GetServiceProcessChannel(); |
| 271 } | 271 } |
| 272 | 272 |
| 273 #endif // !OS_MACOSX | 273 #endif // !OS_MACOSX |
| OLD | NEW |