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

Unified Diff: webrtc/modules/desktop_capture/cropped_desktop_frame.cc

Issue 2030333003: Revert of 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, 6 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/cropped_desktop_frame.cc
diff --git a/webrtc/modules/desktop_capture/cropped_desktop_frame.cc b/webrtc/modules/desktop_capture/cropped_desktop_frame.cc
index b26d5b0600acf27da8d7cdf4044e93605e66c589..733fe9b2adf5dc244087a04411305f7dff63afb3 100644
--- a/webrtc/modules/desktop_capture/cropped_desktop_frame.cc
+++ b/webrtc/modules/desktop_capture/cropped_desktop_frame.cc
@@ -19,8 +19,7 @@
// A DesktopFrame that is a sub-rect of another DesktopFrame.
class CroppedDesktopFrame : public DesktopFrame {
public:
- CroppedDesktopFrame(std::unique_ptr<DesktopFrame> frame,
- const DesktopRect& rect);
+ CroppedDesktopFrame(DesktopFrame* frame, const DesktopRect& rect);
private:
std::unique_ptr<DesktopFrame> frame_;
@@ -28,23 +27,23 @@
RTC_DISALLOW_COPY_AND_ASSIGN(CroppedDesktopFrame);
};
-std::unique_ptr<DesktopFrame> CreateCroppedDesktopFrame(
- std::unique_ptr<DesktopFrame> frame,
- const DesktopRect& rect) {
- if (!DesktopRect::MakeSize(frame->size()).ContainsRect(rect))
- return nullptr;
+DesktopFrame*
+CreateCroppedDesktopFrame(DesktopFrame* frame, const DesktopRect& rect) {
+ if (!DesktopRect::MakeSize(frame->size()).ContainsRect(rect)) {
+ delete frame;
+ return NULL;
+ }
- return std::unique_ptr<DesktopFrame>(
- new CroppedDesktopFrame(std::move(frame), rect));
+ return new CroppedDesktopFrame(frame, rect);
}
-CroppedDesktopFrame::CroppedDesktopFrame(std::unique_ptr<DesktopFrame> frame,
+CroppedDesktopFrame::CroppedDesktopFrame(DesktopFrame* frame,
const DesktopRect& rect)
: DesktopFrame(rect.size(),
frame->stride(),
frame->GetFrameDataAtPos(rect.top_left()),
- frame->shared_memory()) {
- frame_ = std::move(frame);
+ frame->shared_memory()),
+ frame_(frame) {
}
} // namespace webrtc
« no previous file with comments | « webrtc/modules/desktop_capture/cropped_desktop_frame.h ('k') | webrtc/modules/desktop_capture/cropping_window_capturer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698