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

Side by Side Diff: remoting/host/desktop_session_win.cc

Issue 1549493004: Use std::move() instead of .Pass() in remoting/host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_not_pass
Patch Set: include <utility> 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
« no previous file with comments | « remoting/host/desktop_session_proxy.cc ('k') | remoting/host/desktop_shape_tracker_win.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 "remoting/host/desktop_session_win.h" 5 #include "remoting/host/desktop_session_win.h"
6 6
7 #include <sddl.h> 7 #include <sddl.h>
8
8 #include <limits> 9 #include <limits>
10 #include <utility>
9 11
10 #include "base/base_switches.h" 12 #include "base/base_switches.h"
11 #include "base/command_line.h" 13 #include "base/command_line.h"
12 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
13 #include "base/guid.h" 15 #include "base/guid.h"
14 #include "base/macros.h" 16 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
18 #include "base/strings/stringprintf.h" 20 #include "base/strings/stringprintf.h"
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 364
363 } // namespace 365 } // namespace
364 366
365 // static 367 // static
366 scoped_ptr<DesktopSession> DesktopSessionWin::CreateForConsole( 368 scoped_ptr<DesktopSession> DesktopSessionWin::CreateForConsole(
367 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, 369 scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
368 scoped_refptr<AutoThreadTaskRunner> io_task_runner, 370 scoped_refptr<AutoThreadTaskRunner> io_task_runner,
369 DaemonProcess* daemon_process, 371 DaemonProcess* daemon_process,
370 int id, 372 int id,
371 const ScreenResolution& resolution) { 373 const ScreenResolution& resolution) {
372 scoped_ptr<ConsoleSession> session(new ConsoleSession( 374 return make_scoped_ptr(new ConsoleSession(
373 caller_task_runner, io_task_runner, daemon_process, id, 375 caller_task_runner, io_task_runner, daemon_process, id,
374 HostService::GetInstance())); 376 HostService::GetInstance()));
375
376 return session.Pass();
377 } 377 }
378 378
379 // static 379 // static
380 scoped_ptr<DesktopSession> DesktopSessionWin::CreateForVirtualTerminal( 380 scoped_ptr<DesktopSession> DesktopSessionWin::CreateForVirtualTerminal(
381 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, 381 scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
382 scoped_refptr<AutoThreadTaskRunner> io_task_runner, 382 scoped_refptr<AutoThreadTaskRunner> io_task_runner,
383 DaemonProcess* daemon_process, 383 DaemonProcess* daemon_process,
384 int id, 384 int id,
385 const ScreenResolution& resolution) { 385 const ScreenResolution& resolution) {
386 scoped_ptr<RdpSession> session(new RdpSession( 386 scoped_ptr<RdpSession> session(new RdpSession(
387 caller_task_runner, io_task_runner, daemon_process, id, 387 caller_task_runner, io_task_runner, daemon_process, id,
388 HostService::GetInstance())); 388 HostService::GetInstance()));
389 if (!session->Initialize(resolution)) 389 if (!session->Initialize(resolution))
390 return nullptr; 390 return nullptr;
391 391
392 return session.Pass(); 392 return std::move(session);
393 } 393 }
394 394
395 DesktopSessionWin::DesktopSessionWin( 395 DesktopSessionWin::DesktopSessionWin(
396 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, 396 scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
397 scoped_refptr<AutoThreadTaskRunner> io_task_runner, 397 scoped_refptr<AutoThreadTaskRunner> io_task_runner,
398 DaemonProcess* daemon_process, 398 DaemonProcess* daemon_process,
399 int id, 399 int id,
400 WtsTerminalMonitor* monitor) 400 WtsTerminalMonitor* monitor)
401 : DesktopSession(daemon_process, id), 401 : DesktopSession(daemon_process, id),
402 caller_task_runner_(caller_task_runner), 402 caller_task_runner_(caller_task_runner),
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 530
531 session_attach_timer_.Stop(); 531 session_attach_timer_.Stop();
532 532
533 scoped_ptr<base::CommandLine> target(new base::CommandLine(desktop_binary)); 533 scoped_ptr<base::CommandLine> target(new base::CommandLine(desktop_binary));
534 target->AppendSwitchASCII(kProcessTypeSwitchName, kProcessTypeDesktop); 534 target->AppendSwitchASCII(kProcessTypeSwitchName, kProcessTypeDesktop);
535 // Copy the command line switches enabling verbose logging. 535 // Copy the command line switches enabling verbose logging.
536 target->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(), 536 target->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(),
537 kCopiedSwitchNames, arraysize(kCopiedSwitchNames)); 537 kCopiedSwitchNames, arraysize(kCopiedSwitchNames));
538 538
539 // Create a delegate capable of launching a process in a different session. 539 // Create a delegate capable of launching a process in a different session.
540 scoped_ptr<WtsSessionProcessDelegate> delegate( 540 scoped_ptr<WtsSessionProcessDelegate> delegate(new WtsSessionProcessDelegate(
541 new WtsSessionProcessDelegate(io_task_runner_, 541 io_task_runner_, std::move(target), launch_elevated,
542 target.Pass(), 542 base::WideToUTF8(kDaemonIpcSecurityDescriptor)));
543 launch_elevated,
544 base::WideToUTF8(
545 kDaemonIpcSecurityDescriptor)));
546 if (!delegate->Initialize(session_id)) { 543 if (!delegate->Initialize(session_id)) {
547 TerminateSession(); 544 TerminateSession();
548 return; 545 return;
549 } 546 }
550 547
551 // Create a launcher for the desktop process, using the per-session delegate. 548 // Create a launcher for the desktop process, using the per-session delegate.
552 launcher_.reset(new WorkerProcessLauncher(delegate.Pass(), this)); 549 launcher_.reset(new WorkerProcessLauncher(std::move(delegate), this));
553 } 550 }
554 551
555 void DesktopSessionWin::OnSessionDetached() { 552 void DesktopSessionWin::OnSessionDetached() {
556 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 553 DCHECK(caller_task_runner_->BelongsToCurrentThread());
557 554
558 launcher_.reset(); 555 launcher_.reset();
559 556
560 if (monitoring_notifications_) { 557 if (monitoring_notifications_) {
561 ReportElapsedTime("detached"); 558 ReportElapsedTime("detached");
562 559
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 exploded.hour, 596 exploded.hour,
600 exploded.minute, 597 exploded.minute,
601 exploded.second, 598 exploded.second,
602 exploded.millisecond, 599 exploded.millisecond,
603 passed.c_str()); 600 passed.c_str());
604 601
605 last_timestamp_ = now; 602 last_timestamp_ = now;
606 } 603 }
607 604
608 } // namespace remoting 605 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/desktop_session_proxy.cc ('k') | remoting/host/desktop_shape_tracker_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698