OLD | NEW |
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> | 9 #include <utility> |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void DesktopCapturerProxy::Core::Start() { | 77 void DesktopCapturerProxy::Core::Start() { |
78 DCHECK(thread_checker_.CalledOnValidThread()); | 78 DCHECK(thread_checker_.CalledOnValidThread()); |
79 if (capturer_) | 79 if (capturer_) |
80 capturer_->Start(this); | 80 capturer_->Start(this); |
81 } | 81 } |
82 | 82 |
83 void DesktopCapturerProxy::Core::SetSharedMemoryFactory( | 83 void DesktopCapturerProxy::Core::SetSharedMemoryFactory( |
84 std::unique_ptr<webrtc::SharedMemoryFactory> shared_memory_factory) { | 84 std::unique_ptr<webrtc::SharedMemoryFactory> shared_memory_factory) { |
85 DCHECK(thread_checker_.CalledOnValidThread()); | 85 DCHECK(thread_checker_.CalledOnValidThread()); |
86 if (capturer_) { | 86 if (capturer_) { |
87 capturer_->SetSharedMemoryFactory( | 87 capturer_->SetSharedMemoryFactory(std::move(shared_memory_factory)); |
88 rtc::scoped_ptr<webrtc::SharedMemoryFactory>( | |
89 shared_memory_factory.release())); | |
90 } | 88 } |
91 } | 89 } |
92 | 90 |
93 void DesktopCapturerProxy::Core::Capture(const webrtc::DesktopRegion& rect) { | 91 void DesktopCapturerProxy::Core::Capture(const webrtc::DesktopRegion& rect) { |
94 DCHECK(thread_checker_.CalledOnValidThread()); | 92 DCHECK(thread_checker_.CalledOnValidThread()); |
95 if (capturer_) { | 93 if (capturer_) { |
96 capturer_->Capture(rect); | 94 capturer_->Capture(rect); |
97 } else { | 95 } else { |
98 OnCaptureCompleted(nullptr); | 96 OnCaptureCompleted(nullptr); |
99 } | 97 } |
(...skipping 25 matching lines...) Expand all Loading... |
125 void DesktopCapturerProxy::Start(Callback* callback) { | 123 void DesktopCapturerProxy::Start(Callback* callback) { |
126 DCHECK(thread_checker_.CalledOnValidThread()); | 124 DCHECK(thread_checker_.CalledOnValidThread()); |
127 | 125 |
128 callback_ = callback; | 126 callback_ = callback; |
129 | 127 |
130 capture_task_runner_->PostTask( | 128 capture_task_runner_->PostTask( |
131 FROM_HERE, base::Bind(&Core::Start, base::Unretained(core_.get()))); | 129 FROM_HERE, base::Bind(&Core::Start, base::Unretained(core_.get()))); |
132 } | 130 } |
133 | 131 |
134 void DesktopCapturerProxy::SetSharedMemoryFactory( | 132 void DesktopCapturerProxy::SetSharedMemoryFactory( |
135 rtc::scoped_ptr<webrtc::SharedMemoryFactory> shared_memory_factory) { | 133 std::unique_ptr<webrtc::SharedMemoryFactory> shared_memory_factory) { |
136 DCHECK(thread_checker_.CalledOnValidThread()); | 134 DCHECK(thread_checker_.CalledOnValidThread()); |
137 | 135 |
138 capture_task_runner_->PostTask( | 136 capture_task_runner_->PostTask( |
139 FROM_HERE, | 137 FROM_HERE, |
140 base::Bind( | 138 base::Bind( |
141 &Core::SetSharedMemoryFactory, base::Unretained(core_.get()), | 139 &Core::SetSharedMemoryFactory, base::Unretained(core_.get()), |
142 base::Passed(base::WrapUnique(shared_memory_factory.release())))); | 140 base::Passed(base::WrapUnique(shared_memory_factory.release())))); |
143 } | 141 } |
144 | 142 |
145 void DesktopCapturerProxy::Capture(const webrtc::DesktopRegion& rect) { | 143 void DesktopCapturerProxy::Capture(const webrtc::DesktopRegion& rect) { |
146 DCHECK(thread_checker_.CalledOnValidThread()); | 144 DCHECK(thread_checker_.CalledOnValidThread()); |
147 | 145 |
148 // Start() must be called before Capture(). | 146 // Start() must be called before Capture(). |
149 DCHECK(callback_); | 147 DCHECK(callback_); |
150 | 148 |
151 capture_task_runner_->PostTask( | 149 capture_task_runner_->PostTask( |
152 FROM_HERE, | 150 FROM_HERE, |
153 base::Bind(&Core::Capture, base::Unretained(core_.get()), rect)); | 151 base::Bind(&Core::Capture, base::Unretained(core_.get()), rect)); |
154 } | 152 } |
155 | 153 |
156 void DesktopCapturerProxy::OnFrameCaptured( | 154 void DesktopCapturerProxy::OnFrameCaptured( |
157 std::unique_ptr<webrtc::DesktopFrame> frame) { | 155 std::unique_ptr<webrtc::DesktopFrame> frame) { |
158 DCHECK(thread_checker_.CalledOnValidThread()); | 156 DCHECK(thread_checker_.CalledOnValidThread()); |
159 | 157 |
160 callback_->OnCaptureCompleted(frame.release()); | 158 callback_->OnCaptureCompleted(frame.release()); |
161 } | 159 } |
162 | 160 |
163 } // namespace remoting | 161 } // namespace remoting |
OLD | NEW |