Revert of Use std::unique_ptr<> to pass frame ownership in DesktopCapturer impls. (patchset #7 id:140001 of https://codereview.webrtc.org/1988783003/ )
Reason for revert: Broke chromium builder Original issue's description: > Use std::unique_ptr<> to pass frame ownership in DesktopCapturer impls. > > Previously raw pointers were used for owned DesktopFrame instances. > Updated all screen and window capturer implementations to use > std::unique_ptr<>. > > Also includes some other cleanups in the capturers: > - s/NULL/nullptr > - moved default initializers to class definition. > > BUG=webrtc:5950 > > Committed: https://crrev.com/4a627a8c13554d12412cabb8f751caee6e61ee32 > Cr-Commit-Position: refs/heads/master@{#13032} TBR=wez@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:5950 Review-Url: https://codereview.webrtc.org/2030333003 Cr-Commit-Position: refs/heads/master@{#13033}
This commit is contained in:
@ -32,13 +32,11 @@ namespace webrtc {
|
||||
class ScreenCapturerMacTest : public testing::Test {
|
||||
public:
|
||||
// Verifies that the whole screen is initially dirty.
|
||||
void CaptureDoneCallback1(DesktopCapturer::Result result,
|
||||
std::unique_ptr<DesktopFrame>* frame);
|
||||
void CaptureDoneCallback1(DesktopFrame* frame);
|
||||
|
||||
// Verifies that a rectangle explicitly marked as dirty is propagated
|
||||
// correctly.
|
||||
void CaptureDoneCallback2(DesktopCapturer::Result result,
|
||||
std::unique_ptr<DesktopFrame>* frame);
|
||||
void CaptureDoneCallback2(DesktopFrame* frame);
|
||||
|
||||
protected:
|
||||
void SetUp() override {
|
||||
@ -51,40 +49,37 @@ class ScreenCapturerMacTest : public testing::Test {
|
||||
};
|
||||
|
||||
void ScreenCapturerMacTest::CaptureDoneCallback1(
|
||||
DesktopCapturer::Result result,
|
||||
std::unique_ptr<DesktopFrame>* frame) {
|
||||
EXPECT_EQ(result, DesktopCapturer::Result::SUCCESS);
|
||||
DesktopFrame* frame) {
|
||||
std::unique_ptr<DesktopFrame> owned_frame(frame);
|
||||
|
||||
MacDesktopConfiguration config = MacDesktopConfiguration::GetCurrent(
|
||||
MacDesktopConfiguration::BottomLeftOrigin);
|
||||
|
||||
// Verify that the region contains full frame.
|
||||
DesktopRegion::Iterator it((*frame)->updated_region());
|
||||
DesktopRegion::Iterator it(frame->updated_region());
|
||||
EXPECT_TRUE(!it.IsAtEnd() && it.rect().equals(config.pixel_bounds));
|
||||
}
|
||||
|
||||
void ScreenCapturerMacTest::CaptureDoneCallback2(
|
||||
DesktopCapturer::Result result,
|
||||
std::unique_ptr<DesktopFrame>* frame) {
|
||||
EXPECT_EQ(result, DesktopCapturer::Result::SUCCESS);
|
||||
DesktopFrame* frame) {
|
||||
std::unique_ptr<DesktopFrame> owned_frame(frame);
|
||||
|
||||
MacDesktopConfiguration config = MacDesktopConfiguration::GetCurrent(
|
||||
MacDesktopConfiguration::BottomLeftOrigin);
|
||||
int width = config.pixel_bounds.width();
|
||||
int height = config.pixel_bounds.height();
|
||||
|
||||
EXPECT_EQ(width, (*frame)->size().width());
|
||||
EXPECT_EQ(height, (*frame)->size().height());
|
||||
EXPECT_TRUE((*frame)->data() != NULL);
|
||||
EXPECT_EQ(width, frame->size().width());
|
||||
EXPECT_EQ(height, frame->size().height());
|
||||
EXPECT_TRUE(frame->data() != NULL);
|
||||
// Depending on the capture method, the screen may be flipped or not, so
|
||||
// the stride may be positive or negative.
|
||||
EXPECT_EQ(static_cast<int>(sizeof(uint32_t) * width),
|
||||
abs((*frame)->stride()));
|
||||
abs(frame->stride()));
|
||||
}
|
||||
|
||||
TEST_F(ScreenCapturerMacTest, Capture) {
|
||||
EXPECT_CALL(callback_,
|
||||
OnCaptureResultPtr(DesktopCapturer::Result::SUCCESS, _))
|
||||
EXPECT_CALL(callback_, OnCaptureCompleted(_))
|
||||
.Times(2)
|
||||
.WillOnce(Invoke(this, &ScreenCapturerMacTest::CaptureDoneCallback1))
|
||||
.WillOnce(Invoke(this, &ScreenCapturerMacTest::CaptureDoneCallback2));
|
||||
|
||||
Reference in New Issue
Block a user