| OLD | NEW |
| 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_proxy.h" | 5 #include "remoting/host/desktop_session_proxy.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/platform_file.h" | 9 #include "base/platform_file.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 | 184 |
| 185 void DesktopSessionProxy::SetAudioCapturer( | 185 void DesktopSessionProxy::SetAudioCapturer( |
| 186 const base::WeakPtr<IpcAudioCapturer>& audio_capturer) { | 186 const base::WeakPtr<IpcAudioCapturer>& audio_capturer) { |
| 187 DCHECK(audio_capture_task_runner_->BelongsToCurrentThread()); | 187 DCHECK(audio_capture_task_runner_->BelongsToCurrentThread()); |
| 188 | 188 |
| 189 audio_capturer_ = audio_capturer; | 189 audio_capturer_ = audio_capturer; |
| 190 } | 190 } |
| 191 | 191 |
| 192 void DesktopSessionProxy::InvalidateRegion(const SkRegion& invalid_region) { | |
| 193 if (!caller_task_runner_->BelongsToCurrentThread()) { | |
| 194 caller_task_runner_->PostTask( | |
| 195 FROM_HERE, base::Bind(&DesktopSessionProxy::InvalidateRegion, this, | |
| 196 invalid_region)); | |
| 197 return; | |
| 198 } | |
| 199 | |
| 200 if (desktop_channel_) { | |
| 201 std::vector<SkIRect> invalid_rects; | |
| 202 for (SkRegion::Iterator i(invalid_region); !i.done(); i.next()) | |
| 203 invalid_rects.push_back(i.rect()); | |
| 204 | |
| 205 SendToDesktop( | |
| 206 new ChromotingNetworkDesktopMsg_InvalidateRegion(invalid_rects)); | |
| 207 } | |
| 208 } | |
| 209 | |
| 210 void DesktopSessionProxy::CaptureFrame() { | 192 void DesktopSessionProxy::CaptureFrame() { |
| 211 if (!caller_task_runner_->BelongsToCurrentThread()) { | 193 if (!caller_task_runner_->BelongsToCurrentThread()) { |
| 212 caller_task_runner_->PostTask( | 194 caller_task_runner_->PostTask( |
| 213 FROM_HERE, base::Bind(&DesktopSessionProxy::CaptureFrame, this)); | 195 FROM_HERE, base::Bind(&DesktopSessionProxy::CaptureFrame, this)); |
| 214 return; | 196 return; |
| 215 } | 197 } |
| 216 | 198 |
| 217 if (desktop_channel_) { | 199 if (desktop_channel_) { |
| 218 ++pending_capture_frame_requests_; | 200 ++pending_capture_frame_requests_; |
| 219 SendToDesktop(new ChromotingNetworkDesktopMsg_CaptureFrame()); | 201 SendToDesktop(new ChromotingNetworkDesktopMsg_CaptureFrame()); |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 } | 469 } |
| 488 | 470 |
| 489 // static | 471 // static |
| 490 void DesktopSessionProxyTraits::Destruct( | 472 void DesktopSessionProxyTraits::Destruct( |
| 491 const DesktopSessionProxy* desktop_session_proxy) { | 473 const DesktopSessionProxy* desktop_session_proxy) { |
| 492 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, | 474 desktop_session_proxy->caller_task_runner_->DeleteSoon(FROM_HERE, |
| 493 desktop_session_proxy); | 475 desktop_session_proxy); |
| 494 } | 476 } |
| 495 | 477 |
| 496 } // namespace remoting | 478 } // namespace remoting |
| OLD | NEW |