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_ |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace remoting { | 21 namespace remoting { |
22 | 22 |
23 class FrameConsumerProxy | 23 class FrameConsumerProxy |
24 : public base::RefCountedThreadSafe<FrameConsumerProxy>, | 24 : public base::RefCountedThreadSafe<FrameConsumerProxy>, |
25 public FrameConsumer { | 25 public FrameConsumer { |
26 public: | 26 public: |
27 // Constructs a proxy for |frame_consumer| which will trampoline invocations | 27 // Constructs a proxy for |frame_consumer| which will trampoline invocations |
28 // to |frame_consumer_message_loop|. | 28 // to |frame_consumer_message_loop|. |
29 FrameConsumerProxy( | 29 FrameConsumerProxy( |
30 scoped_refptr<base::MessageLoopProxy> frame_consumer_message_loop); | 30 scoped_refptr<base::MessageLoopProxy> frame_consumer_message_loop); |
31 virtual ~FrameConsumerProxy(); | |
32 | 31 |
33 // FrameConsumer implementation. | 32 // FrameConsumer implementation. |
34 virtual void ApplyBuffer(const SkISize& view_size, | 33 virtual void ApplyBuffer(const SkISize& view_size, |
35 const SkIRect& clip_area, | 34 const SkIRect& clip_area, |
36 pp::ImageData* buffer, | 35 pp::ImageData* buffer, |
37 const SkRegion& region) OVERRIDE; | 36 const SkRegion& region) OVERRIDE; |
38 virtual void ReturnBuffer(pp::ImageData* buffer) OVERRIDE; | 37 virtual void ReturnBuffer(pp::ImageData* buffer) OVERRIDE; |
39 virtual void SetSourceSize(const SkISize& source_size) OVERRIDE; | 38 virtual void SetSourceSize(const SkISize& source_size) OVERRIDE; |
40 | 39 |
41 // Attaches to |frame_consumer_|. | 40 // Attaches to |frame_consumer_|. |
42 // This must only be called from |frame_consumer_message_loop_|. | 41 // This must only be called from |frame_consumer_message_loop_|. |
43 void Attach(const base::WeakPtr<FrameConsumer>& frame_consumer); | 42 void Attach(const base::WeakPtr<FrameConsumer>& frame_consumer); |
44 | 43 |
45 private: | 44 private: |
| 45 friend class base::RefCountedThreadSafe<FrameConsumerProxy>; |
| 46 virtual ~FrameConsumerProxy(); |
| 47 |
46 base::WeakPtr<FrameConsumer> frame_consumer_; | 48 base::WeakPtr<FrameConsumer> frame_consumer_; |
47 scoped_refptr<base::MessageLoopProxy> frame_consumer_message_loop_; | 49 scoped_refptr<base::MessageLoopProxy> frame_consumer_message_loop_; |
48 | 50 |
49 DISALLOW_COPY_AND_ASSIGN(FrameConsumerProxy); | 51 DISALLOW_COPY_AND_ASSIGN(FrameConsumerProxy); |
50 }; | 52 }; |
51 | 53 |
52 } // namespace remoting | 54 } // namespace remoting |
53 | 55 |
54 #endif // REMOTING_CLIENT_FRAME_CONSUMER_PROXY_H_ | 56 #endif // REMOTING_CLIENT_FRAME_CONSUMER_PROXY_H_ |
OLD | NEW |