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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 | 58 |
59 bool CompositorPendingAnimations::update(bool startOnCompositor) | 59 bool CompositorPendingAnimations::update(bool startOnCompositor) |
60 { | 60 { |
61 HeapVector<Member<Animation>> waitingForStartTime; | 61 HeapVector<Member<Animation>> waitingForStartTime; |
62 bool startedSynchronizedOnCompositor = false; | 62 bool startedSynchronizedOnCompositor = false; |
63 | 63 |
64 HeapVector<Member<Animation>> animations; | 64 HeapVector<Member<Animation>> animations; |
65 HeapVector<Member<Animation>> deferred; | 65 HeapVector<Member<Animation>> deferred; |
66 animations.swap(m_pending); | 66 animations.swap(m_pending); |
67 int compositorGroup = ++m_compositorGroup; | 67 int compositorGroup = ++m_compositorGroup; |
68 if (compositorGroup == 0) { | 68 while (compositorGroup == 0 || compositorGroup == 1) { |
alancutter (OOO until 2018)
2015/09/16 05:35:30
Nit: We should use an enum instead of magic number
| |
69 // Wrap around, skipping 0. | 69 // Wrap around, skipping 0, 1. |
70 // * 0 is reserved for automatic assignment | |
71 // * 1 is used for animations with a specified start time | |
70 compositorGroup = ++m_compositorGroup; | 72 compositorGroup = ++m_compositorGroup; |
71 } | 73 } |
72 | 74 |
73 for (auto& animation : animations) { | 75 for (auto& animation : animations) { |
74 bool hadCompositorAnimation = animation->hasActiveAnimationsOnCompositor (); | 76 bool hadCompositorAnimation = animation->hasActiveAnimationsOnCompositor (); |
75 if (animation->preCommit(compositorGroup, startOnCompositor)) { | 77 // Animations with a start time do not participate in compositor start-t ime grouping. |
78 if (animation->preCommit(animation->hasStartTime() ? 1 : compositorGroup , startOnCompositor)) { | |
76 if (animation->hasActiveAnimationsOnCompositor() && !hadCompositorAn imation) { | 79 if (animation->hasActiveAnimationsOnCompositor() && !hadCompositorAn imation) { |
77 startedSynchronizedOnCompositor = true; | 80 startedSynchronizedOnCompositor = true; |
78 } | 81 } |
79 | 82 |
80 if (animation->playing() && !animation->hasStartTime()) { | 83 if (animation->playing() && !animation->hasStartTime()) { |
81 waitingForStartTime.append(animation.get()); | 84 waitingForStartTime.append(animation.get()); |
82 } | 85 } |
83 } else { | 86 } else { |
84 deferred.append(animation); | 87 deferred.append(animation); |
85 } | 88 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 | 156 |
154 } | 157 } |
155 | 158 |
156 DEFINE_TRACE(CompositorPendingAnimations) | 159 DEFINE_TRACE(CompositorPendingAnimations) |
157 { | 160 { |
158 visitor->trace(m_pending); | 161 visitor->trace(m_pending); |
159 visitor->trace(m_waitingForCompositorAnimationStart); | 162 visitor->trace(m_waitingForCompositorAnimationStart); |
160 } | 163 } |
161 | 164 |
162 } // namespace | 165 } // namespace |
OLD | NEW |