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

Unified Diff: webrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.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, 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_unittest.cc
diff --git a/webrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc b/webrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc
index 6652a1af71e1125e02bfca000539cbdf2a45e971..9e89439b6fd233ba590538f1207ac34301e38bf4 100644
--- a/webrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc
+++ b/webrtc/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc
@@ -78,15 +78,17 @@ class FakeScreenCapturer : public DesktopCapturer {
void Start(Callback* callback) override { callback_ = callback; }
void Capture(const DesktopRegion& region) override {
- callback_->OnCaptureCompleted(next_frame_.release());
+ callback_->OnCaptureResult(
+ next_frame_ ? Result::SUCCESS : Result::ERROR_TEMPORARY,
+ std::move(next_frame_));
}
- void SetNextFrame(DesktopFrame* next_frame) {
- next_frame_.reset(next_frame);
+ void SetNextFrame(std::unique_ptr<DesktopFrame> next_frame) {
+ next_frame_ = std::move(next_frame);
}
private:
- Callback* callback_;
+ Callback* callback_ = nullptr;
std::unique_ptr<DesktopFrame> next_frame_;
};
@@ -165,11 +167,13 @@ class DesktopAndCursorComposerTest : public testing::Test,
DesktopAndCursorComposerTest()
: fake_screen_(new FakeScreenCapturer()),
fake_cursor_(new FakeMouseMonitor()),
- blender_(fake_screen_, fake_cursor_) {
- }
+ blender_(fake_screen_, fake_cursor_) {}
// DesktopCapturer::Callback interface
- void OnCaptureCompleted(DesktopFrame* frame) override { frame_.reset(frame); }
+ void OnCaptureResult(DesktopCapturer::Result result,
+ std::unique_ptr<DesktopFrame> frame) override {
+ frame_ = std::move(frame);
+ }
protected:
// Owned by |blender_|.
@@ -187,7 +191,7 @@ TEST_F(DesktopAndCursorComposerTest, Error) {
fake_cursor_->SetHotspot(DesktopVector());
fake_cursor_->SetState(MouseCursorMonitor::INSIDE, DesktopVector());
- fake_screen_->SetNextFrame(NULL);
+ fake_screen_->SetNextFrame(nullptr);
blender_.Capture(DesktopRegion());
« no previous file with comments | « webrtc/modules/desktop_capture/desktop_and_cursor_composer.cc ('k') | webrtc/modules/desktop_capture/desktop_capturer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698