Created
June 3, 2013 13:43
-
-
Save noamr/5698218 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 6e51e92330b7d1bc792578fc492c912f82339d59 | |
Author: Noam Rosenthal <[email protected]> | |
Date: Wed May 29 11:56:59 2013 +0200 | |
Added scene locking capability | |
Added two functions, WKCoordinatedSceneLockState and WKCoordinatedSceneUnlockState. | |
Those should be called e.g. by responding to didStartProvisionalLoadForFrame or | |
didSameDocumentNavigationForFrame, to ensure that the state of the scene stays | |
the same as it was before the load until it is unlocked. | |
Change-Id: I0650b4204f2d365f64eab107b42384009ceb1fb1 | |
diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp | |
index 577114a..6dd00f4 100644 | |
--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp | |
+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.cpp | |
@@ -674,8 +674,23 @@ void CoordinatedGraphicsScene::commitPendingBackingStoreOperations() | |
m_backingStoresWithPendingBuffers.clear(); | |
} | |
+void CoordinatedGraphicsScene::commitPendingStateChange() | |
+{ | |
+ if (m_stateLocked || !m_pendingStateChange) | |
+ return; | |
+ | |
+ OwnPtr<CoordinatedGraphicsState> pendingChange = m_pendingStateChange.release(); | |
+ commitSceneState(*pendingChange.get()); | |
+} | |
+ | |
void CoordinatedGraphicsScene::commitSceneState(const CoordinatedGraphicsState& state) | |
{ | |
+ if (m_stateLocked) { | |
+ ASSERT(!m_pendingStateChange); | |
+ m_pendingStateChange = adoptPtr(new CoordinatedGraphicsState(state)); | |
+ return; | |
+ } | |
+ | |
m_renderedContentsScrollPosition = state.scrollPosition; | |
if (state.rootCompositingLayer != m_rootLayerID) | |
@@ -728,6 +743,7 @@ void CoordinatedGraphicsScene::ensureRootLayer() | |
void CoordinatedGraphicsScene::syncRemoteContent() | |
{ | |
// We enqueue messages and execute them during paint, as they require an active GL context. | |
+ commitPendingStateChange(); | |
ensureRootLayer(); | |
Vector<Function<void()> > renderQueue; | |
@@ -740,6 +756,7 @@ void CoordinatedGraphicsScene::syncRemoteContent() | |
for (size_t i = 0; i < renderQueue.size(); ++i) | |
renderQueue[i](); | |
+ | |
} | |
void CoordinatedGraphicsScene::purgeGLResources() | |
diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h | |
index 4542657..fc819da 100644 | |
--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h | |
+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsScene.h | |
@@ -146,6 +146,8 @@ public: | |
bool getLayerInfo(uint32_t id, WebCore::TextureMapperLayerInfo&); | |
+ void lockState() { m_stateLocked = true; } | |
+ void unlockState() { m_stateLocked = false; } | |
private: | |
void setRootLayerID(CoordinatedLayerID); | |
@@ -196,6 +198,7 @@ private: | |
void createBackingStoreIfNeeded(TextureMapperLayer*); | |
void removeBackingStoreIfNeeded(TextureMapperLayer*); | |
void resetBackingStoreSizeToLayerSize(TextureMapperLayer*); | |
+ void commitPendingStateChange(); | |
void dispatchCommitScrollOffset(uint32_t layerID, const IntSize& offset); | |
@@ -249,6 +252,9 @@ private: | |
TextureMapperFPSCounter m_fpsCounter; | |
CoordinatedGraphicsSceneObserver* m_observer; | |
+ | |
+ bool m_stateLocked; | |
+ OwnPtr<CoordinatedGraphicsState> m_pendingStateChange; | |
}; | |
} // namespace WebCore | |
diff --git a/Source/WebKit2/UIProcess/API/CoordinatedGraphics/WKCoordinatedScene.cpp b/Source/WebKit2/UIProcess/API/CoordinatedGraphics/WKCoordinatedScene.cpp | |
index 6fae51c..ef5ff3c 100644 | |
--- a/Source/WebKit2/UIProcess/API/CoordinatedGraphics/WKCoordinatedScene.cpp | |
+++ b/Source/WebKit2/UIProcess/API/CoordinatedGraphics/WKCoordinatedScene.cpp | |
@@ -76,4 +76,15 @@ WK_EXPORT void WKCoordinatedSceneSetClient(WKCoordinatedScene scene, const WKCoo | |
delete toImpl(scene)->observer(); | |
toImpl(scene)->setObserver(new SceneObserver(client)); | |
} | |
+ | |
+WK_EXPORT void WKCoordinatedSceneLockState(WKCoordinatedScene scene) | |
+{ | |
+ toImpl(scene)->lockState(); | |
+} | |
+ | |
+WK_EXPORT void WKCoordinatedSceneUnlockState(WKCoordinatedScene scene) | |
+{ | |
+ toImpl(scene)->unlockState(); | |
+} | |
+ | |
#endif | |
diff --git a/Source/WebKit2/UIProcess/API/CoordinatedGraphics/WKCoordinatedScene.h b/Source/WebKit2/UIProcess/API/CoordinatedGraphics/WKCoordinatedScene.h | |
index 86fb187..b8b0523 100644 | |
--- a/Source/WebKit2/UIProcess/API/CoordinatedGraphics/WKCoordinatedScene.h | |
+++ b/Source/WebKit2/UIProcess/API/CoordinatedGraphics/WKCoordinatedScene.h | |
@@ -54,6 +54,9 @@ WK_EXPORT uint32_t WKCoordinatedSceneGetLayerID(WKCoordinatedSceneLayer); | |
WK_EXPORT void WKCoordinatedSceneScrollBy(WKCoordinatedSceneLayer, WKSize); | |
WK_EXPORT void WKCoordinatedSceneSetClient(WKCoordinatedScene, const WKCoordinatedSceneClient*); | |
+WK_EXPORT void WKCoordinatedSceneLockState(WKCoordinatedScene); | |
+WK_EXPORT void WKCoordinatedSceneUnlockState(WKCoordinatedScene); | |
+ | |
#ifdef __cplusplus | |
} | |
#endif // __cplusplus |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment