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

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

Issue 353083002: AnimationTimeline::serviceAnimations should reserveInitialCapacity (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | « no previous file | 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 /* 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 m_timing->serviceOnNextFrame(); 93 m_timing->serviceOnNextFrame();
94 } 94 }
95 95
96 void AnimationTimeline::serviceAnimations(TimingUpdateReason reason) 96 void AnimationTimeline::serviceAnimations(TimingUpdateReason reason)
97 { 97 {
98 TRACE_EVENT0("blink", "AnimationTimeline::serviceAnimations"); 98 TRACE_EVENT0("blink", "AnimationTimeline::serviceAnimations");
99 99
100 m_timing->cancelWake(); 100 m_timing->cancelWake();
101 101
102 double timeToNextEffect = std::numeric_limits<double>::infinity(); 102 double timeToNextEffect = std::numeric_limits<double>::infinity();
103
103 WillBeHeapVector<RawPtrWillBeMember<AnimationPlayer> > players; 104 WillBeHeapVector<RawPtrWillBeMember<AnimationPlayer> > players;
105 players.reserveInitialCapacity(m_playersNeedingUpdate.size());
104 for (WillBeHeapHashSet<RefPtrWillBeMember<AnimationPlayer> >::iterator it = m_playersNeedingUpdate.begin(); it != m_playersNeedingUpdate.end(); ++it) 106 for (WillBeHeapHashSet<RefPtrWillBeMember<AnimationPlayer> >::iterator it = m_playersNeedingUpdate.begin(); it != m_playersNeedingUpdate.end(); ++it)
105 players.append(it->get()); 107 players.append(it->get());
106 108
107 std::sort(players.begin(), players.end(), AnimationPlayer::hasLowerPriority) ; 109 std::sort(players.begin(), players.end(), AnimationPlayer::hasLowerPriority) ;
108 110
109 for (size_t i = 0; i < players.size(); ++i) { 111 for (size_t i = 0; i < players.size(); ++i) {
110 AnimationPlayer* player = players[i]; 112 AnimationPlayer* player = players[i];
111 if (player->update(reason)) 113 if (player->update(reason))
112 timeToNextEffect = std::min(timeToNextEffect, player->timeToEffectCh ange()); 114 timeToNextEffect = std::min(timeToNextEffect, player->timeToEffectCh ange());
113 else 115 else
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 226
225 void AnimationTimeline::trace(Visitor* visitor) 227 void AnimationTimeline::trace(Visitor* visitor)
226 { 228 {
227 visitor->trace(m_document); 229 visitor->trace(m_document);
228 visitor->trace(m_timing); 230 visitor->trace(m_timing);
229 visitor->trace(m_playersNeedingUpdate); 231 visitor->trace(m_playersNeedingUpdate);
230 visitor->trace(m_players); 232 visitor->trace(m_players);
231 } 233 }
232 234
233 } // namespace 235 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698