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

Side by Side Diff: Source/core/inspector/InspectorAnimationAgent.cpp

Issue 1137833004: Devtools Animations: Update timeline reset condition (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/inspector/InspectorAnimationAgent.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 6
7 #include "core/inspector/InspectorAnimationAgent.h" 7 #include "core/inspector/InspectorAnimationAgent.h"
8 8
9 #include "core/animation/Animation.h" 9 #include "core/animation/Animation.h"
10 #include "core/animation/AnimationEffect.h" 10 #include "core/animation/AnimationEffect.h"
(...skipping 18 matching lines...) Expand all
29 namespace AnimationAgentState { 29 namespace AnimationAgentState {
30 static const char animationAgentEnabled[] = "animationAgentEnabled"; 30 static const char animationAgentEnabled[] = "animationAgentEnabled";
31 } 31 }
32 32
33 namespace blink { 33 namespace blink {
34 34
35 InspectorAnimationAgent::InspectorAnimationAgent(InspectorPageAgent* pageAgent, InspectorDOMAgent* domAgent) 35 InspectorAnimationAgent::InspectorAnimationAgent(InspectorPageAgent* pageAgent, InspectorDOMAgent* domAgent)
36 : InspectorBaseAgent<InspectorAnimationAgent, InspectorFrontend::Animation>( "Animation") 36 : InspectorBaseAgent<InspectorAnimationAgent, InspectorFrontend::Animation>( "Animation")
37 , m_pageAgent(pageAgent) 37 , m_pageAgent(pageAgent)
38 , m_domAgent(domAgent) 38 , m_domAgent(domAgent)
39 , m_latestStartTime(std::numeric_limits<double>::min())
39 { 40 {
40 } 41 }
41 42
42 void InspectorAnimationAgent::restore() 43 void InspectorAnimationAgent::restore()
43 { 44 {
44 if (m_state->getBoolean(AnimationAgentState::animationAgentEnabled)) { 45 if (m_state->getBoolean(AnimationAgentState::animationAgentEnabled)) {
45 ErrorString error; 46 ErrorString error;
46 enable(&error); 47 enable(&error);
47 } 48 }
48 } 49 }
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 timing->setDelay(delay); 295 timing->setDelay(delay);
295 } 296 }
296 } 297 }
297 298
298 void InspectorAnimationAgent::didCreateAnimation(Animation* player) 299 void InspectorAnimationAgent::didCreateAnimation(Animation* player)
299 { 300 {
300 const String& playerId = String::number(player->sequenceNumber()); 301 const String& playerId = String::number(player->sequenceNumber());
301 if (m_idToAnimation.get(playerId)) 302 if (m_idToAnimation.get(playerId))
302 return; 303 return;
303 304
304 // Check threshold 305 double threshold = 1000;
305 double latestStartTime = 0; 306 bool reset = normalizedStartTime(*player) - threshold > m_latestStartTime;
306 for (const auto& p : m_idToAnimation.values()) 307 m_latestStartTime = normalizedStartTime(*player);
307 latestStartTime = max(latestStartTime, normalizedStartTime(*p)); 308 if (reset) {
308
309 bool reset = false;
310 const double threshold = 1000;
311 if (normalizedStartTime(*player) - latestStartTime > threshold) {
312 reset = true;
313 m_idToAnimation.clear(); 309 m_idToAnimation.clear();
314 m_idToAnimationType.clear(); 310 m_idToAnimationType.clear();
315 } 311 }
316 312
317 frontend()->animationPlayerCreated(buildObjectForAnimationPlayer(*player), r eset); 313 frontend()->animationPlayerCreated(buildObjectForAnimationPlayer(*player), r eset);
318 } 314 }
319 315
320 void InspectorAnimationAgent::didCancelAnimation(Animation* player) 316 void InspectorAnimationAgent::didCancelAnimation(Animation* player)
321 { 317 {
322 const String& playerId = String::number(player->sequenceNumber()); 318 const String& playerId = String::number(player->sequenceNumber());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 #if ENABLE(OILPAN) 356 #if ENABLE(OILPAN)
361 visitor->trace(m_pageAgent); 357 visitor->trace(m_pageAgent);
362 visitor->trace(m_domAgent); 358 visitor->trace(m_domAgent);
363 visitor->trace(m_idToAnimation); 359 visitor->trace(m_idToAnimation);
364 visitor->trace(m_idToAnimationType); 360 visitor->trace(m_idToAnimationType);
365 #endif 361 #endif
366 InspectorBaseAgent::trace(visitor); 362 InspectorBaseAgent::trace(visitor);
367 } 363 }
368 364
369 } 365 }
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorAnimationAgent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698