Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: chrome/common/service_process_util.cc

Issue 10683005: Remove two deprecated methods from base::Version (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/update_manifest.cc ('k') | chrome/common/service_process_util_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // us reading bogus data from shared memory for an app that has died. 62 // us reading bogus data from shared memory for an app that has died.
63 if (!CheckServiceProcessReady()) { 63 if (!CheckServiceProcessReady()) {
64 return SERVICE_NOT_RUNNING; 64 return SERVICE_NOT_RUNNING;
65 } 65 }
66 #endif // defined(OS_POSIX) 66 #endif // defined(OS_POSIX)
67 67
68 // At this time we have a version string. Set the out param if it exists. 68 // At this time we have a version string. Set the out param if it exists.
69 if (service_version_out) 69 if (service_version_out)
70 *service_version_out = version; 70 *service_version_out = version;
71 71
72 scoped_ptr<Version> service_version(Version::GetVersionFromString(version)); 72 Version service_version(version);
73 // If the version string is invalid, treat it like an older version. 73 // If the version string is invalid, treat it like an older version.
74 if (!service_version.get()) 74 if (!service_version.IsValid())
75 return SERVICE_OLDER_VERSION_RUNNING; 75 return SERVICE_OLDER_VERSION_RUNNING;
76 76
77 // Get the version of the currently *running* instance of Chrome. 77 // Get the version of the currently *running* instance of Chrome.
78 chrome::VersionInfo version_info; 78 chrome::VersionInfo version_info;
79 if (!version_info.is_valid()) { 79 if (!version_info.is_valid()) {
80 NOTREACHED() << "Failed to get current file version"; 80 NOTREACHED() << "Failed to get current file version";
81 // Our own version is invalid. This is an error case. Pretend that we 81 // Our own version is invalid. This is an error case. Pretend that we
82 // are out of date. 82 // are out of date.
83 return SERVICE_NEWER_VERSION_RUNNING; 83 return SERVICE_NEWER_VERSION_RUNNING;
84 } 84 }
85 scoped_ptr<Version> running_version(Version::GetVersionFromString( 85 Version running_version(version_info.Version());
86 version_info.Version())); 86 if (!running_version.IsValid()) {
87 if (!running_version.get()) {
88 NOTREACHED() << "Failed to parse version info"; 87 NOTREACHED() << "Failed to parse version info";
89 // Our own version is invalid. This is an error case. Pretend that we 88 // Our own version is invalid. This is an error case. Pretend that we
90 // are out of date. 89 // are out of date.
91 return SERVICE_NEWER_VERSION_RUNNING; 90 return SERVICE_NEWER_VERSION_RUNNING;
92 } 91 }
93 92
94 if (running_version->CompareTo(*service_version) > 0) { 93 if (running_version.CompareTo(service_version) > 0) {
95 return SERVICE_OLDER_VERSION_RUNNING; 94 return SERVICE_OLDER_VERSION_RUNNING;
96 } else if (service_version->CompareTo(*running_version) > 0) { 95 } else if (service_version.CompareTo(running_version) > 0) {
97 return SERVICE_NEWER_VERSION_RUNNING; 96 return SERVICE_NEWER_VERSION_RUNNING;
98 } 97 }
99 return SERVICE_SAME_VERSION_RUNNING; 98 return SERVICE_SAME_VERSION_RUNNING;
100 } 99 }
101 100
102 } // namespace 101 } // namespace
103 102
104 // Return a name that is scoped to this instance of the service process. We 103 // Return a name that is scoped to this instance of the service process. We
105 // use the hash of the user-data-dir as a scoping prefix. We can't use 104 // use the hash of the user-data-dir as a scoping prefix. We can't use
106 // the user-data-dir itself as we have limits on the size of the lock names. 105 // the user-data-dir itself as we have limits on the size of the lock names.
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 259
261 // The user data directory is the only other flag we currently want to 260 // The user data directory is the only other flag we currently want to
262 // possibly store. 261 // possibly store.
263 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 262 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
264 FilePath user_data_dir = 263 FilePath user_data_dir =
265 browser_command_line.GetSwitchValuePath(switches::kUserDataDir); 264 browser_command_line.GetSwitchValuePath(switches::kUserDataDir);
266 if (!user_data_dir.empty()) 265 if (!user_data_dir.empty())
267 autorun_command_line_->AppendSwitchPath(switches::kUserDataDir, 266 autorun_command_line_->AppendSwitchPath(switches::kUserDataDir,
268 user_data_dir); 267 user_data_dir);
269 } 268 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/update_manifest.cc ('k') | chrome/common/service_process_util_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698