Index: remoting/host/screen_capturer_proxy.h |
diff --git a/remoting/host/screen_capturer_proxy.h b/remoting/host/screen_capturer_proxy.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7287319652d3a0785bb2bf62735f2a061a3bece9 |
--- /dev/null |
+++ b/remoting/host/screen_capturer_proxy.h |
@@ -0,0 +1,65 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef REMOTING_HOST_SCREEN_CAPTURER_PROXY_H_ |
+#define REMOTING_HOST_SCREEN_CAPTURER_PROXY_H_ |
+ |
+#include "base/callback.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/memory/weak_ptr.h" |
+ |
+namespace base { |
+class SingleThreadTaskRunner; |
+} // namespace base |
+ |
+namespace webrtc { |
+class DesktopCapturer; |
+class DesktopFrame; |
+} // namespace webrtc |
+ |
+namespace remoting { |
+ |
+namespace protocol { |
+class CursorShapeInfo; |
+} // namespace protocol |
+ |
+// ScreenCapturerProxy is responsible for calling webrtc::DesktopCapturer on the |
+// capturer thread and then returning results to the network thread. |
+class ScreenCapturerProxy { |
Wez
2015/02/11 01:05:08
Why ScreenCapturerProxy, since it actually proxies
Sergey Ulanov
2015/02/11 19:21:35
Done.
Wez
2015/02/12 21:59:15
OK, cool; if you go ahead and derived from Desktop
|
+ public: |
+ typedef base::Callback<void(scoped_ptr<webrtc::DesktopFrame> frame)> |
+ FrameCapturedCallback; |
+ |
+ ScreenCapturerProxy( |
+ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, |
Wez
2015/02/11 01:05:07
This class doesn't do anything with the network; t
Sergey Ulanov
2015/02/11 19:21:35
Done.
|
+ scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, |
+ scoped_ptr<webrtc::DesktopCapturer> capturer); |
+ ~ScreenCapturerProxy(); |
+ |
+ // Initializes the capturer. Specified callback are not called until Capture() |
+ // is called. |
+ void Init(const FrameCapturedCallback& frame_captured_callback); |
+ |
+ // Captures a new frame on the capture thread and then calls |
+ // |frame_captured_callback|. |
+ void Capture(); |
+ |
+ private: |
+ class Core; |
+ |
+ void OnFrameCaptured(scoped_ptr<webrtc::DesktopFrame> frame); |
+ |
+ scoped_ptr<Core> core_; |
+ scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
Wez
2015/02/11 01:05:08
See above.
Sergey Ulanov
2015/02/11 19:21:35
Done.
|
+ scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_; |
+ FrameCapturedCallback frame_captured_callback_; |
+ |
+ base::WeakPtrFactory<ScreenCapturerProxy> weak_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ScreenCapturerProxy); |
+}; |
+ |
+} // namespace remoting |
+ |
+#endif // REMOTING_HOST_SCREEN_CAPTURER_PROXY_H_ |