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

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

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/cropping_window_capturer.cc
diff --git a/webrtc/modules/desktop_capture/cropping_window_capturer.cc b/webrtc/modules/desktop_capture/cropping_window_capturer.cc
index cbe7d96e5d637d579799cdf1581a76ef48ed5cd1..6e4a16b62e51fc1d89723b8231c889efec93dbc3 100644
--- a/webrtc/modules/desktop_capture/cropping_window_capturer.cc
+++ b/webrtc/modules/desktop_capture/cropping_window_capturer.cc
@@ -74,31 +74,29 @@ bool CroppingWindowCapturer::BringSelectedWindowToFront() {
return window_capturer_->BringSelectedWindowToFront();
}
-void CroppingWindowCapturer::OnCaptureCompleted(DesktopFrame* frame) {
- std::unique_ptr<DesktopFrame> screen_frame(frame);
-
+void CroppingWindowCapturer::OnCaptureCompleted(
+ std::unique_ptr<DesktopFrame> screen_frame) {
if (!ShouldUseScreenCapturer()) {
LOG(LS_INFO) << "Window no longer on top when ScreenCapturer finishes";
window_capturer_->Capture(DesktopRegion());
return;
}
- if (!frame) {
+ if (!screen_frame) {
LOG(LS_WARNING) << "ScreenCapturer failed to capture a frame";
- callback_->OnCaptureCompleted(NULL);
+ callback_->OnCaptureCompleted(std::unique_ptr<DesktopFrame>());
return;
}
DesktopRect window_rect = GetWindowRectInVirtualScreen();
if (window_rect.is_empty()) {
LOG(LS_WARNING) << "Window rect is empty";
- callback_->OnCaptureCompleted(NULL);
+ callback_->OnCaptureCompleted(std::unique_ptr<DesktopFrame>());
return;
}
- std::unique_ptr<DesktopFrame> window_frame(
- CreateCroppedDesktopFrame(screen_frame.release(), window_rect));
- callback_->OnCaptureCompleted(window_frame.release());
+ callback_->OnCaptureCompleted(
+ CreateCroppedDesktopFrame(std::move(screen_frame), window_rect));
}
#if !defined(WEBRTC_WIN)

Powered by Google App Engine
This is Rietveld 408576698