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

Side by Side Diff: chrome/common/service_process_util_mac.mm

Issue 1269773002: Cleanup VersionInfo after componentization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 4 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
« no previous file with comments | « chrome/common/service_process_util.cc ('k') | chrome/common/service_process_util_unittest.cc » ('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) 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>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/mac/bundle_locations.h" 15 #include "base/mac/bundle_locations.h"
16 #include "base/mac/foundation_util.h" 16 #include "base/mac/foundation_util.h"
17 #include "base/mac/mac_util.h" 17 #include "base/mac/mac_util.h"
18 #include "base/mac/scoped_nsautorelease_pool.h" 18 #include "base/mac/scoped_nsautorelease_pool.h"
19 #include "base/mac/scoped_nsobject.h" 19 #include "base/mac/scoped_nsobject.h"
20 #include "base/metrics/histogram_macros.h" 20 #include "base/metrics/histogram_macros.h"
21 #include "base/path_service.h" 21 #include "base/path_service.h"
22 #include "base/strings/string_util.h" 22 #include "base/strings/string_util.h"
23 #include "base/strings/stringprintf.h" 23 #include "base/strings/stringprintf.h"
24 #include "base/strings/sys_string_conversions.h" 24 #include "base/strings/sys_string_conversions.h"
25 #include "base/threading/thread_restrictions.h" 25 #include "base/threading/thread_restrictions.h"
26 #include "base/version.h" 26 #include "base/version.h"
27 #include "chrome/common/chrome_paths.h" 27 #include "chrome/common/chrome_paths.h"
28 #include "chrome/common/chrome_switches.h" 28 #include "chrome/common/chrome_switches.h"
29 #include "chrome/common/chrome_version_info.h"
30 #include "chrome/common/mac/launchd.h" 29 #include "chrome/common/mac/launchd.h"
30 #include "components/version_info/version_info.h"
31 #include "ipc/unix_domain_socket_util.h" 31 #include "ipc/unix_domain_socket_util.h"
32 32
33 using ::base::FilePathWatcher; 33 using ::base::FilePathWatcher;
34 34
35 namespace { 35 namespace {
36 36
37 #define kServiceProcessSessionType "Aqua" 37 #define kServiceProcessSessionType "Aqua"
38 38
39 CFStringRef CopyServiceProcessLaunchDName() { 39 CFStringRef CopyServiceProcessLaunchDName() {
40 base::mac::ScopedNSAutoreleasePool pool; 40 base::mac::ScopedNSAutoreleasePool pool;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 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 chrome::VersionInfo version_info; 211 Version running_version(version_info::GetVersionNumber());
212 Version running_version(version_info.Version());
213 if (!running_version.IsValid()) { 212 if (!running_version.IsValid()) {
214 // 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
215 // are out of date. 214 // are out of date.
216 NOTREACHED(); 215 NOTREACHED();
217 ready = true; 216 ready = true;
218 } else if (running_version.CompareTo(service_version) > 0) { 217 } else if (running_version.CompareTo(service_version) > 0) {
219 ready = false; 218 ready = false;
220 } else { 219 } else {
221 ready = true; 220 ready = true;
222 } 221 }
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 CFErrorRef err = NULL; 436 CFErrorRef err = NULL;
438 if (!Launchd::GetInstance()->RemoveJob(label, &err)) { 437 if (!Launchd::GetInstance()->RemoveJob(label, &err)) {
439 base::ScopedCFTypeRef<CFErrorRef> scoped_err(err); 438 base::ScopedCFTypeRef<CFErrorRef> scoped_err(err);
440 DLOG(ERROR) << "RemoveJob " << err; 439 DLOG(ERROR) << "RemoveJob " << err;
441 // Exiting with zero, so launchd doesn't restart the process. 440 // Exiting with zero, so launchd doesn't restart the process.
442 exit(0); 441 exit(0);
443 } 442 }
444 } 443 }
445 } 444 }
446 } 445 }
OLDNEW
« no previous file with comments | « chrome/common/service_process_util.cc ('k') | chrome/common/service_process_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698