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/client/frame_consumer_proxy.h" | 5 #include "remoting/client/frame_consumer_proxy.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | 10 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
| 11 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
| 12 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h" |
11 | 13 |
12 namespace remoting { | 14 namespace remoting { |
13 | 15 |
14 FrameConsumerProxy::FrameConsumerProxy( | 16 FrameConsumerProxy::FrameConsumerProxy( |
15 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 17 scoped_refptr<base::SingleThreadTaskRunner> task_runner) |
16 : task_runner_(task_runner) { | 18 : task_runner_(task_runner) { |
17 } | 19 } |
18 | 20 |
19 void FrameConsumerProxy::ApplyBuffer(const SkISize& view_size, | 21 void FrameConsumerProxy::ApplyBuffer(const webrtc::DesktopSize& view_size, |
20 const SkIRect& clip_area, | 22 const webrtc::DesktopRect& clip_area, |
21 webrtc::DesktopFrame* buffer, | 23 webrtc::DesktopFrame* buffer, |
22 const SkRegion& region) { | 24 const webrtc::DesktopRegion& region) { |
23 if (!task_runner_->BelongsToCurrentThread()) { | 25 if (!task_runner_->BelongsToCurrentThread()) { |
24 task_runner_->PostTask(FROM_HERE, base::Bind( | 26 task_runner_->PostTask(FROM_HERE, base::Bind( |
25 &FrameConsumerProxy::ApplyBuffer, this, | 27 &FrameConsumerProxy::ApplyBuffer, this, |
26 view_size, clip_area, buffer, region)); | 28 view_size, clip_area, buffer, region)); |
27 return; | 29 return; |
28 } | 30 } |
29 | 31 |
30 if (frame_consumer_.get()) | 32 if (frame_consumer_.get()) |
31 frame_consumer_->ApplyBuffer(view_size, clip_area, buffer, region); | 33 frame_consumer_->ApplyBuffer(view_size, clip_area, buffer, region); |
32 } | 34 } |
33 | 35 |
34 void FrameConsumerProxy::ReturnBuffer(webrtc::DesktopFrame* buffer) { | 36 void FrameConsumerProxy::ReturnBuffer(webrtc::DesktopFrame* buffer) { |
35 if (!task_runner_->BelongsToCurrentThread()) { | 37 if (!task_runner_->BelongsToCurrentThread()) { |
36 task_runner_->PostTask(FROM_HERE, base::Bind( | 38 task_runner_->PostTask(FROM_HERE, base::Bind( |
37 &FrameConsumerProxy::ReturnBuffer, this, buffer)); | 39 &FrameConsumerProxy::ReturnBuffer, this, buffer)); |
38 return; | 40 return; |
39 } | 41 } |
40 | 42 |
41 if (frame_consumer_.get()) | 43 if (frame_consumer_.get()) |
42 frame_consumer_->ReturnBuffer(buffer); | 44 frame_consumer_->ReturnBuffer(buffer); |
43 } | 45 } |
44 | 46 |
45 void FrameConsumerProxy::SetSourceSize(const SkISize& source_size, | 47 void FrameConsumerProxy::SetSourceSize( |
46 const SkIPoint& source_dpi) { | 48 const webrtc::DesktopSize& source_size, |
| 49 const webrtc::DesktopVector& source_dpi) { |
47 if (!task_runner_->BelongsToCurrentThread()) { | 50 if (!task_runner_->BelongsToCurrentThread()) { |
48 task_runner_->PostTask(FROM_HERE, base::Bind( | 51 task_runner_->PostTask(FROM_HERE, base::Bind( |
49 &FrameConsumerProxy::SetSourceSize, this, source_size, source_dpi)); | 52 &FrameConsumerProxy::SetSourceSize, this, source_size, source_dpi)); |
50 return; | 53 return; |
51 } | 54 } |
52 | 55 |
53 if (frame_consumer_.get()) | 56 if (frame_consumer_.get()) |
54 frame_consumer_->SetSourceSize(source_size, source_dpi); | 57 frame_consumer_->SetSourceSize(source_size, source_dpi); |
55 } | 58 } |
56 | 59 |
57 void FrameConsumerProxy::Attach( | 60 void FrameConsumerProxy::Attach( |
58 const base::WeakPtr<FrameConsumer>& frame_consumer) { | 61 const base::WeakPtr<FrameConsumer>& frame_consumer) { |
59 DCHECK(task_runner_->BelongsToCurrentThread()); | 62 DCHECK(task_runner_->BelongsToCurrentThread()); |
60 DCHECK(frame_consumer_.get() == NULL); | 63 DCHECK(frame_consumer_.get() == NULL); |
61 frame_consumer_ = frame_consumer; | 64 frame_consumer_ = frame_consumer; |
62 } | 65 } |
63 | 66 |
64 FrameConsumerProxy::~FrameConsumerProxy() { | 67 FrameConsumerProxy::~FrameConsumerProxy() { |
65 } | 68 } |
66 | 69 |
67 } // namespace remoting | 70 } // namespace remoting |
OLD | NEW |