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

Side by Side Diff: chrome/browser/extensions/api/messaging/native_process_launcher.cc

Issue 1549233002: Convert Pass()→std::move() in //chrome/browser/extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 12 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) 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/browser/extensions/api/messaging/native_process_launcher.h" 5 #include "chrome/browser/extensions/api/messaging/native_process_launcher.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/callback.h" 10 #include "base/callback.h"
9 #include "base/command_line.h" 11 #include "base/command_line.h"
10 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
11 #include "base/logging.h" 13 #include "base/logging.h"
12 #include "base/macros.h" 14 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
14 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/string_split.h" 17 #include "base/strings/string_split.h"
16 #include "base/threading/sequenced_worker_pool.h" 18 #include "base/threading/sequenced_worker_pool.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 #if defined(OS_WIN) 193 #if defined(OS_WIN)
192 command_line.AppendSwitchASCII(kParentWindowSwitchName, 194 command_line.AppendSwitchASCII(kParentWindowSwitchName,
193 base::Int64ToString(window_handle_)); 195 base::Int64ToString(window_handle_));
194 #endif // !defined(OS_WIN) 196 #endif // !defined(OS_WIN)
195 197
196 base::Process process; 198 base::Process process;
197 base::File read_file; 199 base::File read_file;
198 base::File write_file; 200 base::File write_file;
199 if (NativeProcessLauncher::LaunchNativeProcess( 201 if (NativeProcessLauncher::LaunchNativeProcess(
200 command_line, &process, &read_file, &write_file)) { 202 command_line, &process, &read_file, &write_file)) {
201 PostResult(callback, process.Pass(), read_file.Pass(), write_file.Pass()); 203 PostResult(callback, std::move(process), std::move(read_file),
204 std::move(write_file));
202 } else { 205 } else {
203 PostErrorResult(callback, RESULT_FAILED_TO_START); 206 PostErrorResult(callback, RESULT_FAILED_TO_START);
204 } 207 }
205 } 208 }
206 209
207 void NativeProcessLauncherImpl::Core::CallCallbackOnIOThread( 210 void NativeProcessLauncherImpl::Core::CallCallbackOnIOThread(
208 const LaunchedCallback& callback, 211 const LaunchedCallback& callback,
209 LaunchResult result, 212 LaunchResult result,
210 base::Process process, 213 base::Process process,
211 base::File read_file, 214 base::File read_file,
212 base::File write_file) { 215 base::File write_file) {
213 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 216 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
214 if (detached_) 217 if (detached_)
215 return; 218 return;
216 219
217 callback.Run(result, process.Pass(), read_file.Pass(), write_file.Pass()); 220 callback.Run(result, std::move(process), std::move(read_file),
221 std::move(write_file));
218 } 222 }
219 223
220 void NativeProcessLauncherImpl::Core::PostErrorResult( 224 void NativeProcessLauncherImpl::Core::PostErrorResult(
221 const LaunchedCallback& callback, 225 const LaunchedCallback& callback,
222 LaunchResult error) { 226 LaunchResult error) {
223 content::BrowserThread::PostTask( 227 content::BrowserThread::PostTask(
224 content::BrowserThread::IO, FROM_HERE, 228 content::BrowserThread::IO, FROM_HERE,
225 base::Bind(&NativeProcessLauncherImpl::Core::CallCallbackOnIOThread, this, 229 base::Bind(&NativeProcessLauncherImpl::Core::CallCallbackOnIOThread, this,
226 callback, error, Passed(base::Process()), 230 callback, error, Passed(base::Process()),
227 Passed(base::File()), Passed(base::File()))); 231 Passed(base::File()), Passed(base::File())));
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 intptr_t window_handle = 0; 268 intptr_t window_handle = 0;
265 #if defined(OS_WIN) 269 #if defined(OS_WIN)
266 window_handle = reinterpret_cast<intptr_t>( 270 window_handle = reinterpret_cast<intptr_t>(
267 views::HWNDForNativeView(native_view)); 271 views::HWNDForNativeView(native_view));
268 #endif 272 #endif
269 return scoped_ptr<NativeProcessLauncher>( 273 return scoped_ptr<NativeProcessLauncher>(
270 new NativeProcessLauncherImpl(allow_user_level_hosts, window_handle)); 274 new NativeProcessLauncherImpl(allow_user_level_hosts, window_handle));
271 } 275 }
272 276
273 } // namespace extensions 277 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698