| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_old.h" | 9 #include "base/callback.h" |
| 10 #include "remoting/base/capture_data.h" | 10 #include "remoting/base/capture_data.h" |
| 11 #include "third_party/skia/include/core/SkRegion.h" | 11 #include "third_party/skia/include/core/SkRegion.h" |
| 12 | 12 |
| 13 namespace remoting { | 13 namespace remoting { |
| 14 | 14 |
| 15 // A class to perform the task of capturing the image of a window. | 15 // A class to perform the task of capturing the image of a window. |
| 16 // The capture action is asynchronous to allow maximum throughput. | 16 // The capture action is asynchronous to allow maximum throughput. |
| 17 // | 17 // |
| 18 // The full capture process is as follows: | 18 // The full capture process is as follows: |
| 19 // | 19 // |
| (...skipping 11 matching lines...) Expand all Loading... |
| 31 // A screen capture is performed if needed. For example, Windows requires | 31 // A screen capture is performed if needed. For example, Windows requires |
| 32 // a capture to calculate the diff from the previous screen, whereas the | 32 // a capture to calculate the diff from the previous screen, whereas the |
| 33 // Mac version does not. | 33 // Mac version does not. |
| 34 // | 34 // |
| 35 // Implementation has to ensure the following guarantees: | 35 // Implementation has to ensure the following guarantees: |
| 36 // 1. Double buffering | 36 // 1. Double buffering |
| 37 // Since data can be read while another capture action is happening. | 37 // Since data can be read while another capture action is happening. |
| 38 class Capturer { | 38 class Capturer { |
| 39 public: | 39 public: |
| 40 // CaptureCompletedCallback is called when the capturer has completed. | 40 // CaptureCompletedCallback is called when the capturer has completed. |
| 41 typedef Callback1<scoped_refptr<CaptureData> >::Type CaptureCompletedCallback; | 41 typedef base::Callback<void(scoped_refptr<CaptureData>)> |
| 42 CaptureCompletedCallback; |
| 42 | 43 |
| 43 virtual ~Capturer() {}; | 44 virtual ~Capturer() {}; |
| 44 | 45 |
| 45 // Create platform-specific capturer. | 46 // Create platform-specific capturer. |
| 46 static Capturer* Create(); | 47 static Capturer* Create(); |
| 47 | 48 |
| 48 // Called when the screen configuration is changed. | 49 // Called when the screen configuration is changed. |
| 49 virtual void ScreenConfigurationChanged() = 0; | 50 virtual void ScreenConfigurationChanged() = 0; |
| 50 | 51 |
| 51 // Return the pixel format of the screen. | 52 // Return the pixel format of the screen. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 66 | 67 |
| 67 // Capture the screen data associated with each of the accumulated | 68 // Capture the screen data associated with each of the accumulated |
| 68 // dirty region. | 69 // dirty region. |
| 69 // When the capture is complete, |callback| is called even if the dirty region | 70 // When the capture is complete, |callback| is called even if the dirty region |
| 70 // is empty. | 71 // is empty. |
| 71 // | 72 // |
| 72 // It is OK to call this method while another thread is reading | 73 // It is OK to call this method while another thread is reading |
| 73 // data of the previous capture. | 74 // data of the previous capture. |
| 74 // There can be at most one concurrent read going on when this | 75 // There can be at most one concurrent read going on when this |
| 75 // method is called. | 76 // method is called. |
| 76 virtual void CaptureInvalidRegion(CaptureCompletedCallback* callback) = 0; | 77 virtual void CaptureInvalidRegion( |
| 78 const CaptureCompletedCallback& callback) = 0; |
| 77 | 79 |
| 78 // Get the size of the most recently captured screen. | 80 // Get the size of the most recently captured screen. |
| 79 virtual const SkISize& size_most_recent() const = 0; | 81 virtual const SkISize& size_most_recent() const = 0; |
| 80 }; | 82 }; |
| 81 | 83 |
| 82 } // namespace remoting | 84 } // namespace remoting |
| 83 | 85 |
| 84 #endif // REMOTING_HOST_CAPTURER_H_ | 86 #endif // REMOTING_HOST_CAPTURER_H_ |
| OLD | NEW |