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

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

Issue 9958150: Make sure that scoped_ptr<> cannot be used with ref-counted objects. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | « base/memory/scoped_ptr_unittest.nc ('k') | ppapi/proxy/ppb_network_monitor_private_proxy.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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 bool ServiceProcessState::StateData::WatchExecutable() { 312 bool ServiceProcessState::StateData::WatchExecutable() {
313 base::mac::ScopedNSAutoreleasePool pool; 313 base::mac::ScopedNSAutoreleasePool pool;
314 NSDictionary* ns_launchd_conf = base::mac::CFToNSCast(launchd_conf_); 314 NSDictionary* ns_launchd_conf = base::mac::CFToNSCast(launchd_conf_);
315 NSString* exe_path = [ns_launchd_conf objectForKey:@ LAUNCH_JOBKEY_PROGRAM]; 315 NSString* exe_path = [ns_launchd_conf objectForKey:@ LAUNCH_JOBKEY_PROGRAM];
316 if (!exe_path) { 316 if (!exe_path) {
317 DLOG(ERROR) << "No " LAUNCH_JOBKEY_PROGRAM; 317 DLOG(ERROR) << "No " LAUNCH_JOBKEY_PROGRAM;
318 return false; 318 return false;
319 } 319 }
320 320
321 FilePath executable_path = FilePath([exe_path fileSystemRepresentation]); 321 FilePath executable_path = FilePath([exe_path fileSystemRepresentation]);
322 scoped_ptr<ExecFilePathWatcherDelegate> delegate( 322 scoped_refptr<ExecFilePathWatcherDelegate> delegate(
323 new ExecFilePathWatcherDelegate); 323 new ExecFilePathWatcherDelegate);
324 if (!delegate->Init(executable_path)) { 324 if (!delegate->Init(executable_path)) {
325 DLOG(ERROR) << "executable_watcher_.Init " << executable_path.value(); 325 DLOG(ERROR) << "executable_watcher_.Init " << executable_path.value();
326 return false; 326 return false;
327 } 327 }
328 if (!executable_watcher_.Watch(executable_path, delegate.release())) { 328 if (!executable_watcher_.Watch(executable_path, delegate)) {
329 DLOG(ERROR) << "executable_watcher_.watch " << executable_path.value(); 329 DLOG(ERROR) << "executable_watcher_.watch " << executable_path.value();
330 return false; 330 return false;
331 } 331 }
332 return true; 332 return true;
333 } 333 }
334 334
335 bool ExecFilePathWatcherDelegate::Init(const FilePath& path) { 335 bool ExecFilePathWatcherDelegate::Init(const FilePath& path) {
336 return base::mac::FSRefFromPath(path.value(), &executable_fsref_); 336 return base::mac::FSRefFromPath(path.value(), &executable_fsref_);
337 } 337 }
338 338
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 CFErrorRef err = NULL; 436 CFErrorRef err = NULL;
437 if (!Launchd::GetInstance()->RemoveJob(label, &err)) { 437 if (!Launchd::GetInstance()->RemoveJob(label, &err)) {
438 base::mac::ScopedCFTypeRef<CFErrorRef> scoped_err(err); 438 base::mac::ScopedCFTypeRef<CFErrorRef> scoped_err(err);
439 DLOG(ERROR) << "RemoveJob " << err; 439 DLOG(ERROR) << "RemoveJob " << err;
440 // Exiting with zero, so launchd doesn't restart the process. 440 // Exiting with zero, so launchd doesn't restart the process.
441 exit(0); 441 exit(0);
442 } 442 }
443 } 443 }
444 } 444 }
445 } 445 }
OLDNEW
« no previous file with comments | « base/memory/scoped_ptr_unittest.nc ('k') | ppapi/proxy/ppb_network_monitor_private_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698