Remove DesktopRegion parameter from DesktopCapturer::Capture

BUG=https://bugs.chromium.org/p/webrtc/issues/detail?id=6513

Review-Url: https://codereview.webrtc.org/2433503002
Cr-Commit-Position: refs/heads/master@{#14676}
This commit is contained in:
zijiehe 2016-10-18 23:13:29 -07:00 committed by Commit bot
parent e8295fcc48
commit 249beee124
5 changed files with 11 additions and 18 deletions

View File

@ -79,7 +79,7 @@ void CroppingWindowCapturer::OnCaptureResult(
std::unique_ptr<DesktopFrame> screen_frame) {
if (!ShouldUseScreenCapturer()) {
LOG(LS_INFO) << "Window no longer on top when ScreenCapturer finishes";
window_capturer_->Capture(DesktopRegion());
window_capturer_->CaptureFrame();
return;
}

View File

@ -31,11 +31,11 @@ class DesktopCapturer {
SUCCESS,
// There was a temporary error. The caller should continue calling
// Capture(), in the expectation that it will eventually recover.
// CaptureFrame(), in the expectation that it will eventually recover.
ERROR_TEMPORARY,
// Capture has failed and will keep failing if the caller tries calling
// Capture() again.
// CaptureFrame() again.
ERROR_PERMANENT,
MAX_VALUE = ERROR_PERMANENT
@ -61,17 +61,15 @@ class DesktopCapturer {
// Sets SharedMemoryFactory that will be used to create buffers for the
// captured frames. The factory can be invoked on a thread other than the one
// where Capture() is called. It will be destroyed on the same thread. Shared
// memory is currently supported only by some DesktopCapturer implementations.
// where CaptureFrame() is called. It will be destroyed on the same thread.
// Shared memory is currently supported only by some DesktopCapturer
// implementations.
virtual void SetSharedMemoryFactory(
std::unique_ptr<SharedMemoryFactory> shared_memory_factory) {}
// This is a legacy interface, consumers should call CaptureFrame() function.
virtual void Capture(const DesktopRegion& region) { CaptureFrame(); }
// Captures next frame, and involve callback provided by Start() function.
// Pending capture requests are canceled when DesktopCapturer is deleted.
virtual void CaptureFrame() { Capture(DesktopRegion()); }
virtual void CaptureFrame() = 0;
// Sets the window to be excluded from the captured image in the future
// Capture calls. Used to exclude the screenshare notification window for

View File

@ -93,10 +93,10 @@ TEST_F(ScreenCapturerMacTest, Capture) {
capturer_->Start(&callback_);
// Check that we get an initial full-screen updated.
capturer_->Capture(DesktopRegion());
capturer_->CaptureFrame();
// Check that subsequent dirty rects are propagated correctly.
capturer_->Capture(DesktopRegion());
capturer_->CaptureFrame();
}
} // namespace webrtc

View File

@ -19,15 +19,10 @@ namespace webrtc {
class MockScreenCapturer : public ScreenCapturer {
public:
MockScreenCapturer() {
ON_CALL(*this, Capture(testing::_))
.WillByDefault(testing::WithoutArgs(testing::Invoke(
this, &MockScreenCapturer::CaptureFrame)));
}
MockScreenCapturer() {}
virtual ~MockScreenCapturer() {}
MOCK_METHOD1(Start, void(Callback* callback));
MOCK_METHOD1(Capture, void(const DesktopRegion& region));
MOCK_METHOD0(CaptureFrame, void(void));
MOCK_METHOD1(GetScreenList, bool(ScreenList* screens));
MOCK_METHOD1(SelectScreen, bool(ScreenId id));

View File

@ -70,7 +70,7 @@ TEST_F(WindowCapturerTest, Capture) {
it != windows.end(); ++it) {
frame_.reset();
if (capturer_->SelectWindow(it->id)) {
capturer_->Capture(DesktopRegion());
capturer_->CaptureFrame();
}
// If we failed to capture a window make sure it no longer exists.