OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 Document* document = animation->timeline()->document(); | 47 Document* document = animation->timeline()->document(); |
48 if (document->view()) | 48 if (document->view()) |
49 document->view()->scheduleAnimation(); | 49 document->view()->scheduleAnimation(); |
50 | 50 |
51 bool visible = document->page() && document->page()->isPageVisible(); | 51 bool visible = document->page() && document->page()->isPageVisible(); |
52 if (!visible && !m_timer.isActive()) { | 52 if (!visible && !m_timer.isActive()) { |
53 m_timer.startOneShot(0, BLINK_FROM_HERE); | 53 m_timer.startOneShot(0, BLINK_FROM_HERE); |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 bool CompositorPendingAnimations::update(bool startOnCompositor) { | 57 bool CompositorPendingAnimations::update( |
| 58 const Optional<CompositorElementIdSet>& compositedAnimationElementIds, |
| 59 bool startOnCompositor) { |
58 HeapVector<Member<Animation>> waitingForStartTime; | 60 HeapVector<Member<Animation>> waitingForStartTime; |
59 bool startedSynchronizedOnCompositor = false; | 61 bool startedSynchronizedOnCompositor = false; |
60 | 62 |
61 HeapVector<Member<Animation>> animations; | 63 HeapVector<Member<Animation>> animations; |
62 HeapVector<Member<Animation>> deferred; | 64 HeapVector<Member<Animation>> deferred; |
63 animations.swap(m_pending); | 65 animations.swap(m_pending); |
64 int compositorGroup = ++m_compositorGroup; | 66 int compositorGroup = ++m_compositorGroup; |
65 while (compositorGroup == 0 || compositorGroup == 1) { | 67 while (compositorGroup == 0 || compositorGroup == 1) { |
66 // Wrap around, skipping 0, 1. | 68 // Wrap around, skipping 0, 1. |
67 // * 0 is reserved for automatic assignment | 69 // * 0 is reserved for automatic assignment |
68 // * 1 is used for animations with a specified start time | 70 // * 1 is used for animations with a specified start time |
69 compositorGroup = ++m_compositorGroup; | 71 compositorGroup = ++m_compositorGroup; |
70 } | 72 } |
71 | 73 |
72 for (auto& animation : animations) { | 74 for (auto& animation : animations) { |
73 bool hadCompositorAnimation = animation->hasActiveAnimationsOnCompositor(); | 75 bool hadCompositorAnimation = animation->hasActiveAnimationsOnCompositor(); |
74 // Animations with a start time do not participate in compositor start-time | 76 // Animations with a start time do not participate in compositor start-time |
75 // grouping. | 77 // grouping. |
76 if (animation->preCommit(animation->hasStartTime() ? 1 : compositorGroup, | 78 if (animation->preCommit(animation->hasStartTime() ? 1 : compositorGroup, |
| 79 compositedAnimationElementIds, |
77 startOnCompositor)) { | 80 startOnCompositor)) { |
78 if (animation->hasActiveAnimationsOnCompositor() && | 81 if (animation->hasActiveAnimationsOnCompositor() && |
79 !hadCompositorAnimation) { | 82 !hadCompositorAnimation) { |
80 startedSynchronizedOnCompositor = true; | 83 startedSynchronizedOnCompositor = true; |
81 } | 84 } |
82 | 85 |
83 if (animation->playing() && !animation->hasStartTime() && | 86 if (animation->playing() && !animation->hasStartTime() && |
84 animation->timeline() && animation->timeline()->isActive()) { | 87 animation->timeline() && animation->timeline()->isActive()) { |
85 waitingForStartTime.push_back(animation.get()); | 88 waitingForStartTime.push_back(animation.get()); |
86 } | 89 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 animation->timeline()->zeroTime()); | 163 animation->timeline()->zeroTime()); |
161 } | 164 } |
162 } | 165 } |
163 | 166 |
164 DEFINE_TRACE(CompositorPendingAnimations) { | 167 DEFINE_TRACE(CompositorPendingAnimations) { |
165 visitor->trace(m_pending); | 168 visitor->trace(m_pending); |
166 visitor->trace(m_waitingForCompositorAnimationStart); | 169 visitor->trace(m_waitingForCompositorAnimationStart); |
167 } | 170 } |
168 | 171 |
169 } // namespace blink | 172 } // namespace blink |
OLD | NEW |