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

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

Issue 1880143002: Convert chrome/common to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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
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 "chrome/common/service_process_util.h" 5 #include "chrome/common/service_process_util.h"
6 6
7 #include <memory>
8
7 #include "base/callback.h" 9 #include "base/callback.h"
8 #include "base/command_line.h" 10 #include "base/command_line.h"
9 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/path_service.h" 13 #include "base/path_service.h"
13 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
14 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
15 #include "base/win/object_watcher.h" 16 #include "base/win/object_watcher.h"
16 #include "base/win/scoped_handle.h" 17 #include "base/win/scoped_handle.h"
17 #include "base/win/win_util.h" 18 #include "base/win/win_util.h"
18 #include "chrome/common/chrome_paths.h" 19 #include "chrome/common/chrome_paths.h"
19 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
20 21
21 namespace { 22 namespace {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 OpenEvent(SYNCHRONIZE | READ_CONTROL, false, event_name.c_str())); 103 OpenEvent(SYNCHRONIZE | READ_CONTROL, false, event_name.c_str()));
103 if (!event.IsValid()) 104 if (!event.IsValid())
104 return false; 105 return false;
105 // Check if the event is signaled. 106 // Check if the event is signaled.
106 return WaitForSingleObject(event.Get(), 0) == WAIT_OBJECT_0; 107 return WaitForSingleObject(event.Get(), 0) == WAIT_OBJECT_0;
107 } 108 }
108 109
109 struct ServiceProcessState::StateData { 110 struct ServiceProcessState::StateData {
110 // An event that is signaled when a service process is ready. 111 // An event that is signaled when a service process is ready.
111 base::win::ScopedHandle ready_event; 112 base::win::ScopedHandle ready_event;
112 scoped_ptr<ServiceProcessTerminateMonitor> terminate_monitor; 113 std::unique_ptr<ServiceProcessTerminateMonitor> terminate_monitor;
113 }; 114 };
114 115
115 void ServiceProcessState::CreateState() { 116 void ServiceProcessState::CreateState() {
116 DCHECK(!state_); 117 DCHECK(!state_);
117 state_ = new StateData; 118 state_ = new StateData;
118 } 119 }
119 120
120 bool ServiceProcessState::TakeSingletonLock() { 121 bool ServiceProcessState::TakeSingletonLock() {
121 DCHECK(state_); 122 DCHECK(state_);
122 base::string16 event_name = GetServiceProcessReadyEventName(); 123 base::string16 event_name = GetServiceProcessReadyEventName();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 HKEY_CURRENT_USER, 168 HKEY_CURRENT_USER,
168 base::UTF8ToWide(GetObsoleteServiceProcessAutoRunKey())); 169 base::UTF8ToWide(GetObsoleteServiceProcessAutoRunKey()));
169 return base::win::RemoveCommandFromAutoRun( 170 return base::win::RemoveCommandFromAutoRun(
170 HKEY_CURRENT_USER, base::UTF8ToWide(GetServiceProcessAutoRunKey())); 171 HKEY_CURRENT_USER, base::UTF8ToWide(GetServiceProcessAutoRunKey()));
171 } 172 }
172 173
173 void ServiceProcessState::TearDownState() { 174 void ServiceProcessState::TearDownState() {
174 delete state_; 175 delete state_;
175 state_ = NULL; 176 state_ = NULL;
176 } 177 }
OLDNEW
« no previous file with comments | « chrome/common/service_process_util_unittest.cc ('k') | chrome/common/variations/variations_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698