 Chromium Code Reviews
 Chromium Code Reviews Issue 135693003:
  Defer starting of animations until after compositing update  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk
    
  
    Issue 135693003:
  Defer starting of animations until after compositing update  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk| OLD | NEW | 
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" | 
| 6 #include "core/page/PageAnimator.h" | 6 #include "core/page/PageAnimator.h" | 
| 7 | 7 | 
| 8 #include "core/animation/DocumentAnimations.h" | 8 #include "core/animation/DocumentAnimations.h" | 
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" | 
| 10 #include "core/frame/Frame.h" | 10 #include "core/frame/Frame.h" | 
| 11 #include "core/frame/FrameView.h" | 11 #include "core/frame/FrameView.h" | 
| 12 #include "core/page/Page.h" | 12 #include "core/page/Page.h" | 
| 13 | 13 | 
| 14 namespace WebCore { | 14 namespace WebCore { | 
| 15 | 15 | 
| 16 PageAnimator::PageAnimator(Page* page) | 16 PageAnimator::PageAnimator(Page* page) | 
| 17 : m_page(page) | 17 : m_page(page) | 
| 18 , m_servicingAnimations(false) | 18 , m_servicingAnimations(false) | 
| 19 { | 19 { | 
| 20 } | 20 } | 
| 21 | 21 | 
| 22 void PageAnimator::serviceScriptedAnimations(double monotonicAnimationStartTime) | 22 void PageAnimator::serviceScriptedAnimations(double monotonicAnimationStartTime) | 
| 23 { | 23 { | 
| 24 TemporaryChange<bool> servicing(m_servicingAnimations, true); | 24 TemporaryChange<bool> servicing(m_servicingAnimations, true); | 
| 25 | 25 | 
| 26 for (RefPtr<Frame> frame = m_page->mainFrame(); frame; frame = frame->tree() .traverseNext()) { | 26 for (RefPtr<Frame> frame = m_page->mainFrame(); frame; frame = frame->tree() .traverseNext()) { | 
| 27 frame->view()->serviceScrollAnimations(); | 27 frame->view()->serviceScrollAnimations(); | 
| 28 DocumentAnimations::serviceOnAnimationFrame(*frame->document(), monotoni cAnimationStartTime); | 28 DocumentAnimations::updateAnimationTimingForAnimationFrame(*frame->docum ent(), monotonicAnimationStartTime); | 
| 29 DocumentAnimations::dispatchAnimationEvents(*frame->document()); | |
| 
abarth-chromium
2014/02/24 06:14:08
Given that this function is dispatching events, do
 
dstockwell
2014/02/24 06:58:07
Will do. Looks like we can use the same collection
 | |
| 29 } | 30 } | 
| 30 | 31 | 
| 31 Vector<RefPtr<Document> > documents; | 32 Vector<RefPtr<Document> > documents; | 
| 32 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver seNext()) | 33 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver seNext()) | 
| 33 documents.append(frame->document()); | 34 documents.append(frame->document()); | 
| 
abarth-chromium
2014/02/24 06:14:08
Notice that we collect up the documents here befor
 | |
| 34 | 35 | 
| 35 for (size_t i = 0; i < documents.size(); ++i) | 36 for (size_t i = 0; i < documents.size(); ++i) | 
| 36 documents[i]->serviceScriptedAnimations(monotonicAnimationStartTime); | 37 documents[i]->serviceScriptedAnimations(monotonicAnimationStartTime); | 
| 37 } | 38 } | 
| 38 | 39 | 
| 39 } | 40 } | 
| OLD | NEW |