Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Side by Side Diff: webrtc/modules/desktop_capture/desktop_capturer.h

Issue 1988783003: Use std::unique_ptr<> to pass frame ownership in DesktopCapturer impls. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_ 11 #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_
12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_ 12 #define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_
13 13
14 #include <stddef.h> 14 #include <stddef.h>
15 15
16 #include <memory> 16 #include <memory>
17 17
18 #include "webrtc/modules/desktop_capture/desktop_frame.h"
18 #include "webrtc/modules/desktop_capture/desktop_capture_types.h" 19 #include "webrtc/modules/desktop_capture/desktop_capture_types.h"
19 #include "webrtc/modules/desktop_capture/shared_memory.h" 20 #include "webrtc/modules/desktop_capture/shared_memory.h"
20 21
21 namespace webrtc { 22 namespace webrtc {
22 23
23 class DesktopFrame; 24 class DesktopFrame;
24 class DesktopRegion;
25 25
26 // Abstract interface for screen and window capturers. 26 // Abstract interface for screen and window capturers.
27 class DesktopCapturer { 27 class DesktopCapturer {
28 public: 28 public:
29 // Interface that must be implemented by the DesktopCapturer consumers. 29 // Interface that must be implemented by the DesktopCapturer consumers.
30 class Callback { 30 class Callback {
31 public: 31 public:
32 // Called after a frame has been captured. Handler must take ownership of 32 // Called after a frame has been captured. If capture has failed for any
33 // |frame|. If capture has failed for any reason |frame| is set to NULL 33 // reason |frame| is set to NULL (e.g. the window has been closed).
34 // (e.g. the window has been closed). 34 virtual void OnCaptureCompleted(std::unique_ptr<DesktopFrame> frame) {
35 virtual void OnCaptureCompleted(DesktopFrame* frame) = 0; 35 OnCaptureCompleted(frame.release());
36 }
37
38 // Deprecated version of the method above that uses raw pointer instead of
39 // std::unique_ptr<>.
40 // TODO(sergeyu): Remove all overrides for this method and make the one
41 // above pure virtual.
Wez 2016/05/18 01:29:50 Is there a bug # for that work, that you can refer
Sergey Ulanov 2016/05/31 12:02:48 Opened crbug.com/webrtc/5950
42 virtual void OnCaptureCompleted(DesktopFrame* frame) { delete frame; };
36 43
37 protected: 44 protected:
38 virtual ~Callback() {} 45 virtual ~Callback() {}
39 }; 46 };
40 47
41 virtual ~DesktopCapturer() {} 48 virtual ~DesktopCapturer() {}
42 49
43 // Called at the beginning of a capturing session. |callback| must remain 50 // Called at the beginning of a capturing session. |callback| must remain
44 // valid until capturer is destroyed. 51 // valid until capturer is destroyed.
45 virtual void Start(Callback* callback) = 0; 52 virtual void Start(Callback* callback) = 0;
(...skipping 16 matching lines...) Expand all
62 // Sets the window to be excluded from the captured image in the future 69 // Sets the window to be excluded from the captured image in the future
63 // Capture calls. Used to exclude the screenshare notification window for 70 // Capture calls. Used to exclude the screenshare notification window for
64 // screen capturing. 71 // screen capturing.
65 virtual void SetExcludedWindow(WindowId window) {} 72 virtual void SetExcludedWindow(WindowId window) {}
66 }; 73 };
67 74
68 } // namespace webrtc 75 } // namespace webrtc
69 76
70 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_ 77 #endif // WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURER_H_
71 78
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698