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

Side by Side Diff: chrome/app/chrome_watcher_command_line_win.cc

Issue 1899083002: Convert //chrome from scoped_ptr 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) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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/app/chrome_watcher_command_line_win.h" 5 #include "chrome/app/chrome_watcher_command_line_win.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 main_thread_id_(main_thread_id) { 107 main_thread_id_(main_thread_id) {
108 } 108 }
109 109
110 ChromeWatcherCommandLine::~ChromeWatcherCommandLine() { 110 ChromeWatcherCommandLine::~ChromeWatcherCommandLine() {
111 // If any handles were not taken then die violently. 111 // If any handles were not taken then die violently.
112 CHECK(!on_initialized_event_handle_.IsValid() && 112 CHECK(!on_initialized_event_handle_.IsValid() &&
113 !parent_process_handle_.IsValid()) 113 !parent_process_handle_.IsValid())
114 << "Handles left untaken."; 114 << "Handles left untaken.";
115 } 115 }
116 116
117 scoped_ptr<ChromeWatcherCommandLine> 117 std::unique_ptr<ChromeWatcherCommandLine>
118 ChromeWatcherCommandLine::InterpretCommandLine( 118 ChromeWatcherCommandLine::InterpretCommandLine(
119 const base::CommandLine& command_line) { 119 const base::CommandLine& command_line) {
120 base::win::ScopedHandle on_initialized_event_handle; 120 base::win::ScopedHandle on_initialized_event_handle;
121 base::win::ScopedHandle parent_process_handle; 121 base::win::ScopedHandle parent_process_handle;
122 DWORD main_thread_id = 0; 122 DWORD main_thread_id = 0;
123 123
124 // TODO(chrisha): Get rid of the following function and move the 124 // TODO(chrisha): Get rid of the following function and move the
125 // implementation here. 125 // implementation here.
126 if (!InterpretChromeWatcherCommandLine( 126 if (!InterpretChromeWatcherCommandLine(
127 command_line, &parent_process_handle, &main_thread_id, 127 command_line, &parent_process_handle, &main_thread_id,
128 &on_initialized_event_handle)) 128 &on_initialized_event_handle))
129 return scoped_ptr<ChromeWatcherCommandLine>(); 129 return std::unique_ptr<ChromeWatcherCommandLine>();
130 130
131 return scoped_ptr<ChromeWatcherCommandLine>(new ChromeWatcherCommandLine( 131 return std::unique_ptr<ChromeWatcherCommandLine>(new ChromeWatcherCommandLine(
132 on_initialized_event_handle.Take(), parent_process_handle.Take(), 132 on_initialized_event_handle.Take(), parent_process_handle.Take(),
133 main_thread_id)); 133 main_thread_id));
134 } 134 }
135 135
136 base::win::ScopedHandle 136 base::win::ScopedHandle
137 ChromeWatcherCommandLine::TakeOnInitializedEventHandle() { 137 ChromeWatcherCommandLine::TakeOnInitializedEventHandle() {
138 return std::move(on_initialized_event_handle_); 138 return std::move(on_initialized_event_handle_);
139 } 139 }
140 140
141 base::win::ScopedHandle ChromeWatcherCommandLine::TakeParentProcessHandle() { 141 base::win::ScopedHandle ChromeWatcherCommandLine::TakeParentProcessHandle() {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 !parent_process->IsValid()) { 212 !parent_process->IsValid()) {
213 // If one was valid and not the other, free the valid one. 213 // If one was valid and not the other, free the valid one.
214 on_initialized_event->Close(); 214 on_initialized_event->Close();
215 parent_process->Close(); 215 parent_process->Close();
216 *main_thread_id = 0; 216 *main_thread_id = 0;
217 return false; 217 return false;
218 } 218 }
219 219
220 return true; 220 return true;
221 } 221 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698