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

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

Issue 152883002: (Concept patch) Simplify WTF::HashTable::add() return value for size and performance (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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
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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 if (m_keyframeGroups) 239 if (m_keyframeGroups)
240 return; 240 return;
241 241
242 m_keyframeGroups = adoptPtr(new KeyframeGroupMap); 242 m_keyframeGroups = adoptPtr(new KeyframeGroupMap);
243 const KeyframeVector keyframes = normalizedKeyframes(getFrames()); 243 const KeyframeVector keyframes = normalizedKeyframes(getFrames());
244 for (KeyframeVector::const_iterator keyframeIter = keyframes.begin(); keyfra meIter != keyframes.end(); ++keyframeIter) { 244 for (KeyframeVector::const_iterator keyframeIter = keyframes.begin(); keyfra meIter != keyframes.end(); ++keyframeIter) {
245 const Keyframe* keyframe = keyframeIter->get(); 245 const Keyframe* keyframe = keyframeIter->get();
246 PropertySet keyframeProperties = keyframe->properties(); 246 PropertySet keyframeProperties = keyframe->properties();
247 for (PropertySet::const_iterator propertyIter = keyframeProperties.begin (); propertyIter != keyframeProperties.end(); ++propertyIter) { 247 for (PropertySet::const_iterator propertyIter = keyframeProperties.begin (); propertyIter != keyframeProperties.end(); ++propertyIter) {
248 CSSPropertyID property = *propertyIter; 248 CSSPropertyID property = *propertyIter;
249 KeyframeGroupMap::iterator groupIter = m_keyframeGroups->find(proper ty); 249 KeyframeGroupMap::iterator groupIter = m_keyframeGroups->find(proper ty);
Erik Corry 2014/02/04 14:27:15 This might be more elegant if there were a version
250 if (groupIter == m_keyframeGroups->end()) { 250 if (groupIter == m_keyframeGroups->end()) {
251 KeyframeGroupMap::AddResult result = m_keyframeGroups->add(prope rty, adoptPtr(new PropertySpecificKeyframeGroup)); 251 KeyframeGroupMap::AddResult result = m_keyframeGroups->add(prope rty, adoptPtr(new PropertySpecificKeyframeGroup));
252 ASSERT(result.isNewEntry); 252 ASSERT(result.isNewEntry);
253 groupIter = result.iterator; 253 result.iterator->value->appendKeyframe(adoptPtr(
254 } 254 new PropertySpecificKeyframe(keyframe->offset(), keyframe->prope rtyValue(property), keyframe->composite())));
Erik Corry 2014/02/04 14:27:15 Funny indentation, and there's a chunk of repeated
255 } else {
255 groupIter->value->appendKeyframe(adoptPtr( 256 groupIter->value->appendKeyframe(adoptPtr(
256 new PropertySpecificKeyframe(keyframe->offset(), keyframe->prope rtyValue(property), keyframe->composite()))); 257 new PropertySpecificKeyframe(keyframe->offset(), keyframe->prope rtyValue(property), keyframe->composite())));
258 }
257 } 259 }
258 } 260 }
259 261
260 // Add synthetic keyframes. 262 // Add synthetic keyframes.
261 for (KeyframeGroupMap::iterator iter = m_keyframeGroups->begin(); iter != m_ keyframeGroups->end(); ++iter) { 263 for (KeyframeGroupMap::iterator iter = m_keyframeGroups->begin(); iter != m_ keyframeGroups->end(); ++iter) {
262 iter->value->addSyntheticKeyframeIfRequired(); 264 iter->value->addSyntheticKeyframeIfRequired();
263 iter->value->removeRedundantKeyframes(); 265 iter->value->removeRedundantKeyframes();
264 } 266 }
265 } 267 }
266 268
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 376
375 if ((*before)->offset() == offset) 377 if ((*before)->offset() == offset)
376 return const_cast<CompositableValue*>((*before)->value()); 378 return const_cast<CompositableValue*>((*before)->value());
377 if ((*after)->offset() == offset) 379 if ((*after)->offset() == offset)
378 return const_cast<CompositableValue*>((*after)->value()); 380 return const_cast<CompositableValue*>((*after)->value());
379 return BlendedCompositableValue::create((*before)->value(), (*after)->value( ), 381 return BlendedCompositableValue::create((*before)->value(), (*after)->value( ),
380 (offset - (*before)->offset()) / ((*after)->offset() - (*before)->offset ())); 382 (offset - (*before)->offset()) / ((*after)->offset() - (*before)->offset ()));
381 } 383 }
382 384
383 } // namespace 385 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698