[email protected] | a9c88d1 | 2012-01-29 03:45:17 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 7920b9e | 2011-12-24 00:44:21 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | // FrameConsumerProxy is used to allow a FrameConsumer on the UI thread to be | ||||
6 | // invoked by a Decoder on the decoder thread. The Detach() method is used by | ||||
7 | // the proxy's owner before tearing down the FrameConsumer, to prevent any | ||||
8 | // further invokations reaching it. | ||||
9 | |||||
10 | #ifndef REMOTING_CLIENT_FRAME_CONSUMER_PROXY_H_ | ||||
11 | #define REMOTING_CLIENT_FRAME_CONSUMER_PROXY_H_ | ||||
12 | |||||
13 | #include "base/memory/ref_counted.h" | ||||
[email protected] | 2964d208 | 2012-03-15 23:58:04 | [diff] [blame] | 14 | #include "base/memory/weak_ptr.h" |
[email protected] | 7920b9e | 2011-12-24 00:44:21 | [diff] [blame] | 15 | #include "remoting/client/frame_consumer.h" |
16 | |||||
17 | namespace base { | ||||
[email protected] | 6be34a67 | 2012-06-12 01:52:54 | [diff] [blame] | 18 | class SingleThreadTaskRunner; |
[email protected] | 7920b9e | 2011-12-24 00:44:21 | [diff] [blame] | 19 | } // namespace base |
20 | |||||
21 | namespace remoting { | ||||
22 | |||||
23 | class FrameConsumerProxy | ||||
24 | : public base::RefCountedThreadSafe<FrameConsumerProxy>, | ||||
25 | public FrameConsumer { | ||||
26 | public: | ||||
27 | // Constructs a proxy for |frame_consumer| which will trampoline invocations | ||||
28 | // to |frame_consumer_message_loop|. | ||||
[email protected] | 596c78f | 2013-10-02 06:53:58 | [diff] [blame] | 29 | FrameConsumerProxy(scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
30 | const base::WeakPtr<FrameConsumer>& frame_consumer); | ||||
[email protected] | 7920b9e | 2011-12-24 00:44:21 | [diff] [blame] | 31 | |
32 | // FrameConsumer implementation. | ||||
dcheng | 562aba5 | 2014-10-21 12:30:14 | [diff] [blame] | 33 | void ApplyBuffer(const webrtc::DesktopSize& view_size, |
34 | const webrtc::DesktopRect& clip_area, | ||||
35 | webrtc::DesktopFrame* buffer, | ||||
36 | const webrtc::DesktopRegion& region, | ||||
37 | const webrtc::DesktopRegion& shape) override; | ||||
38 | void ReturnBuffer(webrtc::DesktopFrame* buffer) override; | ||||
39 | void SetSourceSize(const webrtc::DesktopSize& source_size, | ||||
40 | const webrtc::DesktopVector& dpi) override; | ||||
41 | PixelFormat GetPixelFormat() override; | ||||
[email protected] | 7920b9e | 2011-12-24 00:44:21 | [diff] [blame] | 42 | |
43 | private: | ||||
[email protected] | 256d273 | 2012-04-24 23:26:37 | [diff] [blame] | 44 | friend class base::RefCountedThreadSafe<FrameConsumerProxy>; |
dcheng | 562aba5 | 2014-10-21 12:30:14 | [diff] [blame] | 45 | ~FrameConsumerProxy() override; |
[email protected] | 256d273 | 2012-04-24 23:26:37 | [diff] [blame] | 46 | |
[email protected] | 2964d208 | 2012-03-15 23:58:04 | [diff] [blame] | 47 | base::WeakPtr<FrameConsumer> frame_consumer_; |
[email protected] | 6be34a67 | 2012-06-12 01:52:54 | [diff] [blame] | 48 | scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
[email protected] | 7920b9e | 2011-12-24 00:44:21 | [diff] [blame] | 49 | |
[email protected] | 596c78f | 2013-10-02 06:53:58 | [diff] [blame] | 50 | PixelFormat pixel_format_; |
51 | |||||
[email protected] | 7920b9e | 2011-12-24 00:44:21 | [diff] [blame] | 52 | DISALLOW_COPY_AND_ASSIGN(FrameConsumerProxy); |
53 | }; | ||||
54 | |||||
55 | } // namespace remoting | ||||
56 | |||||
57 | #endif // REMOTING_CLIENT_FRAME_CONSUMER_PROXY_H_ |