2016-08-16 17:33:55 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2018-11-28 16:47:49 +01:00
|
|
|
#include <X11/X.h>
|
2016-11-08 12:47:14 -08:00
|
|
|
#include <X11/Xlib.h>
|
Deflaky ScreenCapturerTest
ScreenCapturer tests may fail on trybot, so this change is to fix the issue.
Changes include,
1. Sometimes, a capturer may capture part of the change, i.e. usually the draw
actions are not atomic. So the updated_region may be inaccurate. So I have added
a MayDrawIncompleteShapes() function in ScreenDrawer. If it returns false, the
updated_region check will be ignored.
2. Several test cases may run concurrently, which makes one ScreenDrawer won't
really work. Its window may be covered by another ScreenDrawer. So I have added
a system wide lock to ensure only one ScreenDrawer is working at a certain time.
3. On unity (Linux), the top several pixels of a window may be covered by a
shadow effect if the window is not focused. So I have added a BringToFront()
function, and call it in WaitForPendingDraws().
4. On Windows, the drawn shapes are 'temporary drawing', which will be erased
once the window is covered by another one. So I repeat DrawRectangle() function
call in the test case.
TODO(zijiehe): The DISABLED_ prefixes will be added back after the code review.
And I will move these test cases into modules_test in a coming change.
BUG=647067
Review-Url: https://codereview.webrtc.org/2337073007
Cr-Commit-Position: refs/heads/master@{#14674}
2016-10-18 18:22:18 -07:00
|
|
|
#include <string.h>
|
2016-08-16 17:33:55 -07:00
|
|
|
#include <memory>
|
|
|
|
|
|
Use absl::make_unique and absl::WrapUnique directly
Instead of going through our wrappers in ptr_util.h.
This CL was generated by the following script:
git grep -l ptr_util | xargs perl -pi -e 's,#include "rtc_base/ptr_util.h",#include "absl/memory/memory.h",'
git grep -l MakeUnique | xargs perl -pi -e 's,\b(rtc::)?MakeUnique\b,absl::make_unique,g'
git grep -l WrapUnique | xargs perl -pi -e 's,\b(rtc::)?WrapUnique\b,absl::WrapUnique,g'
git checkout -- rtc_base/ptr_util{.h,_unittest.cc}
git cl format
Followed by manually adding dependencies on
//third_party/abseil-cpp/absl/memory until `gn check` stopped
complaining.
Bug: webrtc:9473
Change-Id: I89ccd363f070479b8c431eb2c3d404a46eaacc1c
Reviewed-on: https://webrtc-review.googlesource.com/86600
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23850}
2018-07-05 11:40:33 +02:00
|
|
|
#include "absl/memory/memory.h"
|
2019-01-25 20:26:48 +01:00
|
|
|
#include "api/scoped_refptr.h"
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "modules/desktop_capture/desktop_capture_types.h"
|
|
|
|
|
#include "modules/desktop_capture/desktop_geometry.h"
|
2018-11-13 06:32:23 +01:00
|
|
|
#include "modules/desktop_capture/linux/shared_x_display.h"
|
2018-11-28 16:47:49 +01:00
|
|
|
#include "modules/desktop_capture/rgba_color.h"
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/desktop_capture/screen_drawer.h"
|
|
|
|
|
#include "modules/desktop_capture/screen_drawer_lock_posix.h"
|
|
|
|
|
#include "rtc_base/checks.h"
|
|
|
|
|
#include "system_wrappers/include/sleep.h"
|
2016-08-16 17:33:55 -07:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
// A ScreenDrawer implementation for X11.
|
|
|
|
|
class ScreenDrawerLinux : public ScreenDrawer {
|
|
|
|
|
public:
|
|
|
|
|
ScreenDrawerLinux();
|
|
|
|
|
~ScreenDrawerLinux() override;
|
|
|
|
|
|
|
|
|
|
// ScreenDrawer interface.
|
|
|
|
|
DesktopRect DrawableRegion() override;
|
Reland of [WebRTC] A real ScreenCapturer test (patchset #1 id:1 of https://codereview.webrtc.org/2310953002/ )
Reason for revert:
Resubmit capturer tests
Original issue's description:
> Revert of [WebRTC] A real ScreenCapturer test (patchset #8 id:240001 of https://codereview.webrtc.org/2268093002/ )
>
> Reason for revert:
> ScreenCapturerTest.CaptureUpdatedRegion fails on Win DrMemory Full.
>
> Original issue's description:
> > [WebRTC] A real ScreenCapturer test
> >
> > We do not have a real ScreenCapturer test before. And after CL 2210443002, a new
> > ScreenDrawer interface is added to the code base to draw various shapes on the
> > screen. This change is to use ScreenDrawer to test ScreenCapturer. Besides test
> > cases, some other changes are included,
> >
> > 1. A WaitForPendingPaintings() function in ScreenDrawer, to wait for a
> > ScreenDrawer to finish all the pending draws. This function now only sleeps 50
> > milliseconds on X11 and 100 milliseconds on Windows.
> >
> > 2. A Color structure to help handle a big-endian or little-endian safe color and
> > provide functions to compare with DesktopFrame::data(). Both ScreenDrawer and
> > DesktopFrameGenerator (in change 2202443002) can use this class to create colors
> > and compare with or paint to a DesktopFrame.
> >
> > 3. ScreenDrawer now uses Color structure instead of uint32_t.
> >
> > BUG=314516
> >
> > TBR=kjellander@chromium.org
> >
> > Committed: https://crrev.com/9d1c54ace0dc9f68da0152aa1ded2a8dba0a43ae
> > Cr-Commit-Position: refs/heads/master@{#14058}
>
> TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,zijiehe@chromium.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=314516
>
> Committed: https://crrev.com/4c44202dc348613695a4b529bbd7c9bdab6195ec
> Cr-Commit-Position: refs/heads/master@{#14071}
TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,asapersson@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=644130
Review-Url: https://codereview.webrtc.org/2313653003
Cr-Commit-Position: refs/heads/master@{#14113}
2016-09-07 11:52:25 -07:00
|
|
|
void DrawRectangle(DesktopRect rect, RgbaColor color) override;
|
2016-08-16 17:33:55 -07:00
|
|
|
void Clear() override;
|
Reland of [WebRTC] A real ScreenCapturer test (patchset #1 id:1 of https://codereview.webrtc.org/2310953002/ )
Reason for revert:
Resubmit capturer tests
Original issue's description:
> Revert of [WebRTC] A real ScreenCapturer test (patchset #8 id:240001 of https://codereview.webrtc.org/2268093002/ )
>
> Reason for revert:
> ScreenCapturerTest.CaptureUpdatedRegion fails on Win DrMemory Full.
>
> Original issue's description:
> > [WebRTC] A real ScreenCapturer test
> >
> > We do not have a real ScreenCapturer test before. And after CL 2210443002, a new
> > ScreenDrawer interface is added to the code base to draw various shapes on the
> > screen. This change is to use ScreenDrawer to test ScreenCapturer. Besides test
> > cases, some other changes are included,
> >
> > 1. A WaitForPendingPaintings() function in ScreenDrawer, to wait for a
> > ScreenDrawer to finish all the pending draws. This function now only sleeps 50
> > milliseconds on X11 and 100 milliseconds on Windows.
> >
> > 2. A Color structure to help handle a big-endian or little-endian safe color and
> > provide functions to compare with DesktopFrame::data(). Both ScreenDrawer and
> > DesktopFrameGenerator (in change 2202443002) can use this class to create colors
> > and compare with or paint to a DesktopFrame.
> >
> > 3. ScreenDrawer now uses Color structure instead of uint32_t.
> >
> > BUG=314516
> >
> > TBR=kjellander@chromium.org
> >
> > Committed: https://crrev.com/9d1c54ace0dc9f68da0152aa1ded2a8dba0a43ae
> > Cr-Commit-Position: refs/heads/master@{#14058}
>
> TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,zijiehe@chromium.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=314516
>
> Committed: https://crrev.com/4c44202dc348613695a4b529bbd7c9bdab6195ec
> Cr-Commit-Position: refs/heads/master@{#14071}
TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,asapersson@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=644130
Review-Url: https://codereview.webrtc.org/2313653003
Cr-Commit-Position: refs/heads/master@{#14113}
2016-09-07 11:52:25 -07:00
|
|
|
void WaitForPendingDraws() override;
|
Deflaky ScreenCapturerTest
ScreenCapturer tests may fail on trybot, so this change is to fix the issue.
Changes include,
1. Sometimes, a capturer may capture part of the change, i.e. usually the draw
actions are not atomic. So the updated_region may be inaccurate. So I have added
a MayDrawIncompleteShapes() function in ScreenDrawer. If it returns false, the
updated_region check will be ignored.
2. Several test cases may run concurrently, which makes one ScreenDrawer won't
really work. Its window may be covered by another ScreenDrawer. So I have added
a system wide lock to ensure only one ScreenDrawer is working at a certain time.
3. On unity (Linux), the top several pixels of a window may be covered by a
shadow effect if the window is not focused. So I have added a BringToFront()
function, and call it in WaitForPendingDraws().
4. On Windows, the drawn shapes are 'temporary drawing', which will be erased
once the window is covered by another one. So I repeat DrawRectangle() function
call in the test case.
TODO(zijiehe): The DISABLED_ prefixes will be added back after the code review.
And I will move these test cases into modules_test in a coming change.
BUG=647067
Review-Url: https://codereview.webrtc.org/2337073007
Cr-Commit-Position: refs/heads/master@{#14674}
2016-10-18 18:22:18 -07:00
|
|
|
bool MayDrawIncompleteShapes() override;
|
2017-09-01 15:51:14 -07:00
|
|
|
WindowId window_id() const override;
|
2016-08-16 17:33:55 -07:00
|
|
|
|
|
|
|
|
private:
|
Deflaky ScreenCapturerTest
ScreenCapturer tests may fail on trybot, so this change is to fix the issue.
Changes include,
1. Sometimes, a capturer may capture part of the change, i.e. usually the draw
actions are not atomic. So the updated_region may be inaccurate. So I have added
a MayDrawIncompleteShapes() function in ScreenDrawer. If it returns false, the
updated_region check will be ignored.
2. Several test cases may run concurrently, which makes one ScreenDrawer won't
really work. Its window may be covered by another ScreenDrawer. So I have added
a system wide lock to ensure only one ScreenDrawer is working at a certain time.
3. On unity (Linux), the top several pixels of a window may be covered by a
shadow effect if the window is not focused. So I have added a BringToFront()
function, and call it in WaitForPendingDraws().
4. On Windows, the drawn shapes are 'temporary drawing', which will be erased
once the window is covered by another one. So I repeat DrawRectangle() function
call in the test case.
TODO(zijiehe): The DISABLED_ prefixes will be added back after the code review.
And I will move these test cases into modules_test in a coming change.
BUG=647067
Review-Url: https://codereview.webrtc.org/2337073007
Cr-Commit-Position: refs/heads/master@{#14674}
2016-10-18 18:22:18 -07:00
|
|
|
// Bring the window to the front, this can help to avoid the impact from other
|
|
|
|
|
// windows or shadow effect.
|
|
|
|
|
void BringToFront();
|
|
|
|
|
|
2016-08-16 17:33:55 -07:00
|
|
|
rtc::scoped_refptr<SharedXDisplay> display_;
|
|
|
|
|
int screen_num_;
|
|
|
|
|
DesktopRect rect_;
|
|
|
|
|
Window window_;
|
|
|
|
|
GC context_;
|
|
|
|
|
Colormap colormap_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ScreenDrawerLinux::ScreenDrawerLinux() {
|
|
|
|
|
display_ = SharedXDisplay::CreateDefault();
|
|
|
|
|
RTC_CHECK(display_.get());
|
|
|
|
|
screen_num_ = DefaultScreen(display_->display());
|
Reland of [WebRTC] A real ScreenCapturer test (patchset #1 id:1 of https://codereview.webrtc.org/2310953002/ )
Reason for revert:
Resubmit capturer tests
Original issue's description:
> Revert of [WebRTC] A real ScreenCapturer test (patchset #8 id:240001 of https://codereview.webrtc.org/2268093002/ )
>
> Reason for revert:
> ScreenCapturerTest.CaptureUpdatedRegion fails on Win DrMemory Full.
>
> Original issue's description:
> > [WebRTC] A real ScreenCapturer test
> >
> > We do not have a real ScreenCapturer test before. And after CL 2210443002, a new
> > ScreenDrawer interface is added to the code base to draw various shapes on the
> > screen. This change is to use ScreenDrawer to test ScreenCapturer. Besides test
> > cases, some other changes are included,
> >
> > 1. A WaitForPendingPaintings() function in ScreenDrawer, to wait for a
> > ScreenDrawer to finish all the pending draws. This function now only sleeps 50
> > milliseconds on X11 and 100 milliseconds on Windows.
> >
> > 2. A Color structure to help handle a big-endian or little-endian safe color and
> > provide functions to compare with DesktopFrame::data(). Both ScreenDrawer and
> > DesktopFrameGenerator (in change 2202443002) can use this class to create colors
> > and compare with or paint to a DesktopFrame.
> >
> > 3. ScreenDrawer now uses Color structure instead of uint32_t.
> >
> > BUG=314516
> >
> > TBR=kjellander@chromium.org
> >
> > Committed: https://crrev.com/9d1c54ace0dc9f68da0152aa1ded2a8dba0a43ae
> > Cr-Commit-Position: refs/heads/master@{#14058}
>
> TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,zijiehe@chromium.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=314516
>
> Committed: https://crrev.com/4c44202dc348613695a4b529bbd7c9bdab6195ec
> Cr-Commit-Position: refs/heads/master@{#14071}
TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,asapersson@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=644130
Review-Url: https://codereview.webrtc.org/2313653003
Cr-Commit-Position: refs/heads/master@{#14113}
2016-09-07 11:52:25 -07:00
|
|
|
XWindowAttributes root_attributes;
|
|
|
|
|
if (!XGetWindowAttributes(display_->display(),
|
|
|
|
|
RootWindow(display_->display(), screen_num_),
|
|
|
|
|
&root_attributes)) {
|
2017-01-12 02:24:27 -08:00
|
|
|
RTC_NOTREACHED() << "Failed to get root window size.";
|
Reland of [WebRTC] A real ScreenCapturer test (patchset #1 id:1 of https://codereview.webrtc.org/2310953002/ )
Reason for revert:
Resubmit capturer tests
Original issue's description:
> Revert of [WebRTC] A real ScreenCapturer test (patchset #8 id:240001 of https://codereview.webrtc.org/2268093002/ )
>
> Reason for revert:
> ScreenCapturerTest.CaptureUpdatedRegion fails on Win DrMemory Full.
>
> Original issue's description:
> > [WebRTC] A real ScreenCapturer test
> >
> > We do not have a real ScreenCapturer test before. And after CL 2210443002, a new
> > ScreenDrawer interface is added to the code base to draw various shapes on the
> > screen. This change is to use ScreenDrawer to test ScreenCapturer. Besides test
> > cases, some other changes are included,
> >
> > 1. A WaitForPendingPaintings() function in ScreenDrawer, to wait for a
> > ScreenDrawer to finish all the pending draws. This function now only sleeps 50
> > milliseconds on X11 and 100 milliseconds on Windows.
> >
> > 2. A Color structure to help handle a big-endian or little-endian safe color and
> > provide functions to compare with DesktopFrame::data(). Both ScreenDrawer and
> > DesktopFrameGenerator (in change 2202443002) can use this class to create colors
> > and compare with or paint to a DesktopFrame.
> >
> > 3. ScreenDrawer now uses Color structure instead of uint32_t.
> >
> > BUG=314516
> >
> > TBR=kjellander@chromium.org
> >
> > Committed: https://crrev.com/9d1c54ace0dc9f68da0152aa1ded2a8dba0a43ae
> > Cr-Commit-Position: refs/heads/master@{#14058}
>
> TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,zijiehe@chromium.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=314516
>
> Committed: https://crrev.com/4c44202dc348613695a4b529bbd7c9bdab6195ec
> Cr-Commit-Position: refs/heads/master@{#14071}
TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,asapersson@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=644130
Review-Url: https://codereview.webrtc.org/2313653003
Cr-Commit-Position: refs/heads/master@{#14113}
2016-09-07 11:52:25 -07:00
|
|
|
}
|
|
|
|
|
window_ = XCreateSimpleWindow(
|
|
|
|
|
display_->display(), RootWindow(display_->display(), screen_num_), 0, 0,
|
|
|
|
|
root_attributes.width, root_attributes.height, 0,
|
|
|
|
|
BlackPixel(display_->display(), screen_num_),
|
|
|
|
|
BlackPixel(display_->display(), screen_num_));
|
2016-08-16 17:33:55 -07:00
|
|
|
XSelectInput(display_->display(), window_, StructureNotifyMask);
|
|
|
|
|
XMapWindow(display_->display(), window_);
|
|
|
|
|
while (true) {
|
|
|
|
|
XEvent event;
|
|
|
|
|
XNextEvent(display_->display(), &event);
|
|
|
|
|
if (event.type == MapNotify) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
XFlush(display_->display());
|
Reland of [WebRTC] A real ScreenCapturer test (patchset #1 id:1 of https://codereview.webrtc.org/2310953002/ )
Reason for revert:
Resubmit capturer tests
Original issue's description:
> Revert of [WebRTC] A real ScreenCapturer test (patchset #8 id:240001 of https://codereview.webrtc.org/2268093002/ )
>
> Reason for revert:
> ScreenCapturerTest.CaptureUpdatedRegion fails on Win DrMemory Full.
>
> Original issue's description:
> > [WebRTC] A real ScreenCapturer test
> >
> > We do not have a real ScreenCapturer test before. And after CL 2210443002, a new
> > ScreenDrawer interface is added to the code base to draw various shapes on the
> > screen. This change is to use ScreenDrawer to test ScreenCapturer. Besides test
> > cases, some other changes are included,
> >
> > 1. A WaitForPendingPaintings() function in ScreenDrawer, to wait for a
> > ScreenDrawer to finish all the pending draws. This function now only sleeps 50
> > milliseconds on X11 and 100 milliseconds on Windows.
> >
> > 2. A Color structure to help handle a big-endian or little-endian safe color and
> > provide functions to compare with DesktopFrame::data(). Both ScreenDrawer and
> > DesktopFrameGenerator (in change 2202443002) can use this class to create colors
> > and compare with or paint to a DesktopFrame.
> >
> > 3. ScreenDrawer now uses Color structure instead of uint32_t.
> >
> > BUG=314516
> >
> > TBR=kjellander@chromium.org
> >
> > Committed: https://crrev.com/9d1c54ace0dc9f68da0152aa1ded2a8dba0a43ae
> > Cr-Commit-Position: refs/heads/master@{#14058}
>
> TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,zijiehe@chromium.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=314516
>
> Committed: https://crrev.com/4c44202dc348613695a4b529bbd7c9bdab6195ec
> Cr-Commit-Position: refs/heads/master@{#14071}
TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,asapersson@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=644130
Review-Url: https://codereview.webrtc.org/2313653003
Cr-Commit-Position: refs/heads/master@{#14113}
2016-09-07 11:52:25 -07:00
|
|
|
Window child;
|
|
|
|
|
int x, y;
|
|
|
|
|
if (!XTranslateCoordinates(display_->display(), window_,
|
|
|
|
|
RootWindow(display_->display(), screen_num_), 0, 0,
|
|
|
|
|
&x, &y, &child)) {
|
2017-01-12 02:24:27 -08:00
|
|
|
RTC_NOTREACHED() << "Failed to get window position.";
|
Reland of [WebRTC] A real ScreenCapturer test (patchset #1 id:1 of https://codereview.webrtc.org/2310953002/ )
Reason for revert:
Resubmit capturer tests
Original issue's description:
> Revert of [WebRTC] A real ScreenCapturer test (patchset #8 id:240001 of https://codereview.webrtc.org/2268093002/ )
>
> Reason for revert:
> ScreenCapturerTest.CaptureUpdatedRegion fails on Win DrMemory Full.
>
> Original issue's description:
> > [WebRTC] A real ScreenCapturer test
> >
> > We do not have a real ScreenCapturer test before. And after CL 2210443002, a new
> > ScreenDrawer interface is added to the code base to draw various shapes on the
> > screen. This change is to use ScreenDrawer to test ScreenCapturer. Besides test
> > cases, some other changes are included,
> >
> > 1. A WaitForPendingPaintings() function in ScreenDrawer, to wait for a
> > ScreenDrawer to finish all the pending draws. This function now only sleeps 50
> > milliseconds on X11 and 100 milliseconds on Windows.
> >
> > 2. A Color structure to help handle a big-endian or little-endian safe color and
> > provide functions to compare with DesktopFrame::data(). Both ScreenDrawer and
> > DesktopFrameGenerator (in change 2202443002) can use this class to create colors
> > and compare with or paint to a DesktopFrame.
> >
> > 3. ScreenDrawer now uses Color structure instead of uint32_t.
> >
> > BUG=314516
> >
> > TBR=kjellander@chromium.org
> >
> > Committed: https://crrev.com/9d1c54ace0dc9f68da0152aa1ded2a8dba0a43ae
> > Cr-Commit-Position: refs/heads/master@{#14058}
>
> TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,zijiehe@chromium.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=314516
>
> Committed: https://crrev.com/4c44202dc348613695a4b529bbd7c9bdab6195ec
> Cr-Commit-Position: refs/heads/master@{#14071}
TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,asapersson@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=644130
Review-Url: https://codereview.webrtc.org/2313653003
Cr-Commit-Position: refs/heads/master@{#14113}
2016-09-07 11:52:25 -07:00
|
|
|
}
|
|
|
|
|
// Some window manager does not allow a window to cover two or more monitors.
|
|
|
|
|
// So if the window is on the first monitor of a two-monitor system, the
|
|
|
|
|
// second half won't be able to show up without changing configurations of WM,
|
|
|
|
|
// and its DrawableRegion() is not accurate.
|
|
|
|
|
rect_ = DesktopRect::MakeLTRB(x, y, root_attributes.width,
|
|
|
|
|
root_attributes.height);
|
2016-08-16 17:33:55 -07:00
|
|
|
context_ = DefaultGC(display_->display(), screen_num_);
|
|
|
|
|
colormap_ = DefaultColormap(display_->display(), screen_num_);
|
Deflaky ScreenCapturerTest
ScreenCapturer tests may fail on trybot, so this change is to fix the issue.
Changes include,
1. Sometimes, a capturer may capture part of the change, i.e. usually the draw
actions are not atomic. So the updated_region may be inaccurate. So I have added
a MayDrawIncompleteShapes() function in ScreenDrawer. If it returns false, the
updated_region check will be ignored.
2. Several test cases may run concurrently, which makes one ScreenDrawer won't
really work. Its window may be covered by another ScreenDrawer. So I have added
a system wide lock to ensure only one ScreenDrawer is working at a certain time.
3. On unity (Linux), the top several pixels of a window may be covered by a
shadow effect if the window is not focused. So I have added a BringToFront()
function, and call it in WaitForPendingDraws().
4. On Windows, the drawn shapes are 'temporary drawing', which will be erased
once the window is covered by another one. So I repeat DrawRectangle() function
call in the test case.
TODO(zijiehe): The DISABLED_ prefixes will be added back after the code review.
And I will move these test cases into modules_test in a coming change.
BUG=647067
Review-Url: https://codereview.webrtc.org/2337073007
Cr-Commit-Position: refs/heads/master@{#14674}
2016-10-18 18:22:18 -07:00
|
|
|
BringToFront();
|
Reland of [WebRTC] A real ScreenCapturer test (patchset #1 id:1 of https://codereview.webrtc.org/2310953002/ )
Reason for revert:
Resubmit capturer tests
Original issue's description:
> Revert of [WebRTC] A real ScreenCapturer test (patchset #8 id:240001 of https://codereview.webrtc.org/2268093002/ )
>
> Reason for revert:
> ScreenCapturerTest.CaptureUpdatedRegion fails on Win DrMemory Full.
>
> Original issue's description:
> > [WebRTC] A real ScreenCapturer test
> >
> > We do not have a real ScreenCapturer test before. And after CL 2210443002, a new
> > ScreenDrawer interface is added to the code base to draw various shapes on the
> > screen. This change is to use ScreenDrawer to test ScreenCapturer. Besides test
> > cases, some other changes are included,
> >
> > 1. A WaitForPendingPaintings() function in ScreenDrawer, to wait for a
> > ScreenDrawer to finish all the pending draws. This function now only sleeps 50
> > milliseconds on X11 and 100 milliseconds on Windows.
> >
> > 2. A Color structure to help handle a big-endian or little-endian safe color and
> > provide functions to compare with DesktopFrame::data(). Both ScreenDrawer and
> > DesktopFrameGenerator (in change 2202443002) can use this class to create colors
> > and compare with or paint to a DesktopFrame.
> >
> > 3. ScreenDrawer now uses Color structure instead of uint32_t.
> >
> > BUG=314516
> >
> > TBR=kjellander@chromium.org
> >
> > Committed: https://crrev.com/9d1c54ace0dc9f68da0152aa1ded2a8dba0a43ae
> > Cr-Commit-Position: refs/heads/master@{#14058}
>
> TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,zijiehe@chromium.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=314516
>
> Committed: https://crrev.com/4c44202dc348613695a4b529bbd7c9bdab6195ec
> Cr-Commit-Position: refs/heads/master@{#14071}
TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,asapersson@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=644130
Review-Url: https://codereview.webrtc.org/2313653003
Cr-Commit-Position: refs/heads/master@{#14113}
2016-09-07 11:52:25 -07:00
|
|
|
// Wait for window animations.
|
|
|
|
|
SleepMs(200);
|
2016-08-16 17:33:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ScreenDrawerLinux::~ScreenDrawerLinux() {
|
|
|
|
|
XUnmapWindow(display_->display(), window_);
|
|
|
|
|
XDestroyWindow(display_->display(), window_);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DesktopRect ScreenDrawerLinux::DrawableRegion() {
|
|
|
|
|
return rect_;
|
|
|
|
|
}
|
|
|
|
|
|
Reland of [WebRTC] A real ScreenCapturer test (patchset #1 id:1 of https://codereview.webrtc.org/2310953002/ )
Reason for revert:
Resubmit capturer tests
Original issue's description:
> Revert of [WebRTC] A real ScreenCapturer test (patchset #8 id:240001 of https://codereview.webrtc.org/2268093002/ )
>
> Reason for revert:
> ScreenCapturerTest.CaptureUpdatedRegion fails on Win DrMemory Full.
>
> Original issue's description:
> > [WebRTC] A real ScreenCapturer test
> >
> > We do not have a real ScreenCapturer test before. And after CL 2210443002, a new
> > ScreenDrawer interface is added to the code base to draw various shapes on the
> > screen. This change is to use ScreenDrawer to test ScreenCapturer. Besides test
> > cases, some other changes are included,
> >
> > 1. A WaitForPendingPaintings() function in ScreenDrawer, to wait for a
> > ScreenDrawer to finish all the pending draws. This function now only sleeps 50
> > milliseconds on X11 and 100 milliseconds on Windows.
> >
> > 2. A Color structure to help handle a big-endian or little-endian safe color and
> > provide functions to compare with DesktopFrame::data(). Both ScreenDrawer and
> > DesktopFrameGenerator (in change 2202443002) can use this class to create colors
> > and compare with or paint to a DesktopFrame.
> >
> > 3. ScreenDrawer now uses Color structure instead of uint32_t.
> >
> > BUG=314516
> >
> > TBR=kjellander@chromium.org
> >
> > Committed: https://crrev.com/9d1c54ace0dc9f68da0152aa1ded2a8dba0a43ae
> > Cr-Commit-Position: refs/heads/master@{#14058}
>
> TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,zijiehe@chromium.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=314516
>
> Committed: https://crrev.com/4c44202dc348613695a4b529bbd7c9bdab6195ec
> Cr-Commit-Position: refs/heads/master@{#14071}
TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,asapersson@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=644130
Review-Url: https://codereview.webrtc.org/2313653003
Cr-Commit-Position: refs/heads/master@{#14113}
2016-09-07 11:52:25 -07:00
|
|
|
void ScreenDrawerLinux::DrawRectangle(DesktopRect rect, RgbaColor color) {
|
|
|
|
|
rect.Translate(-rect_.left(), -rect_.top());
|
|
|
|
|
XColor xcolor;
|
2016-08-16 17:33:55 -07:00
|
|
|
// X11 does not support Alpha.
|
Reland of [WebRTC] A real ScreenCapturer test (patchset #1 id:1 of https://codereview.webrtc.org/2310953002/ )
Reason for revert:
Resubmit capturer tests
Original issue's description:
> Revert of [WebRTC] A real ScreenCapturer test (patchset #8 id:240001 of https://codereview.webrtc.org/2268093002/ )
>
> Reason for revert:
> ScreenCapturerTest.CaptureUpdatedRegion fails on Win DrMemory Full.
>
> Original issue's description:
> > [WebRTC] A real ScreenCapturer test
> >
> > We do not have a real ScreenCapturer test before. And after CL 2210443002, a new
> > ScreenDrawer interface is added to the code base to draw various shapes on the
> > screen. This change is to use ScreenDrawer to test ScreenCapturer. Besides test
> > cases, some other changes are included,
> >
> > 1. A WaitForPendingPaintings() function in ScreenDrawer, to wait for a
> > ScreenDrawer to finish all the pending draws. This function now only sleeps 50
> > milliseconds on X11 and 100 milliseconds on Windows.
> >
> > 2. A Color structure to help handle a big-endian or little-endian safe color and
> > provide functions to compare with DesktopFrame::data(). Both ScreenDrawer and
> > DesktopFrameGenerator (in change 2202443002) can use this class to create colors
> > and compare with or paint to a DesktopFrame.
> >
> > 3. ScreenDrawer now uses Color structure instead of uint32_t.
> >
> > BUG=314516
> >
> > TBR=kjellander@chromium.org
> >
> > Committed: https://crrev.com/9d1c54ace0dc9f68da0152aa1ded2a8dba0a43ae
> > Cr-Commit-Position: refs/heads/master@{#14058}
>
> TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,zijiehe@chromium.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=314516
>
> Committed: https://crrev.com/4c44202dc348613695a4b529bbd7c9bdab6195ec
> Cr-Commit-Position: refs/heads/master@{#14071}
TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,asapersson@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=644130
Review-Url: https://codereview.webrtc.org/2313653003
Cr-Commit-Position: refs/heads/master@{#14113}
2016-09-07 11:52:25 -07:00
|
|
|
// X11 uses 16 bits for each primary color, so we need to slightly normalize
|
|
|
|
|
// a 8 bits channel to 16 bits channel, by setting the low 8 bits as its high
|
|
|
|
|
// 8 bits to avoid a mismatch of color returned by capturer.
|
|
|
|
|
xcolor.red = (color.red << 8) + color.red;
|
|
|
|
|
xcolor.green = (color.green << 8) + color.green;
|
|
|
|
|
xcolor.blue = (color.blue << 8) + color.blue;
|
|
|
|
|
xcolor.flags = DoRed | DoGreen | DoBlue;
|
|
|
|
|
XAllocColor(display_->display(), colormap_, &xcolor);
|
|
|
|
|
XSetForeground(display_->display(), context_, xcolor.pixel);
|
2016-08-16 17:33:55 -07:00
|
|
|
XFillRectangle(display_->display(), window_, context_, rect.left(),
|
|
|
|
|
rect.top(), rect.width(), rect.height());
|
|
|
|
|
XFlush(display_->display());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenDrawerLinux::Clear() {
|
Reland of [WebRTC] A real ScreenCapturer test (patchset #1 id:1 of https://codereview.webrtc.org/2310953002/ )
Reason for revert:
Resubmit capturer tests
Original issue's description:
> Revert of [WebRTC] A real ScreenCapturer test (patchset #8 id:240001 of https://codereview.webrtc.org/2268093002/ )
>
> Reason for revert:
> ScreenCapturerTest.CaptureUpdatedRegion fails on Win DrMemory Full.
>
> Original issue's description:
> > [WebRTC] A real ScreenCapturer test
> >
> > We do not have a real ScreenCapturer test before. And after CL 2210443002, a new
> > ScreenDrawer interface is added to the code base to draw various shapes on the
> > screen. This change is to use ScreenDrawer to test ScreenCapturer. Besides test
> > cases, some other changes are included,
> >
> > 1. A WaitForPendingPaintings() function in ScreenDrawer, to wait for a
> > ScreenDrawer to finish all the pending draws. This function now only sleeps 50
> > milliseconds on X11 and 100 milliseconds on Windows.
> >
> > 2. A Color structure to help handle a big-endian or little-endian safe color and
> > provide functions to compare with DesktopFrame::data(). Both ScreenDrawer and
> > DesktopFrameGenerator (in change 2202443002) can use this class to create colors
> > and compare with or paint to a DesktopFrame.
> >
> > 3. ScreenDrawer now uses Color structure instead of uint32_t.
> >
> > BUG=314516
> >
> > TBR=kjellander@chromium.org
> >
> > Committed: https://crrev.com/9d1c54ace0dc9f68da0152aa1ded2a8dba0a43ae
> > Cr-Commit-Position: refs/heads/master@{#14058}
>
> TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,zijiehe@chromium.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=314516
>
> Committed: https://crrev.com/4c44202dc348613695a4b529bbd7c9bdab6195ec
> Cr-Commit-Position: refs/heads/master@{#14071}
TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,asapersson@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=644130
Review-Url: https://codereview.webrtc.org/2313653003
Cr-Commit-Position: refs/heads/master@{#14113}
2016-09-07 11:52:25 -07:00
|
|
|
DrawRectangle(rect_, RgbaColor(0, 0, 0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO(zijiehe): Find the right signal from X11 to indicate the finish of all
|
|
|
|
|
// pending paintings.
|
|
|
|
|
void ScreenDrawerLinux::WaitForPendingDraws() {
|
|
|
|
|
SleepMs(50);
|
2016-08-16 17:33:55 -07:00
|
|
|
}
|
|
|
|
|
|
Deflaky ScreenCapturerTest
ScreenCapturer tests may fail on trybot, so this change is to fix the issue.
Changes include,
1. Sometimes, a capturer may capture part of the change, i.e. usually the draw
actions are not atomic. So the updated_region may be inaccurate. So I have added
a MayDrawIncompleteShapes() function in ScreenDrawer. If it returns false, the
updated_region check will be ignored.
2. Several test cases may run concurrently, which makes one ScreenDrawer won't
really work. Its window may be covered by another ScreenDrawer. So I have added
a system wide lock to ensure only one ScreenDrawer is working at a certain time.
3. On unity (Linux), the top several pixels of a window may be covered by a
shadow effect if the window is not focused. So I have added a BringToFront()
function, and call it in WaitForPendingDraws().
4. On Windows, the drawn shapes are 'temporary drawing', which will be erased
once the window is covered by another one. So I repeat DrawRectangle() function
call in the test case.
TODO(zijiehe): The DISABLED_ prefixes will be added back after the code review.
And I will move these test cases into modules_test in a coming change.
BUG=647067
Review-Url: https://codereview.webrtc.org/2337073007
Cr-Commit-Position: refs/heads/master@{#14674}
2016-10-18 18:22:18 -07:00
|
|
|
bool ScreenDrawerLinux::MayDrawIncompleteShapes() {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-01 15:51:14 -07:00
|
|
|
WindowId ScreenDrawerLinux::window_id() const {
|
|
|
|
|
return window_;
|
|
|
|
|
}
|
|
|
|
|
|
Deflaky ScreenCapturerTest
ScreenCapturer tests may fail on trybot, so this change is to fix the issue.
Changes include,
1. Sometimes, a capturer may capture part of the change, i.e. usually the draw
actions are not atomic. So the updated_region may be inaccurate. So I have added
a MayDrawIncompleteShapes() function in ScreenDrawer. If it returns false, the
updated_region check will be ignored.
2. Several test cases may run concurrently, which makes one ScreenDrawer won't
really work. Its window may be covered by another ScreenDrawer. So I have added
a system wide lock to ensure only one ScreenDrawer is working at a certain time.
3. On unity (Linux), the top several pixels of a window may be covered by a
shadow effect if the window is not focused. So I have added a BringToFront()
function, and call it in WaitForPendingDraws().
4. On Windows, the drawn shapes are 'temporary drawing', which will be erased
once the window is covered by another one. So I repeat DrawRectangle() function
call in the test case.
TODO(zijiehe): The DISABLED_ prefixes will be added back after the code review.
And I will move these test cases into modules_test in a coming change.
BUG=647067
Review-Url: https://codereview.webrtc.org/2337073007
Cr-Commit-Position: refs/heads/master@{#14674}
2016-10-18 18:22:18 -07:00
|
|
|
void ScreenDrawerLinux::BringToFront() {
|
|
|
|
|
Atom state_above = XInternAtom(display_->display(), "_NET_WM_STATE_ABOVE", 1);
|
|
|
|
|
Atom window_state = XInternAtom(display_->display(), "_NET_WM_STATE", 1);
|
|
|
|
|
if (state_above == None || window_state == None) {
|
|
|
|
|
// Fallback to use XRaiseWindow, it's not reliable if two windows are both
|
|
|
|
|
// raise itself to the top.
|
|
|
|
|
XRaiseWindow(display_->display(), window_);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
XEvent event;
|
|
|
|
|
memset(&event, 0, sizeof(event));
|
|
|
|
|
event.type = ClientMessage;
|
|
|
|
|
event.xclient.window = window_;
|
|
|
|
|
event.xclient.message_type = window_state;
|
|
|
|
|
event.xclient.format = 32;
|
|
|
|
|
event.xclient.data.l[0] = 1; // _NET_WM_STATE_ADD
|
|
|
|
|
event.xclient.data.l[1] = state_above;
|
|
|
|
|
XSendEvent(display_->display(), RootWindow(display_->display(), screen_num_),
|
|
|
|
|
False, SubstructureRedirectMask | SubstructureNotifyMask, &event);
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-16 17:33:55 -07:00
|
|
|
} // namespace
|
|
|
|
|
|
Deflaky ScreenCapturerTest
ScreenCapturer tests may fail on trybot, so this change is to fix the issue.
Changes include,
1. Sometimes, a capturer may capture part of the change, i.e. usually the draw
actions are not atomic. So the updated_region may be inaccurate. So I have added
a MayDrawIncompleteShapes() function in ScreenDrawer. If it returns false, the
updated_region check will be ignored.
2. Several test cases may run concurrently, which makes one ScreenDrawer won't
really work. Its window may be covered by another ScreenDrawer. So I have added
a system wide lock to ensure only one ScreenDrawer is working at a certain time.
3. On unity (Linux), the top several pixels of a window may be covered by a
shadow effect if the window is not focused. So I have added a BringToFront()
function, and call it in WaitForPendingDraws().
4. On Windows, the drawn shapes are 'temporary drawing', which will be erased
once the window is covered by another one. So I repeat DrawRectangle() function
call in the test case.
TODO(zijiehe): The DISABLED_ prefixes will be added back after the code review.
And I will move these test cases into modules_test in a coming change.
BUG=647067
Review-Url: https://codereview.webrtc.org/2337073007
Cr-Commit-Position: refs/heads/master@{#14674}
2016-10-18 18:22:18 -07:00
|
|
|
// static
|
|
|
|
|
std::unique_ptr<ScreenDrawerLock> ScreenDrawerLock::Create() {
|
Use absl::make_unique and absl::WrapUnique directly
Instead of going through our wrappers in ptr_util.h.
This CL was generated by the following script:
git grep -l ptr_util | xargs perl -pi -e 's,#include "rtc_base/ptr_util.h",#include "absl/memory/memory.h",'
git grep -l MakeUnique | xargs perl -pi -e 's,\b(rtc::)?MakeUnique\b,absl::make_unique,g'
git grep -l WrapUnique | xargs perl -pi -e 's,\b(rtc::)?WrapUnique\b,absl::WrapUnique,g'
git checkout -- rtc_base/ptr_util{.h,_unittest.cc}
git cl format
Followed by manually adding dependencies on
//third_party/abseil-cpp/absl/memory until `gn check` stopped
complaining.
Bug: webrtc:9473
Change-Id: I89ccd363f070479b8c431eb2c3d404a46eaacc1c
Reviewed-on: https://webrtc-review.googlesource.com/86600
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23850}
2018-07-05 11:40:33 +02:00
|
|
|
return absl::make_unique<ScreenDrawerLockPosix>();
|
Deflaky ScreenCapturerTest
ScreenCapturer tests may fail on trybot, so this change is to fix the issue.
Changes include,
1. Sometimes, a capturer may capture part of the change, i.e. usually the draw
actions are not atomic. So the updated_region may be inaccurate. So I have added
a MayDrawIncompleteShapes() function in ScreenDrawer. If it returns false, the
updated_region check will be ignored.
2. Several test cases may run concurrently, which makes one ScreenDrawer won't
really work. Its window may be covered by another ScreenDrawer. So I have added
a system wide lock to ensure only one ScreenDrawer is working at a certain time.
3. On unity (Linux), the top several pixels of a window may be covered by a
shadow effect if the window is not focused. So I have added a BringToFront()
function, and call it in WaitForPendingDraws().
4. On Windows, the drawn shapes are 'temporary drawing', which will be erased
once the window is covered by another one. So I repeat DrawRectangle() function
call in the test case.
TODO(zijiehe): The DISABLED_ prefixes will be added back after the code review.
And I will move these test cases into modules_test in a coming change.
BUG=647067
Review-Url: https://codereview.webrtc.org/2337073007
Cr-Commit-Position: refs/heads/master@{#14674}
2016-10-18 18:22:18 -07:00
|
|
|
}
|
|
|
|
|
|
2016-08-16 17:33:55 -07:00
|
|
|
// static
|
|
|
|
|
std::unique_ptr<ScreenDrawer> ScreenDrawer::Create() {
|
Reland of [WebRTC] A real ScreenCapturer test (patchset #1 id:1 of https://codereview.webrtc.org/2310953002/ )
Reason for revert:
Resubmit capturer tests
Original issue's description:
> Revert of [WebRTC] A real ScreenCapturer test (patchset #8 id:240001 of https://codereview.webrtc.org/2268093002/ )
>
> Reason for revert:
> ScreenCapturerTest.CaptureUpdatedRegion fails on Win DrMemory Full.
>
> Original issue's description:
> > [WebRTC] A real ScreenCapturer test
> >
> > We do not have a real ScreenCapturer test before. And after CL 2210443002, a new
> > ScreenDrawer interface is added to the code base to draw various shapes on the
> > screen. This change is to use ScreenDrawer to test ScreenCapturer. Besides test
> > cases, some other changes are included,
> >
> > 1. A WaitForPendingPaintings() function in ScreenDrawer, to wait for a
> > ScreenDrawer to finish all the pending draws. This function now only sleeps 50
> > milliseconds on X11 and 100 milliseconds on Windows.
> >
> > 2. A Color structure to help handle a big-endian or little-endian safe color and
> > provide functions to compare with DesktopFrame::data(). Both ScreenDrawer and
> > DesktopFrameGenerator (in change 2202443002) can use this class to create colors
> > and compare with or paint to a DesktopFrame.
> >
> > 3. ScreenDrawer now uses Color structure instead of uint32_t.
> >
> > BUG=314516
> >
> > TBR=kjellander@chromium.org
> >
> > Committed: https://crrev.com/9d1c54ace0dc9f68da0152aa1ded2a8dba0a43ae
> > Cr-Commit-Position: refs/heads/master@{#14058}
>
> TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,zijiehe@chromium.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=314516
>
> Committed: https://crrev.com/4c44202dc348613695a4b529bbd7c9bdab6195ec
> Cr-Commit-Position: refs/heads/master@{#14071}
TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,asapersson@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=644130
Review-Url: https://codereview.webrtc.org/2313653003
Cr-Commit-Position: refs/heads/master@{#14113}
2016-09-07 11:52:25 -07:00
|
|
|
if (SharedXDisplay::CreateDefault().get()) {
|
Use absl::make_unique and absl::WrapUnique directly
Instead of going through our wrappers in ptr_util.h.
This CL was generated by the following script:
git grep -l ptr_util | xargs perl -pi -e 's,#include "rtc_base/ptr_util.h",#include "absl/memory/memory.h",'
git grep -l MakeUnique | xargs perl -pi -e 's,\b(rtc::)?MakeUnique\b,absl::make_unique,g'
git grep -l WrapUnique | xargs perl -pi -e 's,\b(rtc::)?WrapUnique\b,absl::WrapUnique,g'
git checkout -- rtc_base/ptr_util{.h,_unittest.cc}
git cl format
Followed by manually adding dependencies on
//third_party/abseil-cpp/absl/memory until `gn check` stopped
complaining.
Bug: webrtc:9473
Change-Id: I89ccd363f070479b8c431eb2c3d404a46eaacc1c
Reviewed-on: https://webrtc-review.googlesource.com/86600
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23850}
2018-07-05 11:40:33 +02:00
|
|
|
return absl::make_unique<ScreenDrawerLinux>();
|
Reland of [WebRTC] A real ScreenCapturer test (patchset #1 id:1 of https://codereview.webrtc.org/2310953002/ )
Reason for revert:
Resubmit capturer tests
Original issue's description:
> Revert of [WebRTC] A real ScreenCapturer test (patchset #8 id:240001 of https://codereview.webrtc.org/2268093002/ )
>
> Reason for revert:
> ScreenCapturerTest.CaptureUpdatedRegion fails on Win DrMemory Full.
>
> Original issue's description:
> > [WebRTC] A real ScreenCapturer test
> >
> > We do not have a real ScreenCapturer test before. And after CL 2210443002, a new
> > ScreenDrawer interface is added to the code base to draw various shapes on the
> > screen. This change is to use ScreenDrawer to test ScreenCapturer. Besides test
> > cases, some other changes are included,
> >
> > 1. A WaitForPendingPaintings() function in ScreenDrawer, to wait for a
> > ScreenDrawer to finish all the pending draws. This function now only sleeps 50
> > milliseconds on X11 and 100 milliseconds on Windows.
> >
> > 2. A Color structure to help handle a big-endian or little-endian safe color and
> > provide functions to compare with DesktopFrame::data(). Both ScreenDrawer and
> > DesktopFrameGenerator (in change 2202443002) can use this class to create colors
> > and compare with or paint to a DesktopFrame.
> >
> > 3. ScreenDrawer now uses Color structure instead of uint32_t.
> >
> > BUG=314516
> >
> > TBR=kjellander@chromium.org
> >
> > Committed: https://crrev.com/9d1c54ace0dc9f68da0152aa1ded2a8dba0a43ae
> > Cr-Commit-Position: refs/heads/master@{#14058}
>
> TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,zijiehe@chromium.org
> # Not skipping CQ checks because original CL landed more than 1 days ago.
> BUG=314516
>
> Committed: https://crrev.com/4c44202dc348613695a4b529bbd7c9bdab6195ec
> Cr-Commit-Position: refs/heads/master@{#14071}
TBR=sergeyu@chromium.org,jamiewalch@chromium.org,kjellander@chromium.org,asapersson@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=644130
Review-Url: https://codereview.webrtc.org/2313653003
Cr-Commit-Position: refs/heads/master@{#14113}
2016-09-07 11:52:25 -07:00
|
|
|
}
|
|
|
|
|
return nullptr;
|
2016-08-16 17:33:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace webrtc
|