OLD | NEW |
| (Empty) |
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 | |
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/weak_ptr.h" | |
14 #include "remoting/client/frame_consumer.h" | |
15 | |
16 namespace base { | |
17 class SingleThreadTaskRunner; | |
18 } // namespace base | |
19 | |
20 namespace remoting { | |
21 | |
22 class FrameConsumerProxy : public FrameConsumer { | |
23 public: | |
24 // Constructs a FrameConsumer proxy which can be passed to another thread, | |
25 // and will direct calls to |frame_consumer| on the thread from which the | |
26 // proxy was constructed. | |
27 FrameConsumerProxy(const base::WeakPtr<FrameConsumer>& frame_consumer); | |
28 ~FrameConsumerProxy() override; | |
29 | |
30 // FrameConsumer implementation. | |
31 void ApplyBuffer(const webrtc::DesktopSize& view_size, | |
32 const webrtc::DesktopRect& clip_area, | |
33 webrtc::DesktopFrame* buffer, | |
34 const webrtc::DesktopRegion& region, | |
35 const webrtc::DesktopRegion* shape) override; | |
36 void ReturnBuffer(webrtc::DesktopFrame* buffer) override; | |
37 void SetSourceSize(const webrtc::DesktopSize& source_size, | |
38 const webrtc::DesktopVector& dpi) override; | |
39 PixelFormat GetPixelFormat() override; | |
40 | |
41 private: | |
42 base::WeakPtr<FrameConsumer> frame_consumer_; | |
43 | |
44 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | |
45 PixelFormat pixel_format_; | |
46 | |
47 DISALLOW_COPY_AND_ASSIGN(FrameConsumerProxy); | |
48 }; | |
49 | |
50 } // namespace remoting | |
51 | |
52 #endif // REMOTING_CLIENT_FRAME_CONSUMER_PROXY_H_ | |
OLD | NEW |