OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef REMOTING_HOST_SCREEN_CAPTURER_PROXY_H_ | |
6 #define REMOTING_HOST_SCREEN_CAPTURER_PROXY_H_ | |
7 | |
8 #include "base/callback.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/memory/weak_ptr.h" | |
11 | |
12 namespace base { | |
13 class SingleThreadTaskRunner; | |
14 } // namespace base | |
15 | |
16 namespace webrtc { | |
17 class DesktopCapturer; | |
18 class DesktopFrame; | |
19 } // namespace webrtc | |
20 | |
21 namespace remoting { | |
22 | |
23 namespace protocol { | |
24 class CursorShapeInfo; | |
25 } // namespace protocol | |
26 | |
27 // ScreenCapturerProxy is responsible for calling webrtc::DesktopCapturer on the | |
28 // capturer thread and then returning results to the network thread. | |
29 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
| |
30 public: | |
31 typedef base::Callback<void(scoped_ptr<webrtc::DesktopFrame> frame)> | |
32 FrameCapturedCallback; | |
33 | |
34 ScreenCapturerProxy( | |
35 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.
| |
36 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, | |
37 scoped_ptr<webrtc::DesktopCapturer> capturer); | |
38 ~ScreenCapturerProxy(); | |
39 | |
40 // Initializes the capturer. Specified callback are not called until Capture() | |
41 // is called. | |
42 void Init(const FrameCapturedCallback& frame_captured_callback); | |
43 | |
44 // Captures a new frame on the capture thread and then calls | |
45 // |frame_captured_callback|. | |
46 void Capture(); | |
47 | |
48 private: | |
49 class Core; | |
50 | |
51 void OnFrameCaptured(scoped_ptr<webrtc::DesktopFrame> frame); | |
52 | |
53 scoped_ptr<Core> core_; | |
54 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.
| |
55 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_; | |
56 FrameCapturedCallback frame_captured_callback_; | |
57 | |
58 base::WeakPtrFactory<ScreenCapturerProxy> weak_factory_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(ScreenCapturerProxy); | |
61 }; | |
62 | |
63 } // namespace remoting | |
64 | |
65 #endif // REMOTING_HOST_SCREEN_CAPTURER_PROXY_H_ | |
OLD | NEW |