Diff
Modified: trunk/Source/WebCore/ChangeLog (117170 => 117171)
--- trunk/Source/WebCore/ChangeLog 2012-05-15 22:34:05 UTC (rev 117170)
+++ trunk/Source/WebCore/ChangeLog 2012-05-15 22:51:01 UTC (rev 117171)
@@ -1,3 +1,41 @@
+2012-05-15 Ian Vollick <[email protected]>
+
+ [chromium] Ensure animations get ticked at least once when added.
+ https://bugs.webkit.org/show_bug.cgi?id=86013
+
+ Reviewed by James Robinson.
+
+ Tested in
+ CCLayerTreeHostTestTickAnimationWhileBackgrounded.runSingleThreaded
+ CCLayerTreeHostTestAddAnimationWithTimingFunction.runSingleThreaded
+ CCLayerTreeHostTestSynchronizeAnimationStartTimes.runSingleThreaded
+ CCLayerTreeHostTestAnimationFinishedEvents.runSingleThreaded
+
+ * platform/graphics/chromium/LayerChromium.cpp:
+ (WebCore::LayerChromium::addAnimation):
+ * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+ (WebCore::CCLayerTreeHost::finishCommitOnImplThread):
+ (WebCore::CCLayerTreeHost::didAddAnimation):
+ (WebCore):
+ (WebCore::CCLayerTreeHost::didBecomeInvisibleOnImplThread):
+ * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+ (CCLayerTreeHost):
+ * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:
+ (WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl):
+ * platform/graphics/chromium/cc/CCProxy.h:
+ (CCProxy):
+ * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
+ (CCSingleThreadProxyAnimationTimer):
+ (WebCore::CCSingleThreadProxyAnimationTimer::create):
+ (WebCore::CCSingleThreadProxyAnimationTimer::CCSingleThreadProxyAnimationTimer):
+ (WebCore):
+ (WebCore::CCSingleThreadProxy::CCSingleThreadProxy):
+ (WebCore::CCSingleThreadProxy::didAddAnimation):
+ (WebCore::CCSingleThreadProxy::doComposite):
+ * platform/graphics/chromium/cc/CCSingleThreadProxy.h:
+ (WebCore):
+ * platform/graphics/chromium/cc/CCThreadProxy.h:
+
2012-05-15 Alexandre Elias <[email protected]>
[chromium] Fix unsafe viewport tag dispatch
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp (117170 => 117171)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp 2012-05-15 22:34:05 UTC (rev 117170)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp 2012-05-15 22:51:01 UTC (rev 117171)
@@ -600,8 +600,10 @@
return false;
bool addedAnimation = m_layerAnimationController->addAnimation(values, boxSize, animation, animationId, groupId, timeOffset);
- if (addedAnimation)
+ if (addedAnimation) {
+ m_layerTreeHost->didAddAnimation();
setNeedsCommit();
+ }
return addedAnimation;
}
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (117170 => 117171)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp 2012-05-15 22:34:05 UTC (rev 117170)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp 2012-05-15 22:51:01 UTC (rev 117171)
@@ -233,10 +233,8 @@
// We may have added an animation during the tree sync. This will cause both layer tree hosts
// to visit their controllers.
- if (rootLayer()) {
+ if (rootLayer() && m_needsAnimateLayers)
hostImpl->setNeedsAnimateLayers();
- m_needsAnimateLayers = true;
- }
hostImpl->setSourceFrameNumber(frameNumber());
hostImpl->setViewportSize(viewportSize());
@@ -339,6 +337,12 @@
setAnimationEventsRecursive(*events, m_rootLayer.get(), wallClockTime);
}
+void CCLayerTreeHost::didAddAnimation()
+{
+ m_needsAnimateLayers = true;
+ m_proxy->didAddAnimation();
+}
+
void CCLayerTreeHost::setRootLayer(PassRefPtr<LayerChromium> rootLayer)
{
if (m_rootLayer == rootLayer)
@@ -407,10 +411,8 @@
// We may have added an animation during the tree sync. This will cause both layer tree hosts
// to visit their controllers.
- if (rootLayer()) {
+ if (rootLayer() && m_needsAnimateLayers)
hostImpl->setNeedsAnimateLayers();
- m_needsAnimateLayers = true;
- }
}
void CCLayerTreeHost::setContentsMemoryAllocationLimitBytes(size_t bytes)
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h (117170 => 117171)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h 2012-05-15 22:34:05 UTC (rev 117170)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h 2012-05-15 22:51:01 UTC (rev 117171)
@@ -198,6 +198,7 @@
bool commitRequested() const;
void setAnimationEvents(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime);
+ void didAddAnimation();
LayerChromium* rootLayer() { return m_rootLayer.get(); }
const LayerChromium* rootLayer() const { return m_rootLayer.get(); }
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp (117170 => 117171)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp 2012-05-15 22:34:05 UTC (rev 117170)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp 2012-05-15 22:51:01 UTC (rev 117171)
@@ -119,7 +119,7 @@
, m_maxPageScale(0)
, m_needsAnimateLayers(false)
, m_pinchGestureActive(false)
- , m_timeSourceClientAdapter(CCLayerTreeHostImplTimeSourceAdapter::create(this, CCDelayBasedTimeSource::create(lowFrequencyAnimationInterval * 1000.0, CCProxy::currentThread())))
+ , m_timeSourceClientAdapter(CCLayerTreeHostImplTimeSourceAdapter::create(this, CCDelayBasedTimeSource::create(lowFrequencyAnimationInterval, CCProxy::currentThread())))
, m_fpsCounter(CCFrameRateCounter::create())
, m_debugRectHistory(CCDebugRectHistory::create())
{
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h (117170 => 117171)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h 2012-05-15 22:34:05 UTC (rev 117170)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h 2012-05-15 22:51:01 UTC (rev 117171)
@@ -86,6 +86,8 @@
virtual void setNeedsRedraw() = 0;
virtual void setVisible(bool) = 0;
+ virtual void didAddAnimation() = 0;
+
virtual bool commitRequested() const = 0;
virtual void start() = 0; // Must be called before using the proxy.
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp (117170 => 117171)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp 2012-05-15 22:34:05 UTC (rev 117170)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp 2012-05-15 22:51:01 UTC (rev 117171)
@@ -32,12 +32,35 @@
#include "cc/CCFontAtlas.h"
#include "cc/CCLayerTreeHost.h"
#include "cc/CCTextureUpdater.h"
+#include "cc/CCTimer.h"
#include <wtf/CurrentTime.h>
using namespace WTF;
namespace WebCore {
+class CCSingleThreadProxyAnimationTimer : public CCTimer, CCTimerClient {
+public:
+ static PassOwnPtr<CCSingleThreadProxyAnimationTimer> create(CCSingleThreadProxy* proxy) { return adoptPtr(new CCSingleThreadProxyAnimationTimer(proxy)); }
+
+ virtual void onTimerFired() OVERRIDE
+ {
+ m_proxy->compositeImmediately();
+ }
+
+private:
+ explicit CCSingleThreadProxyAnimationTimer(CCSingleThreadProxy* proxy)
+ : CCTimer(CCProxy::mainThread(), this)
+ , m_proxy(proxy)
+ {
+ }
+
+ CCSingleThreadProxy* m_proxy;
+};
+
+// Measured in seconds.
+static const double animationTimerDelay = 1 / 60.0;
+
PassOwnPtr<CCProxy> CCSingleThreadProxy::create(CCLayerTreeHost* layerTreeHost)
{
return adoptPtr(new CCSingleThreadProxy(layerTreeHost));
@@ -47,6 +70,7 @@
: m_layerTreeHost(layerTreeHost)
, m_contextLost(false)
, m_compositorIdentifier(-1)
+ , m_animationTimer(CCSingleThreadProxyAnimationTimer::create(this))
, m_layerRendererInitialized(false)
, m_nextFrameIsNewlyCommittedFrame(false)
{
@@ -260,6 +284,11 @@
setNeedsCommit();
}
+void CCSingleThreadProxy::didAddAnimation()
+{
+ m_animationTimer->startOneShot(animationTimerDelay);
+}
+
void CCSingleThreadProxy::stop()
{
TRACE_EVENT("CCSingleThreadProxy::stop", this, 0);
@@ -331,21 +360,22 @@
{
ASSERT(!m_contextLost);
{
- DebugScopedSetImplThread impl;
- double monotonicTime = monotonicallyIncreasingTime();
- double wallClockTime = currentTime();
- m_layerTreeHostImpl->animate(monotonicTime, wallClockTime);
+ DebugScopedSetImplThread impl;
+ double monotonicTime = monotonicallyIncreasingTime();
+ double wallClockTime = currentTime();
- // We guard prepareToDraw() with canDraw() because it always returns a valid frame, so can only
- // be used when such a frame is possible. Since drawLayers() depends on the result of
- // prepareToDraw(), it is guarded on canDraw() as well.
- if (!m_layerTreeHostImpl->canDraw())
- return false;
+ m_layerTreeHostImpl->animate(monotonicTime, wallClockTime);
- CCLayerTreeHostImpl::FrameData frame;
- m_layerTreeHostImpl->prepareToDraw(frame);
- m_layerTreeHostImpl->drawLayers(frame);
- m_layerTreeHostImpl->didDrawAllLayers(frame);
+ // We guard prepareToDraw() with canDraw() because it always returns a valid frame, so can only
+ // be used when such a frame is possible. Since drawLayers() depends on the result of
+ // prepareToDraw(), it is guarded on canDraw() as well.
+ if (!m_layerTreeHostImpl->canDraw())
+ return false;
+
+ CCLayerTreeHostImpl::FrameData frame;
+ m_layerTreeHostImpl->prepareToDraw(frame);
+ m_layerTreeHostImpl->drawLayers(frame);
+ m_layerTreeHostImpl->didDrawAllLayers(frame);
}
if (m_layerTreeHostImpl->isContextLost()) {
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h (117170 => 117171)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h 2012-05-15 22:34:05 UTC (rev 117170)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h 2012-05-15 22:51:01 UTC (rev 117171)
@@ -35,6 +35,7 @@
namespace WebCore {
class CCLayerTreeHost;
+class CCSingleThreadProxyAnimationTimer;
class CCSingleThreadProxy : public CCProxy, CCLayerTreeHostImplClient {
public:
@@ -59,6 +60,7 @@
virtual void setNeedsRedraw() OVERRIDE;
virtual bool commitRequested() const OVERRIDE;
virtual void setVisible(bool) OVERRIDE;
+ virtual void didAddAnimation() OVERRIDE;
virtual void start() OVERRIDE;
virtual void stop() OVERRIDE;
virtual size_t maxPartialTextureUpdates() const OVERRIDE { return std::numeric_limits<size_t>::max(); }
@@ -94,6 +96,8 @@
// be used for anything else.
RefPtr<GraphicsContext3D> m_contextBeforeInitialization;
+ OwnPtr<CCSingleThreadProxyAnimationTimer> m_animationTimer;
+
// Used on the CCThread, but checked on main thread during initialization/shutdown.
OwnPtr<CCLayerTreeHostImpl> m_layerTreeHostImpl;
bool m_layerRendererInitialized;
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h (117170 => 117171)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h 2012-05-15 22:34:05 UTC (rev 117170)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h 2012-05-15 22:51:01 UTC (rev 117171)
@@ -68,6 +68,7 @@
virtual void setNeedsRedraw() OVERRIDE;
virtual bool commitRequested() const OVERRIDE;
virtual void setVisible(bool) OVERRIDE;
+ virtual void didAddAnimation() OVERRIDE { }
virtual void start() OVERRIDE;
virtual void stop() OVERRIDE;
virtual size_t maxPartialTextureUpdates() const OVERRIDE;
Modified: trunk/Source/WebKit/chromium/ChangeLog (117170 => 117171)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-05-15 22:34:05 UTC (rev 117170)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-05-15 22:51:01 UTC (rev 117171)
@@ -1,3 +1,14 @@
+2012-05-15 Ian Vollick <[email protected]>
+
+ [chromium] Ensure animations get ticked at least once when added.
+ https://bugs.webkit.org/show_bug.cgi?id=86013
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerTreeHostTest.cpp:
+ (WTF::CCLayerTreeHostTestTickAnimationWhileBackgrounded::animateLayers):
+ (WTF):
+
2012-05-15 Alexandre Elias <[email protected]>
[chromium] Fix unsafe viewport tag dispatch
Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (117170 => 117171)
--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp 2012-05-15 22:34:05 UTC (rev 117170)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp 2012-05-15 22:51:01 UTC (rev 117171)
@@ -1140,9 +1140,11 @@
virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime)
{
- if (!m_numAnimates) {
- // We have a long animation running. It should continue to tick even if we are not visible.
- postSetVisibleToMainThread(false);
+ if (m_numAnimates < 2) {
+ if (!m_numAnimates) {
+ // We have a long animation running. It should continue to tick even if we are not visible.
+ postSetVisibleToMainThread(false);
+ }
m_numAnimates++;
return;
}
@@ -1157,15 +1159,7 @@
int m_numAnimates;
};
-#if OS(WINDOWS)
-// http://webkit.org/b/74623
-TEST_F(CCLayerTreeHostTestTickAnimationWhileBackgrounded, FLAKY_runMultiThread)
-#else
-TEST_F(CCLayerTreeHostTestTickAnimationWhileBackgrounded, runMultiThread)
-#endif
-{
- runTestThreaded();
-}
+SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestTickAnimationWhileBackgrounded)
// Ensures that animations continue to be ticked when we are backgrounded.
class CCLayerTreeHostTestAddAnimationWithTimingFunction : public CCLayerTreeHostTestThreadOnly {
@@ -1200,15 +1194,7 @@
private:
};
-#if OS(WINDOWS)
-// http://webkit.org/b/74623
-TEST_F(CCLayerTreeHostTestAddAnimationWithTimingFunction, FLAKY_runMultiThread)
-#else
-TEST_F(CCLayerTreeHostTestAddAnimationWithTimingFunction, runMultiThread)
-#endif
-{
- runTestThreaded();
-}
+SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestAddAnimationWithTimingFunction)
// Ensures that when opacity is being animated, this value does not cause the subtree to be skipped.
class CCLayerTreeHostTestDoNotSkipLayersWithAnimatedOpacity : public CCLayerTreeHostTestThreadOnly {
@@ -1290,10 +1276,7 @@
CCLayerTreeHostImpl* m_layerTreeHostImpl;
};
-TEST_F(CCLayerTreeHostTestSynchronizeAnimationStartTimes, runMultiThread)
-{
- runTestThreaded();
-}
+SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestSynchronizeAnimationStartTimes)
// Ensures that main thread animations have their start times synchronized with impl thread animations.
class CCLayerTreeHostTestAnimationFinishedEvents : public CCLayerTreeHostTestThreadOnly {
@@ -1319,10 +1302,7 @@
private:
};
-TEST_F(CCLayerTreeHostTestAnimationFinishedEvents, runMultiThread)
-{
- runTestThreaded();
-}
+SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestAnimationFinishedEvents)
class CCLayerTreeHostTestScrollSimple : public CCLayerTreeHostTestThreadOnly {
public: