Diff
Modified: trunk/Source/WebCore/ChangeLog (124907 => 124908)
--- trunk/Source/WebCore/ChangeLog 2012-08-07 19:30:16 UTC (rev 124907)
+++ trunk/Source/WebCore/ChangeLog 2012-08-07 19:49:11 UTC (rev 124908)
@@ -1,3 +1,31 @@
+2012-08-07 No'am Rosenthal <[email protected]>
+
+ GraphicsLayerAnimation shouldn't use HashMap<String>
+ https://bugs.webkit.org/show_bug.cgi?id=93284
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Use a vector containing all the animations instead of a map of String to Vector.
+ The HashMap contains very few elements, which makes it inefficient relatively to a vector.
+ This has been shown to be a bottleneck in valgrind.
+
+ Covered by existing animation tests.
+
+ * platform/graphics/GraphicsLayerAnimation.cpp:
+ (WebCore::GraphicsLayerAnimation::GraphicsLayerAnimation):
+ (WebCore::GraphicsLayerAnimations::hasActiveAnimationsOfType):
+ (WebCore::GraphicsLayerAnimations::hasRunningAnimations):
+ (WebCore::GraphicsLayerAnimations::add):
+ (WebCore::GraphicsLayerAnimations::pause):
+ (WebCore::GraphicsLayerAnimations::remove):
+ (WebCore::GraphicsLayerAnimations::apply):
+ * platform/graphics/GraphicsLayerAnimation.h:
+ (GraphicsLayerAnimation):
+ (WebCore::GraphicsLayerAnimation::name):
+ (GraphicsLayerAnimations):
+ * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
+ (WebCore::GraphicsLayerTextureMapper::addAnimation):
+
2012-08-07 Marcelo Lira <[email protected]>
[Qt] Add support for the Gamepad API
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp (124907 => 124908)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp 2012-08-07 19:30:16 UTC (rev 124907)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp 2012-08-07 19:49:11 UTC (rev 124908)
@@ -155,10 +155,11 @@
}
-GraphicsLayerAnimation::GraphicsLayerAnimation(const KeyframeValueList& keyframes, const IntSize& boxSize, const Animation* animation, double timeOffset, bool listsMatch)
+GraphicsLayerAnimation::GraphicsLayerAnimation(const String& name, const KeyframeValueList& keyframes, const IntSize& boxSize, const Animation* animation, double timeOffset, bool listsMatch)
: m_keyframes(keyframes)
, m_boxSize(boxSize)
, m_animation(Animation::create(animation))
+ , m_name(name)
, m_listsMatch(listsMatch)
, m_startTime(WTF::currentTime() - timeOffset)
, m_pauseTime(0)
@@ -190,26 +191,18 @@
bool GraphicsLayerAnimations::hasActiveAnimationsOfType(AnimatedPropertyID type) const
{
- HashMap<String, Vector<GraphicsLayerAnimation> >::const_iterator end = m_animations.end();
- for (HashMap<String, Vector<GraphicsLayerAnimation> >::const_iterator it = m_animations.begin(); it != end; ++it) {
- const Vector<GraphicsLayerAnimation>& animations = it->second;
- for (size_t i = 0; i < animations.size(); ++i) {
- if (animations[i].isActive() && animations[i].property() == type)
- return true;
- }
+ for (size_t i = 0; i < m_animations.size(); ++i) {
+ if (m_animations[i].isActive() && m_animations[i].property() == type)
+ return true;
}
return false;
}
bool GraphicsLayerAnimations::hasRunningAnimations() const
{
- HashMap<String, Vector<GraphicsLayerAnimation> >::const_iterator end = m_animations.end();
- for (HashMap<String, Vector<GraphicsLayerAnimation> >::const_iterator it = m_animations.begin(); it != end; ++it) {
- const Vector<GraphicsLayerAnimation>& animations = it->second;
- for (size_t i = 0; i < animations.size(); ++i) {
- if (animations[i].state() == GraphicsLayerAnimation::PlayingState)
- return true;
- }
+ for (size_t i = 0; i < m_animations.size(); ++i) {
+ if (m_animations[i].state() == GraphicsLayerAnimation::PlayingState)
+ return true;
}
return false;
@@ -264,36 +257,31 @@
m_pauseTime = WTF::currentTime() - offset;
}
-void GraphicsLayerAnimations::add(const String& name, const GraphicsLayerAnimation& animation)
+void GraphicsLayerAnimations::add(const GraphicsLayerAnimation& animation)
{
- HashMap<String, Vector<GraphicsLayerAnimation> >::iterator it = m_animations.find(name);
- if (it != m_animations.end()) {
- it->second.append(animation);
- return;
- }
-
- Vector<GraphicsLayerAnimation> animations;
- animations.append(animation);
- m_animations.add(name, animations);
+ m_animations.append(animation);
}
void GraphicsLayerAnimations::pause(const String& name, double offset)
{
- HashMap<String, Vector<GraphicsLayerAnimation> >::iterator it = m_animations.find(name);
- if (it == m_animations.end())
- return;
+ for (size_t i = 0; i < m_animations.size(); ++i) {
+ if (m_animations[i].name() == name)
+ m_animations[i].pause(offset);
+ }
+}
- for (size_t i = 0; i < it->second.size(); i++)
- it->second[i].pause(offset);
+void GraphicsLayerAnimations::remove(const String& name)
+{
+ for (int i = m_animations.size() - 1; i >= 0; --i) {
+ if (m_animations[i].name() == name)
+ m_animations.remove(i);
+ }
}
void GraphicsLayerAnimations::apply(GraphicsLayerAnimation::Client* client)
{
- HashMap<String, Vector<GraphicsLayerAnimation> >::iterator end = m_animations.end();
- for (HashMap<String, Vector<GraphicsLayerAnimation> >::iterator it = m_animations.begin(); it != end; ++it) {
- for (size_t i = 0; i < it->second.size(); ++i)
- it->second[i].apply(client);
- }
+ for (size_t i = 0; i < m_animations.size(); ++i)
+ m_animations[i].apply(client);
}
}
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayerAnimation.h (124907 => 124908)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayerAnimation.h 2012-08-07 19:30:16 UTC (rev 124907)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayerAnimation.h 2012-08-07 19:49:11 UTC (rev 124908)
@@ -41,13 +41,14 @@
GraphicsLayerAnimation()
: m_keyframes(AnimatedPropertyInvalid)
{ }
- GraphicsLayerAnimation(const KeyframeValueList&, const IntSize&, const Animation*, double, bool);
+ GraphicsLayerAnimation(const String&, const KeyframeValueList&, const IntSize&, const Animation*, double, bool);
void apply(Client*);
void pause(double);
AnimationState state() const { return m_state; }
void setState(AnimationState s) { m_state = s; }
AnimatedPropertyID property() const { return m_keyframes.property(); }
bool isActive() const;
+ String name() const { return m_name; }
private:
void applyInternal(Client*, const AnimationValue* from, const AnimationValue* to, float progress);
@@ -66,8 +67,8 @@
public:
GraphicsLayerAnimations() { }
- void add(const String&, const GraphicsLayerAnimation&);
- void remove(const String& name) { m_animations.remove(name); }
+ void add(const GraphicsLayerAnimation&);
+ void remove(const String& name);
void pause(const String&, double);
void apply(GraphicsLayerAnimation::Client*);
bool isEmpty() const { return m_animations.isEmpty(); }
@@ -76,7 +77,7 @@
bool hasActiveAnimationsOfType(AnimatedPropertyID type) const;
private:
- HashMap<String, Vector<GraphicsLayerAnimation> > m_animations;
+ Vector<GraphicsLayerAnimation> m_animations;
};
}
Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp (124907 => 124908)
--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp 2012-08-07 19:30:16 UTC (rev 124907)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp 2012-08-07 19:49:11 UTC (rev 124908)
@@ -378,7 +378,7 @@
if (valueList.property() == AnimatedPropertyWebkitTransform)
listsMatch = validateTransformOperations(valueList, hasBigRotation) >= 0;
- m_animations.add(keyframesName, GraphicsLayerAnimation(valueList, boxSize, anim, timeOffset, listsMatch));
+ m_animations.add(GraphicsLayerAnimation(keyframesName, valueList, boxSize, anim, timeOffset, listsMatch));
notifyChange(TextureMapperLayer::AnimationChange);
m_animationStartedTimer.startOneShot(0);
return true;
Modified: trunk/Source/WebKit2/ChangeLog (124907 => 124908)
--- trunk/Source/WebKit2/ChangeLog 2012-08-07 19:30:16 UTC (rev 124907)
+++ trunk/Source/WebKit2/ChangeLog 2012-08-07 19:49:11 UTC (rev 124908)
@@ -1,5 +1,17 @@
2012-08-07 No'am Rosenthal <[email protected]>
+ GraphicsLayerAnimation shouldn't use HashMap<String>
+ https://bugs.webkit.org/show_bug.cgi?id=93284
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Apply the changes to GraphicsLayerAnimation API.
+
+ * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp:
+ (WebCore::CoordinatedGraphicsLayer::addAnimation):
+
+2012-08-07 No'am Rosenthal <[email protected]>
+
[Qt] Make it possible to build without QtQuick
Reviewed by Simon Hausmann.
Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp (124907 => 124908)
--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp 2012-08-07 19:30:16 UTC (rev 124907)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp 2012-08-07 19:49:11 UTC (rev 124908)
@@ -794,7 +794,7 @@
if (valueList.property() == AnimatedPropertyWebkitTransform)
listsMatch = validateTransformOperations(valueList, ignoredHasBigRotation) >= 0;
- m_animations.add(keyframesName, GraphicsLayerAnimation(valueList, boxSize, anim, timeOffset, listsMatch));
+ m_animations.add(GraphicsLayerAnimation(keyframesName, valueList, boxSize, anim, timeOffset, listsMatch));
m_animationStartedTimer.startOneShot(0);
didChangeLayerState();
return true;