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

Unified Diff: ui/aura/root_window.cc

Issue 12226080: Thread ui transform animations (Closed) Base URL: http://git.chromium.org/chromium/src.git@DefineThreadedLayerAnimationElements
Patch Set: Fix WebContentsViewAuraTest.QuickOverscrollDirectionChange Created 7 years, 10 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: ui/aura/root_window.cc
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc
index 7ff474f23f7a43b4abc033c9a8b640e1c28af8c1..68de1bf5bfd0bfe3634d5e376227a5fdea20e854 100644
--- a/ui/aura/root_window.cc
+++ b/ui/aura/root_window.cc
@@ -430,6 +430,10 @@ gfx::Point RootWindow::GetLastMouseLocationInRoot() const {
return location;
}
+void RootWindow::DelayDrawsForTesting(base::TimeDelta delay) {
+ draw_scheduling_delay_for_testing_ = delay;
+}
+
////////////////////////////////////////////////////////////////////////////////
// RootWindow, Window overrides:
@@ -463,11 +467,19 @@ ui::EventTarget* RootWindow::GetParentTarget() {
// RootWindow, ui::CompositorDelegate implementation:
void RootWindow::ScheduleDraw() {
- if (!defer_draw_scheduling_) {
- defer_draw_scheduling_ = true;
+ if (defer_draw_scheduling_)
+ return;
+
+ defer_draw_scheduling_ = true;
+ if (draw_scheduling_delay_for_testing_ == base::TimeDelta()) {
MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&RootWindow::Draw, schedule_paint_factory_.GetWeakPtr()));
+ } else {
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&RootWindow::Draw, schedule_paint_factory_.GetWeakPtr()),
+ draw_scheduling_delay_for_testing_);
}
}

Powered by Google App Engine
This is Rietveld 408576698