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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/desktop_capture/desktop_capturer.h
diff --git a/webrtc/modules/desktop_capture/desktop_capturer.h b/webrtc/modules/desktop_capture/desktop_capturer.h
index ba70e0155373410475cff8b27a8362bae453b265..5752ad5f8a022bdfb8eeeace93a92d8f5338849c 100644
--- a/webrtc/modules/desktop_capture/desktop_capturer.h
+++ b/webrtc/modules/desktop_capture/desktop_capturer.h
@@ -15,13 +15,13 @@
#include <memory>
+#include "webrtc/modules/desktop_capture/desktop_frame.h"
#include "webrtc/modules/desktop_capture/desktop_capture_types.h"
#include "webrtc/modules/desktop_capture/shared_memory.h"
namespace webrtc {
class DesktopFrame;
-class DesktopRegion;
// Abstract interface for screen and window capturers.
class DesktopCapturer {
@@ -29,10 +29,17 @@ class DesktopCapturer {
// Interface that must be implemented by the DesktopCapturer consumers.
class Callback {
public:
- // Called after a frame has been captured. Handler must take ownership of
- // |frame|. If capture has failed for any reason |frame| is set to NULL
- // (e.g. the window has been closed).
- virtual void OnCaptureCompleted(DesktopFrame* frame) = 0;
+ // Called after a frame has been captured. If capture has failed for any
+ // reason |frame| is set to NULL (e.g. the window has been closed).
+ virtual void OnCaptureCompleted(std::unique_ptr<DesktopFrame> frame) {
+ OnCaptureCompleted(frame.release());
+ }
+
+ // Deprecated version of the method above that uses raw pointer instead of
+ // std::unique_ptr<>.
+ // TODO(sergeyu): Remove all overrides for this method and make the one
+ // 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
+ virtual void OnCaptureCompleted(DesktopFrame* frame) { delete frame; };
protected:
virtual ~Callback() {}

Powered by Google App Engine
This is Rietveld 408576698