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

Side by Side Diff: remoting/host/capturer.h

Issue 4971003: Inject MessageLoop into Capturer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years, 1 month 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_HOST_CAPTURER_H_ 5 #ifndef REMOTING_HOST_CAPTURER_H_
6 #define REMOTING_HOST_CAPTURER_H_ 6 #define REMOTING_HOST_CAPTURER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/lock.h" 10 #include "base/lock.h"
11 #include "base/task.h" 11 #include "base/task.h"
12 #include "remoting/base/capture_data.h" 12 #include "remoting/base/capture_data.h"
13 #include "remoting/base/types.h" 13 #include "remoting/base/types.h"
14 14
15 class MessageLoop;
16
15 namespace remoting { 17 namespace remoting {
16 18
17 // A class to perform the task of capturing the image of a window. 19 // A class to perform the task of capturing the image of a window.
18 // The capture action is asynchronous to allow maximum throughput. 20 // The capture action is asynchronous to allow maximum throughput.
19 // 21 //
20 // The full capture process is as follows: 22 // The full capture process is as follows:
21 // 23 //
22 // (1) InvalidateRects 24 // (1) InvalidateRects
23 // This is an optional step where regions of the screen are marked as 25 // This is an optional step where regions of the screen are marked as
24 // invalid. Some platforms (Windows, for now) won't use this and will 26 // invalid. Some platforms (Windows, for now) won't use this and will
(...skipping 10 matching lines...) Expand all
35 // Mac version does not. 37 // Mac version does not.
36 // 38 //
37 // Implementation has to ensure the following guarantees: 39 // Implementation has to ensure the following guarantees:
38 // 1. Double buffering 40 // 1. Double buffering
39 // Since data can be read while another capture action is happening. 41 // Since data can be read while another capture action is happening.
40 class Capturer { 42 class Capturer {
41 public: 43 public:
42 // CaptureCompletedCallback is called when the capturer has completed. 44 // CaptureCompletedCallback is called when the capturer has completed.
43 typedef Callback1<scoped_refptr<CaptureData> >::Type CaptureCompletedCallback; 45 typedef Callback1<scoped_refptr<CaptureData> >::Type CaptureCompletedCallback;
44 46
45 Capturer(); 47 Capturer(MessageLoop* message_loop);
awong 2010/11/16 00:42:12 explicit
46 virtual ~Capturer(); 48 virtual ~Capturer();
47 49
48 // Called when the screen configuration is changed. 50 // Called when the screen configuration is changed.
49 virtual void ScreenConfigurationChanged() = 0; 51 virtual void ScreenConfigurationChanged() = 0;
50 52
51 // Return the width of the screen. 53 // Return the width of the screen.
52 virtual int width() const; 54 virtual int width() const;
53 55
54 // Return the height of the screen. 56 // Return the height of the screen.
55 virtual int height() const; 57 virtual int height() const;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 int width_; 117 int width_;
116 int height_; 118 int height_;
117 119
118 // Format of pixels returned in buffer. 120 // Format of pixels returned in buffer.
119 media::VideoFrame::Format pixel_format_; 121 media::VideoFrame::Format pixel_format_;
120 int bytes_per_row_; 122 int bytes_per_row_;
121 123
122 // The current buffer with valid data for reading. 124 // The current buffer with valid data for reading.
123 int current_buffer_; 125 int current_buffer_;
124 126
127 // Message loop that operations should run on.
128 MessageLoop* message_loop_;
129
125 private: 130 private:
126 // Rects that have been manually invalidated (through InvalidateRect). 131 // Rects that have been manually invalidated (through InvalidateRect).
127 // These will be returned as dirty_rects in the capture data during the next 132 // These will be returned as dirty_rects in the capture data during the next
128 // capture. 133 // capture.
129 InvalidRects inval_rects_; 134 InvalidRects inval_rects_;
130 135
131 // A lock protecting |inval_rects_| across threads. 136 // A lock protecting |inval_rects_| across threads.
132 Lock inval_rects_lock_; 137 Lock inval_rects_lock_;
133 }; 138 };
134 139
135 } // namespace remoting 140 } // namespace remoting
136 141
137 #endif // REMOTING_HOST_CAPTURER_H_ 142 #endif // REMOTING_HOST_CAPTURER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698