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" | 11 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
12 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h" | 12 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h" |
13 | 13 |
14 namespace remoting { | 14 namespace remoting { |
15 | 15 |
16 FrameConsumerProxy::FrameConsumerProxy( | 16 FrameConsumerProxy::FrameConsumerProxy( |
17 scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 17 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
18 : task_runner_(task_runner) { | 18 const base::WeakPtr<FrameConsumer>& frame_consumer) |
| 19 : frame_consumer_(frame_consumer), |
| 20 task_runner_(task_runner) { |
| 21 pixel_format_ = frame_consumer_->GetPixelFormat(); |
19 } | 22 } |
20 | 23 |
21 void FrameConsumerProxy::ApplyBuffer(const webrtc::DesktopSize& view_size, | 24 void FrameConsumerProxy::ApplyBuffer(const webrtc::DesktopSize& view_size, |
22 const webrtc::DesktopRect& clip_area, | 25 const webrtc::DesktopRect& clip_area, |
23 webrtc::DesktopFrame* buffer, | 26 webrtc::DesktopFrame* buffer, |
24 const webrtc::DesktopRegion& region) { | 27 const webrtc::DesktopRegion& region) { |
25 if (!task_runner_->BelongsToCurrentThread()) { | 28 if (!task_runner_->BelongsToCurrentThread()) { |
26 task_runner_->PostTask(FROM_HERE, base::Bind( | 29 task_runner_->PostTask(FROM_HERE, base::Bind( |
27 &FrameConsumerProxy::ApplyBuffer, this, | 30 &FrameConsumerProxy::ApplyBuffer, this, |
28 view_size, clip_area, buffer, region)); | 31 view_size, clip_area, buffer, region)); |
(...skipping 21 matching lines...) Expand all Loading... |
50 if (!task_runner_->BelongsToCurrentThread()) { | 53 if (!task_runner_->BelongsToCurrentThread()) { |
51 task_runner_->PostTask(FROM_HERE, base::Bind( | 54 task_runner_->PostTask(FROM_HERE, base::Bind( |
52 &FrameConsumerProxy::SetSourceSize, this, source_size, source_dpi)); | 55 &FrameConsumerProxy::SetSourceSize, this, source_size, source_dpi)); |
53 return; | 56 return; |
54 } | 57 } |
55 | 58 |
56 if (frame_consumer_.get()) | 59 if (frame_consumer_.get()) |
57 frame_consumer_->SetSourceSize(source_size, source_dpi); | 60 frame_consumer_->SetSourceSize(source_size, source_dpi); |
58 } | 61 } |
59 | 62 |
60 void FrameConsumerProxy::Attach( | 63 FrameConsumer::PixelFormat FrameConsumerProxy::GetPixelFormat() { |
61 const base::WeakPtr<FrameConsumer>& frame_consumer) { | 64 return pixel_format_; |
62 DCHECK(task_runner_->BelongsToCurrentThread()); | |
63 DCHECK(frame_consumer_.get() == NULL); | |
64 frame_consumer_ = frame_consumer; | |
65 } | 65 } |
66 | 66 |
67 FrameConsumerProxy::~FrameConsumerProxy() { | 67 FrameConsumerProxy::~FrameConsumerProxy() { |
68 } | 68 } |
69 | 69 |
70 } // namespace remoting | 70 } // namespace remoting |
OLD | NEW |