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

Side by Side Diff: remoting/host/desktop_capturer_proxy.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 5 years 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/daemon_process_win.cc ('k') | remoting/host/desktop_process.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_capturer_proxy.h" 5 #include "remoting/host/desktop_capturer_proxy.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility>
10
9 #include "base/bind.h" 11 #include "base/bind.h"
10 #include "base/location.h" 12 #include "base/location.h"
11 #include "base/macros.h" 13 #include "base/macros.h"
12 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
13 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
14 #include "remoting/proto/control.pb.h" 16 #include "remoting/proto/control.pb.h"
15 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" 17 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
16 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h" 18 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h"
17 19
18 namespace remoting { 20 namespace remoting {
(...skipping 21 matching lines...) Expand all
40 42
41 DISALLOW_COPY_AND_ASSIGN(Core); 43 DISALLOW_COPY_AND_ASSIGN(Core);
42 }; 44 };
43 45
44 DesktopCapturerProxy::Core::Core( 46 DesktopCapturerProxy::Core::Core(
45 base::WeakPtr<DesktopCapturerProxy> proxy, 47 base::WeakPtr<DesktopCapturerProxy> proxy,
46 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, 48 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
47 scoped_ptr<webrtc::DesktopCapturer> capturer) 49 scoped_ptr<webrtc::DesktopCapturer> capturer)
48 : proxy_(proxy), 50 : proxy_(proxy),
49 caller_task_runner_(base::ThreadTaskRunnerHandle::Get()), 51 caller_task_runner_(base::ThreadTaskRunnerHandle::Get()),
50 capturer_(capturer.Pass()) { 52 capturer_(std::move(capturer)) {
51 thread_checker_.DetachFromThread(); 53 thread_checker_.DetachFromThread();
52 } 54 }
53 55
54 DesktopCapturerProxy::Core::~Core() { 56 DesktopCapturerProxy::Core::~Core() {
55 DCHECK(thread_checker_.CalledOnValidThread()); 57 DCHECK(thread_checker_.CalledOnValidThread());
56 } 58 }
57 59
58 void DesktopCapturerProxy::Core::Start() { 60 void DesktopCapturerProxy::Core::Start() {
59 DCHECK(thread_checker_.CalledOnValidThread()); 61 DCHECK(thread_checker_.CalledOnValidThread());
60 capturer_->Start(this); 62 capturer_->Start(this);
(...skipping 19 matching lines...) Expand all
80 DCHECK(thread_checker_.CalledOnValidThread()); 82 DCHECK(thread_checker_.CalledOnValidThread());
81 83
82 caller_task_runner_->PostTask( 84 caller_task_runner_->PostTask(
83 FROM_HERE, base::Bind(&DesktopCapturerProxy::OnFrameCaptured, proxy_, 85 FROM_HERE, base::Bind(&DesktopCapturerProxy::OnFrameCaptured, proxy_,
84 base::Passed(make_scoped_ptr(frame)))); 86 base::Passed(make_scoped_ptr(frame))));
85 } 87 }
86 88
87 DesktopCapturerProxy::DesktopCapturerProxy( 89 DesktopCapturerProxy::DesktopCapturerProxy(
88 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, 90 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
89 scoped_ptr<webrtc::DesktopCapturer> capturer) 91 scoped_ptr<webrtc::DesktopCapturer> capturer)
90 : capture_task_runner_(capture_task_runner), 92 : capture_task_runner_(capture_task_runner), weak_factory_(this) {
91 weak_factory_(this) {
92 core_.reset(new Core(weak_factory_.GetWeakPtr(), capture_task_runner, 93 core_.reset(new Core(weak_factory_.GetWeakPtr(), capture_task_runner,
93 capturer.Pass())); 94 std::move(capturer)));
94 } 95 }
95 96
96 void DesktopCapturerProxy::Start(Callback* callback) { 97 void DesktopCapturerProxy::Start(Callback* callback) {
97 DCHECK(thread_checker_.CalledOnValidThread()); 98 DCHECK(thread_checker_.CalledOnValidThread());
98 99
99 callback_ = callback; 100 callback_ = callback;
100 101
101 capture_task_runner_->PostTask( 102 capture_task_runner_->PostTask(
102 FROM_HERE, base::Bind(&Core::Start, base::Unretained(core_.get()))); 103 FROM_HERE, base::Bind(&Core::Start, base::Unretained(core_.get())));
103 } 104 }
(...skipping 16 matching lines...) Expand all
120 } 121 }
121 122
122 void DesktopCapturerProxy::OnFrameCaptured( 123 void DesktopCapturerProxy::OnFrameCaptured(
123 scoped_ptr<webrtc::DesktopFrame> frame) { 124 scoped_ptr<webrtc::DesktopFrame> frame) {
124 DCHECK(thread_checker_.CalledOnValidThread()); 125 DCHECK(thread_checker_.CalledOnValidThread());
125 126
126 callback_->OnCaptureCompleted(frame.release()); 127 callback_->OnCaptureCompleted(frame.release());
127 } 128 }
128 129
129 } // namespace remoting 130 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/daemon_process_win.cc ('k') | remoting/host/desktop_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698