OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/compositor/compositor.h" | 5 #include "ui/compositor/compositor.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 173 |
174 // Stop all outstanding draws before telling the ContextFactory to tear | 174 // Stop all outstanding draws before telling the ContextFactory to tear |
175 // down any contexts that the |host_| may rely upon. | 175 // down any contexts that the |host_| may rely upon. |
176 host_.reset(); | 176 host_.reset(); |
177 | 177 |
178 ContextFactory::GetInstance()->RemoveCompositor(this); | 178 ContextFactory::GetInstance()->RemoveCompositor(this); |
179 } | 179 } |
180 | 180 |
181 void Compositor::ScheduleDraw() { | 181 void Compositor::ScheduleDraw() { |
182 if (compositor_thread_loop_) { | 182 if (compositor_thread_loop_) { |
183 host_->Composite(gfx::FrameTime::Now()); | 183 host_->SetNeedsCommit(); |
184 } else if (!defer_draw_scheduling_) { | 184 } else if (!defer_draw_scheduling_) { |
185 defer_draw_scheduling_ = true; | 185 defer_draw_scheduling_ = true; |
186 base::MessageLoop::current()->PostTask( | 186 base::MessageLoop::current()->PostTask( |
187 FROM_HERE, | 187 FROM_HERE, |
188 base::Bind(&Compositor::Draw, schedule_draw_factory_.GetWeakPtr())); | 188 base::Bind(&Compositor::Draw, schedule_draw_factory_.GetWeakPtr())); |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 void Compositor::SetRootLayer(Layer* root_layer) { | 192 void Compositor::SetRootLayer(Layer* root_layer) { |
193 if (root_layer_ == root_layer) | 193 if (root_layer_ == root_layer) |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 // CompositorObservers to be notified before starting another | 402 // CompositorObservers to be notified before starting another |
403 // draw cycle. | 403 // draw cycle. |
404 ScheduleDraw(); | 404 ScheduleDraw(); |
405 } | 405 } |
406 FOR_EACH_OBSERVER(CompositorObserver, | 406 FOR_EACH_OBSERVER(CompositorObserver, |
407 observer_list_, | 407 observer_list_, |
408 OnCompositingEnded(this)); | 408 OnCompositingEnded(this)); |
409 } | 409 } |
410 | 410 |
411 } // namespace ui | 411 } // namespace ui |
OLD | NEW |