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

Side by Side Diff: Source/core/animation/DocumentTimeline.cpp

Issue 172003002: Web Animations: Don't mark players as outdated upon currentTime access (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@currentplayers
Patch Set: add test Created 6 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/animation/Player.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 void DocumentTimeline::wake() 86 void DocumentTimeline::wake()
87 { 87 {
88 m_timing->serviceOnNextFrame(); 88 m_timing->serviceOnNextFrame();
89 } 89 }
90 90
91 void DocumentTimeline::serviceAnimations() 91 void DocumentTimeline::serviceAnimations()
92 { 92 {
93 TRACE_EVENT0("webkit", "DocumentTimeline::serviceAnimations"); 93 TRACE_EVENT0("webkit", "DocumentTimeline::serviceAnimations");
94 94
95 m_timing->cancelWake(); 95 m_timing->cancelWake();
96 m_hasOutdatedPlayer = false;
96 97
97 double timeToNextEffect = std::numeric_limits<double>::infinity(); 98 double timeToNextEffect = std::numeric_limits<double>::infinity();
98 Vector<Player*> playersToRemove; 99 Vector<Player*> playersToRemove;
99 for (HashSet<RefPtr<Player> >::iterator it = m_playersNeedingUpdate.begin(); it != m_playersNeedingUpdate.end(); ++it) { 100 for (HashSet<RefPtr<Player> >::iterator it = m_playersNeedingUpdate.begin(); it != m_playersNeedingUpdate.end(); ++it) {
100 Player* player = it->get(); 101 Player* player = it->get();
101 if (!player->update()) 102 if (!player->update())
102 playersToRemove.append(player); 103 playersToRemove.append(player);
103 timeToNextEffect = std::min(timeToNextEffect, player->timeToEffectChange ()); 104 timeToNextEffect = std::min(timeToNextEffect, player->timeToEffectChange ());
104 } 105 }
105 for (size_t i = 0; i < playersToRemove.size(); ++i) 106 for (size_t i = 0; i < playersToRemove.size(); ++i)
106 m_playersNeedingUpdate.remove(playersToRemove[i]); 107 m_playersNeedingUpdate.remove(playersToRemove[i]);
107 108
108 ASSERT(!m_playersNeedingUpdate.isEmpty() || timeToNextEffect == std::numeric _limits<double>::infinity()); 109 ASSERT(!m_playersNeedingUpdate.isEmpty() || timeToNextEffect == std::numeric _limits<double>::infinity());
109 if (timeToNextEffect < s_minimumDelay) 110 if (timeToNextEffect < s_minimumDelay)
110 m_timing->serviceOnNextFrame(); 111 m_timing->serviceOnNextFrame();
111 else if (timeToNextEffect != std::numeric_limits<double>::infinity()) 112 else if (timeToNextEffect != std::numeric_limits<double>::infinity())
112 m_timing->wakeAfter(timeToNextEffect - s_minimumDelay); 113 m_timing->wakeAfter(timeToNextEffect - s_minimumDelay);
113 114
114 m_hasOutdatedPlayer = false; 115 ASSERT(!m_hasOutdatedPlayer);
115 } 116 }
116 117
117 void DocumentTimeline::setZeroTime(double zeroTime) 118 void DocumentTimeline::setZeroTime(double zeroTime)
118 { 119 {
119 ASSERT(isNull(m_zeroTime)); 120 ASSERT(isNull(m_zeroTime));
120 m_zeroTime = zeroTime; 121 m_zeroTime = zeroTime;
121 ASSERT(!isNull(m_zeroTime)); 122 ASSERT(!isNull(m_zeroTime));
122 serviceAnimations(); 123 serviceAnimations();
123 } 124 }
124 125
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 count += (timedItem && (timedItem->isCurrent() || timedItem->isInEff ect())); 176 count += (timedItem && (timedItem->isCurrent() || timedItem->isInEff ect()));
176 } 177 }
177 return count; 178 return count;
178 } 179 }
179 180
180 void DocumentTimeline::detachFromDocument() { 181 void DocumentTimeline::detachFromDocument() {
181 m_document = 0; 182 m_document = 0;
182 } 183 }
183 184
184 } // namespace 185 } // namespace
OLDNEW
« no previous file with comments | « no previous file | Source/core/animation/Player.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698