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

Unified Diff: webrtc/modules/desktop_capture/desktop_and_cursor_composer.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/desktop_and_cursor_composer.cc
diff --git a/webrtc/modules/desktop_capture/desktop_and_cursor_composer.cc b/webrtc/modules/desktop_capture/desktop_and_cursor_composer.cc
index a4deda6ae95b915039735fafa7dfe1d454ab3923..4c6e27e561eaa19794df980f63bf9028924b697f 100644
--- a/webrtc/modules/desktop_capture/desktop_and_cursor_composer.cc
+++ b/webrtc/modules/desktop_capture/desktop_and_cursor_composer.cc
@@ -57,7 +57,7 @@
class DesktopFrameWithCursor : public DesktopFrame {
public:
// Takes ownership of |frame|.
- DesktopFrameWithCursor(std::unique_ptr<DesktopFrame> frame,
+ DesktopFrameWithCursor(DesktopFrame* frame,
const MouseCursor& cursor,
const DesktopVector& position);
virtual ~DesktopFrameWithCursor();
@@ -71,18 +71,15 @@
RTC_DISALLOW_COPY_AND_ASSIGN(DesktopFrameWithCursor);
};
-DesktopFrameWithCursor::DesktopFrameWithCursor(
- std::unique_ptr<DesktopFrame> frame,
- const MouseCursor& cursor,
- const DesktopVector& position)
- : DesktopFrame(frame->size(),
- frame->stride(),
- frame->data(),
- frame->shared_memory()) {
+DesktopFrameWithCursor::DesktopFrameWithCursor(DesktopFrame* frame,
+ const MouseCursor& cursor,
+ const DesktopVector& position)
+ : DesktopFrame(frame->size(), frame->stride(),
+ frame->data(), frame->shared_memory()),
+ original_frame_(frame) {
set_dpi(frame->dpi());
set_capture_time_ms(frame->capture_time_ms());
mutable_updated_region()->Swap(frame->mutable_updated_region());
- original_frame_ = std::move(frame);
DesktopVector image_pos = position.subtract(cursor.hotspot());
DesktopRect target_rect = DesktopRect::MakeSize(cursor.image()->size());
@@ -155,15 +152,14 @@
desktop_capturer_->SetExcludedWindow(window);
}
-void DesktopAndCursorComposer::OnCaptureResult(
- DesktopCapturer::Result result,
- std::unique_ptr<DesktopFrame> frame) {
- if (frame && cursor_ && cursor_state_ == MouseCursorMonitor::INSIDE) {
- frame = std::unique_ptr<DesktopFrameWithCursor>(new DesktopFrameWithCursor(
- std::move(frame), *cursor_, cursor_position_));
+void DesktopAndCursorComposer::OnCaptureCompleted(DesktopFrame* frame) {
+ if (frame && cursor_.get() && cursor_state_ == MouseCursorMonitor::INSIDE) {
+ DesktopFrameWithCursor* frame_with_cursor =
+ new DesktopFrameWithCursor(frame, *cursor_, cursor_position_);
+ frame = frame_with_cursor;
}
- callback_->OnCaptureResult(result, std::move(frame));
+ callback_->OnCaptureCompleted(frame);
}
void DesktopAndCursorComposer::OnMouseCursor(MouseCursor* cursor) {

Powered by Google App Engine
This is Rietveld 408576698