Revert of Make ui::Compositor use ui::Scheduler (patchset #2 id:20001 of https://codereview.chromium.org/638653003/)
This reverts commit 36b7fc7f8b05ea627873e58a162c1c26784e472d.
Reason for revert:
Speculatively reverting as I suspect it may be the cause of test failures like this:
[16079:16079:1009/052004:FATAL:compositor.cc(303)] Check failed: !IsLocked().
http://build.chromium.org/p/chromium.linux/builders/Linux%20Tests%20%28dbg%29%281%29%2832%29/builds/6451
Original issue's description:
> Make ui::Compositor use ui::Scheduler
>
> Taken from enne's CL 535733002 and rebased. It has been taken out of CL 134623005.
>
> BUG=329552
>
> Committed: https://crrev.com/36b7fc7f8b05ea627873e58a162c1c26784e472d
> Cr-Commit-Position: refs/heads/master@{#298779}
[email protected],[email protected],[email protected],[email protected]
NOTREECHECKS=true
NOTRY=true
BUG=329552
Review URL: https://codereview.chromium.org/640293003
Cr-Commit-Position: refs/heads/master@{#298919}
diff --git a/chrome/browser/ui/views/menu_view_drag_and_drop_test.cc b/chrome/browser/ui/views/menu_view_drag_and_drop_test.cc
index 21ca8a9..3f6dfb5 100644
--- a/chrome/browser/ui/views/menu_view_drag_and_drop_test.cc
+++ b/chrome/browser/ui/views/menu_view_drag_and_drop_test.cc
@@ -17,9 +17,8 @@
// Borrowed from chrome/browser/ui/views/bookmarks/bookmark_bar_view_test.cc,
// since these are also disabled on Linux for drag and drop.
-// TODO(erg): Fix DND tests on linux_aura. http://crbug.com/163931
-// TODO(enne): Windows version has flaky timeouts. http://crbug.com/401226
-#if defined(USE_AURA)
+// TODO(erg): Fix DND tests on linux_aura. crbug.com/163931
+#if defined(OS_LINUX) && defined(USE_AURA)
#define MAYBE(x) DISABLED_##x
#else
#define MAYBE(x) x
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index 19cf689..1b6f342 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -62,6 +62,12 @@
compositor_ = NULL;
}
+} // namespace ui
+
+namespace {} // namespace
+
+namespace ui {
+
Compositor::Compositor(gfx::AcceleratedWidget widget,
ui::ContextFactory* context_factory,
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
@@ -72,9 +78,16 @@
task_runner_(task_runner),
vsync_manager_(new CompositorVSyncManager()),
device_scale_factor_(0.0f),
+ last_started_frame_(0),
+ last_ended_frame_(0),
disable_schedule_composite_(false),
compositor_lock_(NULL),
- layer_animator_collection_(this) {
+ defer_draw_scheduling_(false),
+ waiting_on_compositing_end_(false),
+ draw_on_compositing_end_(false),
+ swap_state_(SWAP_NONE),
+ layer_animator_collection_(this),
+ schedule_draw_factory_(this) {
root_web_layer_ = cc::Layer::Create();
CommandLine* command_line = CommandLine::ForCurrentProcess();
@@ -122,6 +135,7 @@
settings.impl_side_painting = IsUIImplSidePaintingEnabled();
settings.use_zero_copy = IsUIZeroCopyEnabled();
+ settings.single_thread_proxy_scheduler = false;
base::TimeTicks before_create = base::TimeTicks::Now();
if (compositor_thread_loop_.get()) {
@@ -162,7 +176,14 @@
}
void Compositor::ScheduleDraw() {
- host_->SetNeedsCommit();
+ if (compositor_thread_loop_.get()) {
+ host_->SetNeedsCommit();
+ } else if (!defer_draw_scheduling_) {
+ defer_draw_scheduling_ = true;
+ task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&Compositor::Draw, schedule_draw_factory_.GetWeakPtr()));
+ }
}
void Compositor::SetRootLayer(Layer* root_layer) {
@@ -183,19 +204,44 @@
host_->set_has_transparent_background(host_has_transparent_background);
}
+void Compositor::Draw() {
+ DCHECK(!compositor_thread_loop_.get());
+
+ defer_draw_scheduling_ = false;
+ if (waiting_on_compositing_end_) {
+ draw_on_compositing_end_ = true;
+ return;
+ }
+ if (!root_layer_)
+ return;
+
+ TRACE_EVENT_ASYNC_BEGIN0("ui", "Compositor::Draw", last_started_frame_ + 1);
+
+ DCHECK_NE(swap_state_, SWAP_POSTED);
+ swap_state_ = SWAP_NONE;
+
+ waiting_on_compositing_end_ = true;
+ last_started_frame_++;
+ if (!IsLocked()) {
+ // TODO(nduca): Temporary while compositor calls
+ // compositeImmediately() directly.
+ cc::BeginFrameArgs args =
+ cc::BeginFrameArgs::Create(gfx::FrameTime::Now(),
+ base::TimeTicks(),
+ cc::BeginFrameArgs::DefaultInterval());
+ BeginMainFrame(args);
+ host_->Composite(args.frame_time);
+ }
+ if (swap_state_ == SWAP_NONE)
+ NotifyEnd();
+}
+
void Compositor::ScheduleFullRedraw() {
- // TODO(enne): Some callers (mac) call this function expecting that it
- // will also commit. This should probably just redraw the screen
- // from damage and not commit. ScheduleDraw/ScheduleRedraw need
- // better names.
host_->SetNeedsRedraw();
- host_->SetNeedsCommit();
}
void Compositor::ScheduleRedrawRect(const gfx::Rect& damage_rect) {
- // TODO(enne): Make this not commit. See ScheduleFullRedraw.
host_->SetNeedsRedrawRect(damage_rect);
- host_->SetNeedsCommit();
}
void Compositor::FinishAllRendering() {
@@ -307,30 +353,45 @@
}
void Compositor::DidCommitAndDrawFrame() {
-}
-
-void Compositor::DidCompleteSwapBuffers() {
- // DidPostSwapBuffers is a SingleThreadProxy-only feature. Synthetically
- // generate OnCompositingStarted messages for the threaded case so that
- // OnCompositingStarted/OnCompositingEnded messages match.
- if (compositor_thread_loop_.get()) {
- base::TimeTicks start_time = gfx::FrameTime::Now();
- FOR_EACH_OBSERVER(CompositorObserver,
- observer_list_,
- OnCompositingStarted(this, start_time));
- }
- FOR_EACH_OBSERVER(
- CompositorObserver, observer_list_, OnCompositingEnded(this));
-}
-
-void Compositor::DidPostSwapBuffers() {
base::TimeTicks start_time = gfx::FrameTime::Now();
FOR_EACH_OBSERVER(CompositorObserver,
observer_list_,
OnCompositingStarted(this, start_time));
}
+void Compositor::DidCompleteSwapBuffers() {
+ if (compositor_thread_loop_.get()) {
+ NotifyEnd();
+ } else {
+ DCHECK_EQ(swap_state_, SWAP_POSTED);
+ NotifyEnd();
+ swap_state_ = SWAP_COMPLETED;
+ }
+}
+
+void Compositor::ScheduleComposite() {
+ if (!disable_schedule_composite_)
+ ScheduleDraw();
+}
+
+void Compositor::ScheduleAnimation() {
+ ScheduleComposite();
+}
+
+void Compositor::DidPostSwapBuffers() {
+ DCHECK(!compositor_thread_loop_.get());
+ DCHECK_EQ(swap_state_, SWAP_NONE);
+ swap_state_ = SWAP_POSTED;
+}
+
void Compositor::DidAbortSwapBuffers() {
+ if (!compositor_thread_loop_.get()) {
+ if (swap_state_ == SWAP_POSTED) {
+ NotifyEnd();
+ swap_state_ = SWAP_COMPLETED;
+ }
+ }
+
FOR_EACH_OBSERVER(CompositorObserver,
observer_list_,
OnCompositingAborted(this));
@@ -348,7 +409,8 @@
scoped_refptr<CompositorLock> Compositor::GetCompositorLock() {
if (!compositor_lock_) {
compositor_lock_ = new CompositorLock(this);
- host_->SetDeferCommits(true);
+ if (compositor_thread_loop_.get())
+ host_->SetDeferCommits(true);
FOR_EACH_OBSERVER(CompositorObserver,
observer_list_,
OnCompositingLockStateChanged(this));
@@ -359,7 +421,8 @@
void Compositor::UnlockCompositor() {
DCHECK(compositor_lock_);
compositor_lock_ = NULL;
- host_->SetDeferCommits(false);
+ if (compositor_thread_loop_.get())
+ host_->SetDeferCommits(false);
FOR_EACH_OBSERVER(CompositorObserver,
observer_list_,
OnCompositingLockStateChanged(this));
@@ -370,4 +433,20 @@
compositor_lock_->CancelLock();
}
+void Compositor::NotifyEnd() {
+ last_ended_frame_++;
+ TRACE_EVENT_ASYNC_END0("ui", "Compositor::Draw", last_ended_frame_);
+ waiting_on_compositing_end_ = false;
+ if (draw_on_compositing_end_) {
+ draw_on_compositing_end_ = false;
+
+ // Call ScheduleDraw() instead of Draw() in order to allow other
+ // CompositorObservers to be notified before starting another
+ // draw cycle.
+ ScheduleDraw();
+ }
+ FOR_EACH_OBSERVER(
+ CompositorObserver, observer_list_, OnCompositingEnded(this));
+}
+
} // namespace ui
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h
index 9426255..7665448 100644
--- a/ui/compositor/compositor.h
+++ b/ui/compositor/compositor.h
@@ -24,6 +24,8 @@
#include "ui/gfx/size.h"
#include "ui/gfx/vector2d.h"
+class SkBitmap;
+
namespace base {
class MessageLoopProxy;
class RunLoop;
@@ -157,6 +159,9 @@
// compositing layers on.
float device_scale_factor() const { return device_scale_factor_; }
+ // Draws the scene created by the layer tree and any visual effects.
+ void Draw();
+
// Where possible, draws are scissored to a damage region calculated from
// changes to layer properties. This bypasses that and indicates that
// the whole frame needs to be drawn.
@@ -247,6 +252,9 @@
virtual void DidPostSwapBuffers() override;
virtual void DidAbortSwapBuffers() override;
+ int last_started_frame() { return last_started_frame_; }
+ int last_ended_frame() { return last_ended_frame_; }
+
bool IsLocked() { return compositor_lock_ != NULL; }
const cc::LayerTreeDebugState& GetLayerTreeDebugState() const;
@@ -266,6 +274,9 @@
// Called to release any pending CompositorLock
void CancelCompositorLock();
+ // Notifies the compositor that compositing is complete.
+ void NotifyEnd();
+
gfx::Size size_;
ui::ContextFactory* context_factory_;
@@ -296,8 +307,19 @@
CompositorLock* compositor_lock_;
+ // Prevent more than one draw from being scheduled.
+ bool defer_draw_scheduling_;
+
+ // Used to prevent Draw()s while a composite is in progress.
+ bool waiting_on_compositing_end_;
+ bool draw_on_compositing_end_;
+ enum SwapState { SWAP_NONE, SWAP_POSTED, SWAP_COMPLETED };
+ SwapState swap_state_;
+
LayerAnimatorCollection layer_animator_collection_;
+ base::WeakPtrFactory<Compositor> schedule_draw_factory_;
+
DISALLOW_COPY_AND_ASSIGN(Compositor);
};
diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc
index f6b0eac..5f25cd459 100644
--- a/ui/compositor/layer_unittest.cc
+++ b/ui/compositor/layer_unittest.cc
@@ -129,7 +129,7 @@
void DrawTree(Layer* root) {
GetCompositor()->SetRootLayer(root);
GetCompositor()->ScheduleDraw();
- WaitForSwap();
+ WaitForDraw();
}
void ReadPixels(SkBitmap* bitmap) {
@@ -149,7 +149,7 @@
// be in the middle of a draw right now, and the commit with the
// copy output request may not be done on the first draw.
for (int i = 0; i < 2; i++) {
- GetCompositor()->ScheduleFullRedraw();
+ GetCompositor()->ScheduleDraw();
WaitForDraw();
}
@@ -159,13 +159,7 @@
*bitmap = holder->result();
}
- void WaitForDraw() {
- ui::DrawWaiterForTest::WaitForCompositingStarted(GetCompositor());
- }
-
- void WaitForSwap() {
- DrawWaiterForTest::WaitForCompositingEnded(GetCompositor());
- }
+ void WaitForDraw() { ui::DrawWaiterForTest::Wait(GetCompositor()); }
void WaitForCommit() {
ui::DrawWaiterForTest::WaitForCommit(GetCompositor());
@@ -457,9 +451,7 @@
WaitForDraw();
}
- void WaitForDraw() {
- DrawWaiterForTest::WaitForCompositingStarted(compositor());
- }
+ void WaitForDraw() { DrawWaiterForTest::Wait(compositor()); }
void WaitForCommit() {
DrawWaiterForTest::WaitForCommit(compositor());
@@ -1036,25 +1028,25 @@
// Moving, but not resizing, a layer should alert the observers.
observer.Reset();
l2->SetBounds(gfx::Rect(0, 0, 350, 350));
- WaitForSwap();
+ WaitForDraw();
EXPECT_TRUE(observer.notified());
// So should resizing a layer.
observer.Reset();
l2->SetBounds(gfx::Rect(0, 0, 400, 400));
- WaitForSwap();
+ WaitForDraw();
EXPECT_TRUE(observer.notified());
// Opacity changes should alert the observers.
observer.Reset();
l2->SetOpacity(0.5f);
- WaitForSwap();
+ WaitForDraw();
EXPECT_TRUE(observer.notified());
// So should setting the opacity back.
observer.Reset();
l2->SetOpacity(1.0f);
- WaitForSwap();
+ WaitForDraw();
EXPECT_TRUE(observer.notified());
// Setting the transform of a layer should alert the observers.
@@ -1064,7 +1056,7 @@
transform.Rotate(90.0);
transform.Translate(-200.0, -200.0);
l2->SetTransform(transform);
- WaitForSwap();
+ WaitForDraw();
EXPECT_TRUE(observer.notified());
// A change resulting in an aborted swap buffer should alert the observer
@@ -1072,7 +1064,7 @@
observer.Reset();
l2->SetOpacity(0.1f);
GetCompositor()->DidAbortSwapBuffers();
- WaitForSwap();
+ WaitForDraw();
EXPECT_TRUE(observer.notified());
EXPECT_TRUE(observer.aborted());
@@ -1081,7 +1073,7 @@
// Opacity changes should no longer alert the removed observer.
observer.Reset();
l2->SetOpacity(0.5f);
- WaitForSwap();
+ WaitForDraw();
EXPECT_FALSE(observer.notified());
}
diff --git a/ui/compositor/test/draw_waiter_for_test.cc b/ui/compositor/test/draw_waiter_for_test.cc
index f256ecc..7687d66 100644
--- a/ui/compositor/test/draw_waiter_for_test.cc
+++ b/ui/compositor/test/draw_waiter_for_test.cc
@@ -9,24 +9,20 @@
namespace ui {
// static
-void DrawWaiterForTest::WaitForCompositingStarted(Compositor* compositor) {
- DrawWaiterForTest waiter(WAIT_FOR_COMPOSITING_STARTED);
- waiter.WaitImpl(compositor);
-}
-
-void DrawWaiterForTest::WaitForCompositingEnded(Compositor* compositor) {
- DrawWaiterForTest waiter(WAIT_FOR_COMPOSITING_ENDED);
+void DrawWaiterForTest::Wait(Compositor* compositor) {
+ DrawWaiterForTest waiter;
+ waiter.wait_for_commit_ = false;
waiter.WaitImpl(compositor);
}
// static
void DrawWaiterForTest::WaitForCommit(Compositor* compositor) {
- DrawWaiterForTest waiter(WAIT_FOR_COMMIT);
+ DrawWaiterForTest waiter;
+ waiter.wait_for_commit_ = true;
waiter.WaitImpl(compositor);
}
-DrawWaiterForTest::DrawWaiterForTest(WaitEvent wait_event)
- : wait_event_(wait_event) {
+DrawWaiterForTest::DrawWaiterForTest() {
}
DrawWaiterForTest::~DrawWaiterForTest() {}
@@ -39,18 +35,16 @@
}
void DrawWaiterForTest::OnCompositingDidCommit(Compositor* compositor) {
- if (wait_event_ == WAIT_FOR_COMMIT)
+ if (wait_for_commit_)
wait_run_loop_->Quit();
}
void DrawWaiterForTest::OnCompositingStarted(Compositor* compositor,
base::TimeTicks start_time) {
- if (wait_event_ == WAIT_FOR_COMPOSITING_STARTED)
- wait_run_loop_->Quit();
}
void DrawWaiterForTest::OnCompositingEnded(Compositor* compositor) {
- if (wait_event_ == WAIT_FOR_COMPOSITING_ENDED)
+ if (!wait_for_commit_)
wait_run_loop_->Quit();
}
diff --git a/ui/compositor/test/draw_waiter_for_test.h b/ui/compositor/test/draw_waiter_for_test.h
index 78acd01..9d8c169 100644
--- a/ui/compositor/test/draw_waiter_for_test.h
+++ b/ui/compositor/test/draw_waiter_for_test.h
@@ -20,22 +20,13 @@
// Waits for a draw to be issued by the compositor. If the test times out
// here, there may be a logic error in the compositor code causing it
// not to draw.
- static void WaitForCompositingStarted(Compositor* compositor);
-
- // Waits for a swap to be completed from the compositor.
- static void WaitForCompositingEnded(Compositor* compositor);
+ static void Wait(Compositor* compositor);
// Waits for a commit instead of a draw.
static void WaitForCommit(Compositor* compositor);
private:
- enum WaitEvent {
- WAIT_FOR_COMMIT,
- WAIT_FOR_COMPOSITING_STARTED,
- WAIT_FOR_COMPOSITING_ENDED,
- };
-
- DrawWaiterForTest(WaitEvent wait_event);
+ DrawWaiterForTest();
virtual ~DrawWaiterForTest();
void WaitImpl(Compositor* compositor);
@@ -50,7 +41,7 @@
scoped_ptr<base::RunLoop> wait_run_loop_;
- WaitEvent wait_event_;
+ bool wait_for_commit_;
DISALLOW_COPY_AND_ASSIGN(DrawWaiterForTest);
};
diff --git a/ui/compositor/test/test_compositor_host_mac.mm b/ui/compositor/test/test_compositor_host_mac.mm
index 12a97665..da3a8c2 100644
--- a/ui/compositor/test/test_compositor_host_mac.mm
+++ b/ui/compositor/test/test_compositor_host_mac.mm
@@ -40,7 +40,7 @@
- (void)drawRect:(NSRect)rect {
DCHECK(compositor_) << "Drawing with no compositor set.";
- compositor_->ScheduleFullRedraw();
+ compositor_->Draw();
}
@end
diff --git a/ui/compositor/test/test_compositor_host_ozone.cc b/ui/compositor/test/test_compositor_host_ozone.cc
index 0d3861e6..4871564 100644
--- a/ui/compositor/test/test_compositor_host_ozone.cc
+++ b/ui/compositor/test/test_compositor_host_ozone.cc
@@ -27,6 +27,8 @@
virtual void Show() override;
virtual ui::Compositor* GetCompositor() override;
+ void Draw();
+
gfx::Rect bounds_;
ui::ContextFactory* context_factory_;
@@ -62,6 +64,11 @@
return compositor_.get();
}
+void TestCompositorHostOzone::Draw() {
+ if (compositor_.get())
+ compositor_->Draw();
+}
+
// static
TestCompositorHost* TestCompositorHost::Create(
const gfx::Rect& bounds,
diff --git a/ui/compositor/test/test_compositor_host_win.cc b/ui/compositor/test/test_compositor_host_win.cc
index e89d092..99a5a85e 100644
--- a/ui/compositor/test/test_compositor_host_win.cc
+++ b/ui/compositor/test/test_compositor_host_win.cc
@@ -42,7 +42,7 @@
CR_END_MSG_MAP()
void OnPaint(HDC dc) {
- compositor_->ScheduleFullRedraw();
+ compositor_->Draw();
ValidateRect(hwnd(), NULL);
}
diff --git a/ui/compositor/test/test_compositor_host_x11.cc b/ui/compositor/test/test_compositor_host_x11.cc
index 0ee6284..d881d154 100644
--- a/ui/compositor/test/test_compositor_host_x11.cc
+++ b/ui/compositor/test/test_compositor_host_x11.cc
@@ -30,6 +30,8 @@
virtual void Show() override;
virtual ui::Compositor* GetCompositor() override;
+ void Draw();
+
gfx::Rect bounds_;
ui::ContextFactory* context_factory_;
@@ -83,6 +85,11 @@
return compositor_.get();
}
+void TestCompositorHostX11::Draw() {
+ if (compositor_.get())
+ compositor_->Draw();
+}
+
// static
TestCompositorHost* TestCompositorHost::Create(
const gfx::Rect& bounds,
diff --git a/ui/snapshot/snapshot_aura_unittest.cc b/ui/snapshot/snapshot_aura_unittest.cc
index c8e19d66..b5a2a66 100644
--- a/ui/snapshot/snapshot_aura_unittest.cc
+++ b/ui/snapshot/snapshot_aura_unittest.cc
@@ -115,8 +115,7 @@
void WaitForDraw() {
helper_->host()->compositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- helper_->host()->compositor());
+ ui::DrawWaiterForTest::Wait(helper_->host()->compositor());
}
void SetupTestWindow(const gfx::Rect& window_bounds) {
diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc
index 123b538..4f15a217 100644
--- a/ui/views/view_unittest.cc
+++ b/ui/views/view_unittest.cc
@@ -3087,23 +3087,20 @@
widget()->SetContentsView(content_view);
content_view->SetPaintToLayer(true);
GetRootLayer()->GetCompositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- GetRootLayer()->GetCompositor());
+ ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor());
GetRootLayer()->SchedulePaint(gfx::Rect(0, 0, 10, 10));
content_view->set_painted(false);
// content_view no longer has a dirty rect. Paint from the root and make sure
// PaintTrackingView isn't painted.
GetRootLayer()->GetCompositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- GetRootLayer()->GetCompositor());
+ ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor());
EXPECT_FALSE(content_view->painted());
// Make content_view have a dirty rect, paint the layers and make sure
// PaintTrackingView is painted.
content_view->layer()->SchedulePaint(gfx::Rect(0, 0, 10, 10));
GetRootLayer()->GetCompositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- GetRootLayer()->GetCompositor());
+ ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor());
EXPECT_TRUE(content_view->painted());
}
@@ -3343,15 +3340,13 @@
// Schedule a full-view paint to get everyone's rectangles updated.
test_view->SchedulePaintInRect(test_view->bounds());
GetRootLayer()->GetCompositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- GetRootLayer()->GetCompositor());
+ ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor());
// Now we have test_view - v1 - v2. Damage to only test_view should only
// return root_view and test_view.
test_view->SchedulePaintInRect(gfx::Rect(0, 0, 1, 1));
GetRootLayer()->GetCompositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- GetRootLayer()->GetCompositor());
+ ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor());
EXPECT_EQ(2U, test_view->last_cull_set_.size());
EXPECT_EQ(1U, test_view->last_cull_set_.count(widget()->GetRootView()));
EXPECT_EQ(1U, test_view->last_cull_set_.count(test_view));
@@ -3359,8 +3354,7 @@
// Damage to v1 only should only return root_view, test_view, and v1.
test_view->SchedulePaintInRect(gfx::Rect(11, 16, 1, 1));
GetRootLayer()->GetCompositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- GetRootLayer()->GetCompositor());
+ ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor());
EXPECT_EQ(3U, test_view->last_cull_set_.size());
EXPECT_EQ(1U, test_view->last_cull_set_.count(widget()->GetRootView()));
EXPECT_EQ(1U, test_view->last_cull_set_.count(test_view));
@@ -3370,8 +3364,7 @@
// on call to TestView::Paint(), along with the widget root view.
test_view->SchedulePaintInRect(gfx::Rect(31, 49, 1, 1));
GetRootLayer()->GetCompositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- GetRootLayer()->GetCompositor());
+ ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor());
EXPECT_EQ(4U, test_view->last_cull_set_.size());
EXPECT_EQ(1U, test_view->last_cull_set_.count(widget()->GetRootView()));
EXPECT_EQ(1U, test_view->last_cull_set_.count(test_view));
@@ -3398,15 +3391,13 @@
// Schedule a full-view paint to get everyone's rectangles updated.
test_view->SchedulePaintInRect(test_view->bounds());
GetRootLayer()->GetCompositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- GetRootLayer()->GetCompositor());
+ ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor());
// Damage to the right side of the parent view should touch both child views.
gfx::Rect rtl_damage(test_view->bounds().width() - 16, 18, 1, 1);
test_view->SchedulePaintInRect(rtl_damage);
GetRootLayer()->GetCompositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- GetRootLayer()->GetCompositor());
+ ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor());
EXPECT_EQ(4U, test_view->last_cull_set_.size());
EXPECT_EQ(1U, test_view->last_cull_set_.count(widget()->GetRootView()));
EXPECT_EQ(1U, test_view->last_cull_set_.count(test_view));
@@ -3418,8 +3409,7 @@
gfx::Rect ltr_damage(16, 18, 1, 1);
test_view->SchedulePaintInRect(ltr_damage);
GetRootLayer()->GetCompositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- GetRootLayer()->GetCompositor());
+ ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor());
EXPECT_EQ(2U, test_view->last_cull_set_.size());
EXPECT_EQ(1U, test_view->last_cull_set_.count(widget()->GetRootView()));
EXPECT_EQ(1U, test_view->last_cull_set_.count(test_view));
@@ -3443,21 +3433,18 @@
// Schedule a full-view paint to get everyone's rectangles updated.
test_view->SchedulePaintInRect(test_view->bounds());
GetRootLayer()->GetCompositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- GetRootLayer()->GetCompositor());
+ ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor());
// Move v1 to a new origin out of the way of our next query.
v1->SetBoundsRect(gfx::Rect(50, 60, 100, 101));
// The move will force a repaint.
GetRootLayer()->GetCompositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- GetRootLayer()->GetCompositor());
+ ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor());
// Schedule a paint with damage rect where v1 used to be.
test_view->SchedulePaintInRect(gfx::Rect(5, 6, 10, 11));
GetRootLayer()->GetCompositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- GetRootLayer()->GetCompositor());
+ ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor());
// Should only have picked up root_view and test_view.
EXPECT_EQ(2U, test_view->last_cull_set_.size());
@@ -3480,8 +3467,7 @@
// Schedule a full-view paint to get everyone's rectangles updated.
test_view->SchedulePaintInRect(test_view->bounds());
GetRootLayer()->GetCompositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- GetRootLayer()->GetCompositor());
+ ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor());
// Set v1 to paint to its own layer, it should remove itself from the
// test_view heiarchy and no longer intersect with damage rects in that cull
@@ -3491,8 +3477,7 @@
// Schedule another full-view paint.
test_view->SchedulePaintInRect(test_view->bounds());
GetRootLayer()->GetCompositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- GetRootLayer()->GetCompositor());
+ ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor());
// v1 and v2 should no longer be present in the test_view cull_set.
EXPECT_EQ(2U, test_view->last_cull_set_.size());
EXPECT_EQ(0U, test_view->last_cull_set_.count(v1));
@@ -3503,8 +3488,7 @@
// Schedule another full-view paint.
test_view->SchedulePaintInRect(test_view->bounds());
GetRootLayer()->GetCompositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- GetRootLayer()->GetCompositor());
+ ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor());
// We should be back to the full cull set including v1 and v2.
EXPECT_EQ(4U, test_view->last_cull_set_.size());
EXPECT_EQ(1U, test_view->last_cull_set_.count(widget()->GetRootView()));
@@ -3528,8 +3512,7 @@
// Schedule a full-view paint to get everyone's rectangles updated.
test_view->SchedulePaintInRect(test_view->bounds());
GetRootLayer()->GetCompositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- GetRootLayer()->GetCompositor());
+ ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor());
// Now remove v1 from the root view.
test_view->RemoveChildView(v1);
@@ -3537,8 +3520,7 @@
// Schedule another full-view paint.
test_view->SchedulePaintInRect(test_view->bounds());
GetRootLayer()->GetCompositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- GetRootLayer()->GetCompositor());
+ ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor());
// v1 and v2 should no longer be present in the test_view cull_set.
EXPECT_EQ(2U, test_view->last_cull_set_.size());
EXPECT_EQ(0U, test_view->last_cull_set_.count(v1));
@@ -3569,8 +3551,7 @@
// Schedule a full-view paint and ensure all views are present in the cull.
test_view->SchedulePaintInRect(test_view->bounds());
GetRootLayer()->GetCompositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- GetRootLayer()->GetCompositor());
+ ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor());
EXPECT_EQ(5U, test_view->last_cull_set_.size());
EXPECT_EQ(1U, test_view->last_cull_set_.count(widget()->GetRootView()));
EXPECT_EQ(1U, test_view->last_cull_set_.count(test_view));
@@ -3593,8 +3574,7 @@
test_view->SchedulePaintInRect(test_view->bounds());
widget_view->SchedulePaintInRect(widget_view->bounds());
GetRootLayer()->GetCompositor()->ScheduleDraw();
- ui::DrawWaiterForTest::WaitForCompositingEnded(
- GetRootLayer()->GetCompositor());
+ ui::DrawWaiterForTest::Wait(GetRootLayer()->GetCompositor());
// Only v1 should be present in the first cull set.
EXPECT_EQ(3U, test_view->last_cull_set_.size());