OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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_DESKTOP_CAPTURER_PROXY_H_ | 5 #ifndef REMOTING_HOST_DESKTOP_CAPTURER_PROXY_H_ |
6 #define REMOTING_HOST_DESKTOP_CAPTURER_PROXY_H_ | 6 #define REMOTING_HOST_DESKTOP_CAPTURER_PROXY_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/callback.h" | 10 #include "base/callback.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
12 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
13 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" | 14 #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h" |
14 | 15 |
15 namespace base { | 16 namespace base { |
16 class SingleThreadTaskRunner; | 17 class SingleThreadTaskRunner; |
17 } // namespace base | 18 } // namespace base |
18 | 19 |
19 namespace remoting { | 20 namespace remoting { |
20 | 21 |
21 namespace protocol { | 22 namespace protocol { |
22 class CursorShapeInfo; | 23 class CursorShapeInfo; |
23 } // namespace protocol | 24 } // namespace protocol |
24 | 25 |
25 // DesktopCapturerProxy is responsible for calling webrtc::DesktopCapturer on | 26 // DesktopCapturerProxy is responsible for calling webrtc::DesktopCapturer on |
26 // the capturer thread and then returning results to the caller's thread. | 27 // the capturer thread and then returning results to the caller's thread. |
27 class DesktopCapturerProxy : public webrtc::DesktopCapturer { | 28 class DesktopCapturerProxy : public webrtc::DesktopCapturer { |
28 public: | 29 public: |
29 DesktopCapturerProxy( | 30 DesktopCapturerProxy( |
30 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, | 31 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, |
31 scoped_ptr<webrtc::DesktopCapturer> capturer); | 32 std::unique_ptr<webrtc::DesktopCapturer> capturer); |
32 ~DesktopCapturerProxy() override; | 33 ~DesktopCapturerProxy() override; |
33 | 34 |
34 // webrtc::DesktopCapturer interface. | 35 // webrtc::DesktopCapturer interface. |
35 void Start(Callback* callback) override; | 36 void Start(Callback* callback) override; |
36 void SetSharedMemoryFactory(rtc::scoped_ptr<webrtc::SharedMemoryFactory> | 37 void SetSharedMemoryFactory(rtc::scoped_ptr<webrtc::SharedMemoryFactory> |
37 shared_memory_factory) override; | 38 shared_memory_factory) override; |
38 void Capture(const webrtc::DesktopRegion& rect) override; | 39 void Capture(const webrtc::DesktopRegion& rect) override; |
39 | 40 |
40 private: | 41 private: |
41 class Core; | 42 class Core; |
42 | 43 |
43 void OnFrameCaptured(scoped_ptr<webrtc::DesktopFrame> frame); | 44 void OnFrameCaptured(std::unique_ptr<webrtc::DesktopFrame> frame); |
44 | 45 |
45 base::ThreadChecker thread_checker_; | 46 base::ThreadChecker thread_checker_; |
46 | 47 |
47 scoped_ptr<Core> core_; | 48 std::unique_ptr<Core> core_; |
48 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_; | 49 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner_; |
49 webrtc::DesktopCapturer::Callback* callback_; | 50 webrtc::DesktopCapturer::Callback* callback_; |
50 | 51 |
51 base::WeakPtrFactory<DesktopCapturerProxy> weak_factory_; | 52 base::WeakPtrFactory<DesktopCapturerProxy> weak_factory_; |
52 | 53 |
53 DISALLOW_COPY_AND_ASSIGN(DesktopCapturerProxy); | 54 DISALLOW_COPY_AND_ASSIGN(DesktopCapturerProxy); |
54 }; | 55 }; |
55 | 56 |
56 } // namespace remoting | 57 } // namespace remoting |
57 | 58 |
58 #endif // REMOTING_HOST_DESKTOP_CAPTURER_PROXY_H_ | 59 #endif // REMOTING_HOST_DESKTOP_CAPTURER_PROXY_H_ |
OLD | NEW |