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

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

Issue 634583003: Simplify VersionInfo code, avoid hitting sandbox IPC constantly on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: linux include Created 6 years, 2 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>
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 chrome::VersionInfo version_info;
212 if (!version_info.is_valid()) { 212 Version running_version(version_info.Version());
213 if (!running_version.IsValid()) {
213 // Our own version is invalid. This is an error case. Pretend that we 214 // Our own version is invalid. This is an error case. Pretend that we
214 // are out of date. 215 // are out of date.
215 NOTREACHED(); 216 NOTREACHED();
216 ready = true; 217 ready = true;
217 } 218 } else if (running_version.CompareTo(service_version) > 0) {
218 else { 219 ready = false;
219 Version running_version(version_info.Version()); 220 } else {
220 if (!running_version.IsValid()) { 221 ready = true;
221 // Our own version is invalid. This is an error case. Pretend that we
222 // are out of date.
223 NOTREACHED();
224 ready = true;
225 } else if (running_version.CompareTo(service_version) > 0) {
226 ready = false;
227 } else {
228 ready = true;
229 }
230 } 222 }
231 } 223 }
232 if (!ready) { 224 if (!ready) {
233 ForceServiceProcessShutdown(version, pid); 225 ForceServiceProcessShutdown(version, pid);
234 } 226 }
235 return ready; 227 return ready;
236 } 228 }
237 229
238 CFDictionaryRef CreateServiceProcessLaunchdPlist(CommandLine* cmd_line, 230 CFDictionaryRef CreateServiceProcessLaunchdPlist(CommandLine* cmd_line,
239 bool for_auto_launch) { 231 bool for_auto_launch) {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 CFErrorRef err = NULL; 434 CFErrorRef err = NULL;
443 if (!Launchd::GetInstance()->RemoveJob(label, &err)) { 435 if (!Launchd::GetInstance()->RemoveJob(label, &err)) {
444 base::ScopedCFTypeRef<CFErrorRef> scoped_err(err); 436 base::ScopedCFTypeRef<CFErrorRef> scoped_err(err);
445 DLOG(ERROR) << "RemoveJob " << err; 437 DLOG(ERROR) << "RemoveJob " << err;
446 // Exiting with zero, so launchd doesn't restart the process. 438 // Exiting with zero, so launchd doesn't restart the process.
447 exit(0); 439 exit(0);
448 } 440 }
449 } 441 }
450 } 442 }
451 } 443 }
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