[chromium] Use WebGraphicsContext3D in rate limiting logic inside compositor
[WebKit.git] / Source / WebCore / platform / graphics / chromium / TextureLayerChromium.cpp
index 73844926417cccf16c61c550e42991be1bfea4f9..3b12870a2d07b846b4f41a9ca9d5f36733254a32 100644 (file)
@@ -30,6 +30,7 @@
 #include "TextureLayerChromium.h"
 
 #include "Extensions3D.h"
+#include "GraphicsContext3DPrivate.h"
 #include "cc/CCLayerTreeHost.h"
 #include "cc/CCTextureLayerImpl.h"
 
@@ -58,7 +59,7 @@ TextureLayerChromium::~TextureLayerChromium()
         if (m_textureId)
             layerTreeHost()->acquireLayerTextures();
         if (m_rateLimitContext && m_client)
-            layerTreeHost()->stopRateLimiter(m_client->context());
+            layerTreeHost()->stopRateLimiter(GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_client->context()));
     }
 }
 
@@ -88,7 +89,7 @@ void TextureLayerChromium::setPremultipliedAlpha(bool premultipliedAlpha)
 void TextureLayerChromium::setRateLimitContext(bool rateLimit)
 {
     if (!rateLimit && m_rateLimitContext && m_client && layerTreeHost())
-        layerTreeHost()->stopRateLimiter(m_client->context());
+        layerTreeHost()->stopRateLimiter(GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_client->context()));
 
     m_rateLimitContext = rateLimit;
 }
@@ -103,12 +104,18 @@ void TextureLayerChromium::setTextureId(unsigned id)
     setNeedsCommit();
 }
 
+void TextureLayerChromium::willModifyTexture()
+{
+    if (layerTreeHost())
+        layerTreeHost()->acquireLayerTextures();
+}
+
 void TextureLayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect)
 {
     LayerChromium::setNeedsDisplayRect(dirtyRect);
 
     if (m_rateLimitContext && m_client && layerTreeHost())
-        layerTreeHost()->startRateLimiter(m_client->context());
+        layerTreeHost()->startRateLimiter(GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_client->context()));
 }
 
 void TextureLayerChromium::setLayerTreeHost(CCLayerTreeHost* host)