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.
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.
10 #ifndef REMOTING_CLIENT_FRAME_CONSUMER_PROXY_H_
11 #define REMOTING_CLIENT_FRAME_CONSUMER_PROXY_H_
13 #include "base/memory/weak_ptr.h"
14 #include "remoting/client/frame_consumer.h"
17 class SingleThreadTaskRunner
;
22 class FrameConsumerProxy
: public FrameConsumer
{
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
;
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
;
42 base::WeakPtr
<FrameConsumer
> frame_consumer_
;
44 scoped_refptr
<base::SingleThreadTaskRunner
> task_runner_
;
45 PixelFormat pixel_format_
;
47 DISALLOW_COPY_AND_ASSIGN(FrameConsumerProxy
);
50 } // namespace remoting
52 #endif // REMOTING_CLIENT_FRAME_CONSUMER_PROXY_H_