| OLD | NEW |
| 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" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // Mac version does not. | 37 // Mac version does not. |
| 38 // | 38 // |
| 39 // Implementation has to ensure the following guarantees: | 39 // Implementation has to ensure the following guarantees: |
| 40 // 1. Double buffering | 40 // 1. Double buffering |
| 41 // Since data can be read while another capture action is happening. | 41 // Since data can be read while another capture action is happening. |
| 42 class Capturer { | 42 class Capturer { |
| 43 public: | 43 public: |
| 44 // CaptureCompletedCallback is called when the capturer has completed. | 44 // CaptureCompletedCallback is called when the capturer has completed. |
| 45 typedef Callback1<scoped_refptr<CaptureData> >::Type CaptureCompletedCallback; | 45 typedef Callback1<scoped_refptr<CaptureData> >::Type CaptureCompletedCallback; |
| 46 | 46 |
| 47 explicit Capturer(MessageLoop* message_loop); | |
| 48 virtual ~Capturer(); | 47 virtual ~Capturer(); |
| 49 | 48 |
| 49 // Create platform-specific cpaturer. |
| 50 static Capturer* Create(MessageLoop* message_loop); |
| 51 |
| 50 // Called when the screen configuration is changed. | 52 // Called when the screen configuration is changed. |
| 51 virtual void ScreenConfigurationChanged() = 0; | 53 virtual void ScreenConfigurationChanged() = 0; |
| 52 | 54 |
| 53 // Return the width of the screen. | 55 // Return the width of the screen. |
| 54 virtual int width() const; | 56 virtual int width() const; |
| 55 | 57 |
| 56 // Return the height of the screen. | 58 // Return the height of the screen. |
| 57 virtual int height() const; | 59 virtual int height() const; |
| 58 | 60 |
| 59 // Return the pixel format of the screen. | 61 // Return the pixel format of the screen. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 77 // If |inval_rects_| is empty, then this does nothing except | 79 // If |inval_rects_| is empty, then this does nothing except |
| 78 // call the |callback| routine. | 80 // call the |callback| routine. |
| 79 // | 81 // |
| 80 // It is OK to call this method while another thread is reading | 82 // It is OK to call this method while another thread is reading |
| 81 // data of the last capture. | 83 // data of the last capture. |
| 82 // There can be at most one concurrent read going on when this | 84 // There can be at most one concurrent read going on when this |
| 83 // method is called. | 85 // method is called. |
| 84 virtual void CaptureInvalidRects(CaptureCompletedCallback* callback); | 86 virtual void CaptureInvalidRects(CaptureCompletedCallback* callback); |
| 85 | 87 |
| 86 protected: | 88 protected: |
| 89 explicit Capturer(MessageLoop* message_loop); |
| 90 |
| 87 // Update the list of |invalid_rects| to prepare for capturing the | 91 // Update the list of |invalid_rects| to prepare for capturing the |
| 88 // screen data. | 92 // screen data. |
| 89 // Depending on the platform implementation, this routine might: | 93 // Depending on the platform implementation, this routine might: |
| 90 // (a) Analyze screen and calculate the list of rects that have changed | 94 // (a) Analyze screen and calculate the list of rects that have changed |
| 91 // since the last capture. | 95 // since the last capture. |
| 92 // (b) Merge already-acculumated rects into a more optimal list (for | 96 // (b) Merge already-acculumated rects into a more optimal list (for |
| 93 // example, by combining or removing rects). | 97 // example, by combining or removing rects). |
| 94 virtual void CalculateInvalidRects() = 0; | 98 virtual void CalculateInvalidRects() = 0; |
| 95 | 99 |
| 96 // Capture the specified screen rects and call |callback| when complete. | 100 // Capture the specified screen rects and call |callback| when complete. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // capture. | 137 // capture. |
| 134 InvalidRects inval_rects_; | 138 InvalidRects inval_rects_; |
| 135 | 139 |
| 136 // A lock protecting |inval_rects_| across threads. | 140 // A lock protecting |inval_rects_| across threads. |
| 137 Lock inval_rects_lock_; | 141 Lock inval_rects_lock_; |
| 138 }; | 142 }; |
| 139 | 143 |
| 140 } // namespace remoting | 144 } // namespace remoting |
| 141 | 145 |
| 142 #endif // REMOTING_HOST_CAPTURER_H_ | 146 #endif // REMOTING_HOST_CAPTURER_H_ |
| OLD | NEW |