| 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 // FrameConsumerProxy is used to allow a FrameConsumer on the UI thread to be | 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 | 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 | 7 // the proxy's owner before tearing down the FrameConsumer, to prevent any |
| 8 // further invokations reaching it. | 8 // further invokations reaching it. |
| 9 | 9 |
| 10 #ifndef REMOTING_CLIENT_FRAME_CONSUMER_PROXY_H_ | 10 #ifndef REMOTING_CLIENT_FRAME_CONSUMER_PROXY_H_ |
| 11 #define REMOTING_CLIENT_FRAME_CONSUMER_PROXY_H_ | 11 #define REMOTING_CLIENT_FRAME_CONSUMER_PROXY_H_ |
| 12 | 12 |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "remoting/client/frame_consumer.h" | 14 #include "remoting/client/frame_consumer.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class MessageLoopProxy; | 17 class MessageLoopProxy; |
| 18 } // namespace base | 18 } // namespace base |
| 19 | 19 |
| 20 namespace remoting { | 20 namespace remoting { |
| 21 | 21 |
| 22 class FrameConsumerProxy | 22 class FrameConsumerProxy |
| 23 : public base::RefCountedThreadSafe<FrameConsumerProxy>, | 23 : public base::RefCountedThreadSafe<FrameConsumerProxy>, |
| 24 public FrameConsumer { | 24 public FrameConsumer { |
| 25 public: | 25 public: |
| 26 // Constructs a proxy for |frame_consumer| which will trampoline invocations | 26 // Constructs a proxy for |frame_consumer| which will trampoline invocations |
| 27 // to |frame_consumer_message_loop|. | 27 // to |frame_consumer_message_loop|. |
| 28 FrameConsumerProxy(FrameConsumer* frame_consumer, | 28 FrameConsumerProxy(base::MessageLoopProxy* frame_consumer_message_loop); |
| 29 base::MessageLoopProxy* frame_consumer_message_loop); | |
| 30 virtual ~FrameConsumerProxy(); | 29 virtual ~FrameConsumerProxy(); |
| 31 | 30 |
| 32 // FrameConsumer implementation. | 31 // FrameConsumer implementation. |
| 33 virtual void AllocateFrame(media::VideoFrame::Format format, | 32 virtual void ApplyBuffer(const SkISize& view_size, |
| 34 const SkISize& size, | 33 const SkIRect& clip_area, |
| 35 scoped_refptr<media::VideoFrame>* frame_out, | 34 pp::ImageData* buffer, |
| 36 const base::Closure& done) OVERRIDE; | 35 const SkRegion& region) OVERRIDE; |
| 37 virtual void ReleaseFrame(media::VideoFrame* frame) OVERRIDE; | 36 virtual void ReturnBuffer(pp::ImageData* buffer) OVERRIDE; |
| 38 virtual void OnPartialFrameOutput(media::VideoFrame* frame, | 37 virtual void SetSourceSize(const SkISize& source_size) OVERRIDE; |
| 39 SkRegion* region, | 38 |
| 40 const base::Closure& done) OVERRIDE; | 39 // Attaches to |frame_consumer_|. |
| 40 // This must only be called from |frame_consumer_message_loop_|. |
| 41 void Attach(FrameConsumer* frame_consumer); |
| 41 | 42 |
| 42 // Detaches from |frame_consumer_|, ensuring no further calls reach it. | 43 // Detaches from |frame_consumer_|, ensuring no further calls reach it. |
| 43 // This must only be called from |frame_consumer_message_loop_|. | 44 // This must only be called from |frame_consumer_message_loop_|. |
| 44 void Detach(); | 45 void Detach(); |
| 45 | 46 |
| 46 private: | 47 private: |
| 47 FrameConsumer* frame_consumer_; | 48 FrameConsumer* frame_consumer_; |
| 48 | 49 |
| 49 scoped_refptr<base::MessageLoopProxy> frame_consumer_message_loop_; | 50 scoped_refptr<base::MessageLoopProxy> frame_consumer_message_loop_; |
| 50 | 51 |
| 51 DISALLOW_COPY_AND_ASSIGN(FrameConsumerProxy); | 52 DISALLOW_COPY_AND_ASSIGN(FrameConsumerProxy); |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 } // namespace remoting | 55 } // namespace remoting |
| 55 | 56 |
| 56 #endif // REMOTING_CLIENT_FRAME_CONSUMER_PROXY_H_ | 57 #endif // REMOTING_CLIENT_FRAME_CONSUMER_PROXY_H_ |
| OLD | NEW |