Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(440)

Side by Side Diff: remoting/client/rectangle_update_decoder.h

Issue 10454018: MessageLoopProxy cleanups in remoting client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H_ 5 #ifndef REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H_
6 #define REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H_ 6 #define REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "remoting/base/decoder.h" 13 #include "remoting/base/decoder.h"
14 #include "remoting/client/frame_consumer_proxy.h" 14 #include "remoting/client/frame_consumer_proxy.h"
15 #include "remoting/client/frame_producer.h" 15 #include "remoting/client/frame_producer.h"
16 16
17 namespace base { 17 namespace base {
18 class MessageLoopProxy; 18 class SingleThreadTaskRunner;
19 } // namespace base 19 } // namespace base
20 20
21 namespace pp { 21 namespace pp {
22 class ImageData; 22 class ImageData;
23 }; 23 };
24 24
25 namespace remoting { 25 namespace remoting {
26 26
27 class VideoPacket; 27 class VideoPacket;
28 28
29 namespace protocol { 29 namespace protocol {
30 class SessionConfig; 30 class SessionConfig;
31 } // namespace protocol 31 } // namespace protocol
32 32
33 // TODO(ajwong): Re-examine this API, especially with regards to how error 33 // TODO(ajwong): Re-examine this API, especially with regards to how error
34 // conditions on each step are reported. Should they be CHECKs? Logs? Other? 34 // conditions on each step are reported. Should they be CHECKs? Logs? Other?
35 // TODO(sergeyu): Rename this class. 35 // TODO(sergeyu): Rename this class.
36 class RectangleUpdateDecoder : 36 class RectangleUpdateDecoder
37 public base::RefCountedThreadSafe<RectangleUpdateDecoder>, 37 : public base::RefCountedThreadSafe<RectangleUpdateDecoder>,
38 public FrameProducer { 38 public FrameProducer {
39 public: 39 public:
40 // Creates an update decoder on |message_loop_|, outputting to |consumer|. 40 // Creates an update decoder on |task_runner_|, outputting to |consumer|.
41 // TODO(wez): Replace the ref-counted proxy with an owned FrameConsumer. 41 // TODO(wez): Replace the ref-counted proxy with an owned FrameConsumer.
42 RectangleUpdateDecoder(scoped_refptr<base::MessageLoopProxy> message_loop, 42 RectangleUpdateDecoder(
43 scoped_refptr<FrameConsumerProxy> consumer); 43 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
44 scoped_refptr<FrameConsumerProxy> consumer);
44 45
45 // Initializes decoder with the information from the protocol config. 46 // Initializes decoder with the information from the protocol config.
46 void Initialize(const protocol::SessionConfig& config); 47 void Initialize(const protocol::SessionConfig& config);
47 48
48 // Decodes the contents of |packet|. DecodePacket may keep a reference to 49 // Decodes the contents of |packet|. DecodePacket may keep a reference to
49 // |packet| so the |packet| must remain alive and valid until |done| is 50 // |packet| so the |packet| must remain alive and valid until |done| is
50 // executed. 51 // executed.
51 void DecodePacket(scoped_ptr<VideoPacket> packet, const base::Closure& done); 52 void DecodePacket(scoped_ptr<VideoPacket> packet, const base::Closure& done);
52 53
53 // FrameProducer implementation. These methods may be called before we are 54 // FrameProducer implementation. These methods may be called before we are
54 // Initialize()d, or we know the source screen size. 55 // Initialize()d, or we know the source screen size.
55 virtual void DrawBuffer(pp::ImageData* buffer) OVERRIDE; 56 virtual void DrawBuffer(pp::ImageData* buffer) OVERRIDE;
56 virtual void InvalidateRegion(const SkRegion& region) OVERRIDE; 57 virtual void InvalidateRegion(const SkRegion& region) OVERRIDE;
57 virtual void RequestReturnBuffers(const base::Closure& done) OVERRIDE; 58 virtual void RequestReturnBuffers(const base::Closure& done) OVERRIDE;
58 virtual void SetOutputSizeAndClip(const SkISize& view_size, 59 virtual void SetOutputSizeAndClip(const SkISize& view_size,
59 const SkIRect& clip_area) OVERRIDE; 60 const SkIRect& clip_area) OVERRIDE;
60 61
61 private: 62 private:
62 friend class base::RefCountedThreadSafe<RectangleUpdateDecoder>; 63 friend class base::RefCountedThreadSafe<RectangleUpdateDecoder>;
63 virtual ~RectangleUpdateDecoder(); 64 virtual ~RectangleUpdateDecoder();
64 65
65 // Paints the invalidated region to the next available buffer and returns it 66 // Paints the invalidated region to the next available buffer and returns it
66 // to the consumer. 67 // to the consumer.
67 void SchedulePaint(); 68 void SchedulePaint();
68 void DoPaint(); 69 void DoPaint();
69 70
70 scoped_refptr<base::MessageLoopProxy> message_loop_; 71 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
71 scoped_refptr<FrameConsumerProxy> consumer_; 72 scoped_refptr<FrameConsumerProxy> consumer_;
72 scoped_ptr<Decoder> decoder_; 73 scoped_ptr<Decoder> decoder_;
73 74
74 // Remote screen size in pixels. 75 // Remote screen size in pixels.
75 SkISize source_size_; 76 SkISize source_size_;
76 77
77 // The current dimentions of the frame consumer view. 78 // The current dimentions of the frame consumer view.
78 SkISize view_size_; 79 SkISize view_size_;
79 SkIRect clip_area_; 80 SkIRect clip_area_;
80 81
81 // The drawing buffers supplied by the frame consumer. 82 // The drawing buffers supplied by the frame consumer.
82 std::list<pp::ImageData*> buffers_; 83 std::list<pp::ImageData*> buffers_;
83 84
84 // Flag used to coalesce runs of SchedulePaint()s into a single DoPaint(). 85 // Flag used to coalesce runs of SchedulePaint()s into a single DoPaint().
85 bool paint_scheduled_; 86 bool paint_scheduled_;
86 }; 87 };
87 88
88 } // namespace remoting 89 } // namespace remoting
89 90
90 #endif // REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H_ 91 #endif // REMOTING_CLIENT_RECTANGLE_UPDATE_DECODER_H_
OLDNEW
« no previous file with comments | « remoting/client/plugin/pepper_xmpp_proxy.cc ('k') | remoting/client/rectangle_update_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698