summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-31 23:55:40 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-31 23:55:40 +0000
commitbe3aa6f0ce5a7e3d3da22a08566dbc75a8115351 (patch)
tree6d254adb89f64293f843ad234ad1b80fa184867d /cc
parentcf8d7a3068a3fec5f7616ab586956a066e611422 (diff)
downloadchromium_src-be3aa6f0ce5a7e3d3da22a08566dbc75a8115351.zip
chromium_src-be3aa6f0ce5a7e3d3da22a08566dbc75a8115351.tar.gz
chromium_src-be3aa6f0ce5a7e3d3da22a08566dbc75a8115351.tar.bz2
Roll cc snapshot up to r127311
BUG= Review URL: https://chromiumcodereview.appspot.com/10919041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154542 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/CCLayerTreeHost.cpp1
-rw-r--r--cc/CCLayerTreeHost.h23
-rw-r--r--cc/CCLayerTreeHostClient.h41
-rw-r--r--cc/CCLayerTreeHostCommonTest.cpp13
-rw-r--r--cc/CCLayerTreeHostTest.cpp41
-rw-r--r--cc/ContentLayerChromium.cpp27
-rw-r--r--cc/ContentLayerChromium.h23
-rw-r--r--cc/ContentLayerChromiumClient.h24
-rw-r--r--cc/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp11
-rw-r--r--cc/TextureLayerChromium.cpp1
-rw-r--r--cc/TextureLayerChromium.h15
-rw-r--r--cc/TextureLayerChromiumClient.h31
-rw-r--r--cc/cc.gyp3
13 files changed, 161 insertions, 93 deletions
diff --git a/cc/CCLayerTreeHost.cpp b/cc/CCLayerTreeHost.cpp
index 10320a9..f236963 100644
--- a/cc/CCLayerTreeHost.cpp
+++ b/cc/CCLayerTreeHost.cpp
@@ -11,6 +11,7 @@
#include "CCHeadsUpDisplayLayerImpl.h"
#include "CCLayerAnimationController.h"
#include "CCLayerIterator.h"
+#include "CCLayerTreeHostClient.h"
#include "CCLayerTreeHostCommon.h"
#include "CCLayerTreeHostImpl.h"
#include "CCOcclusionTracker.h"
diff --git a/cc/CCLayerTreeHost.h b/cc/CCLayerTreeHost.h
index 0bddc46..65b6854 100644
--- a/cc/CCLayerTreeHost.h
+++ b/cc/CCLayerTreeHost.h
@@ -7,6 +7,7 @@
#include "CCAnimationEvents.h"
#include "CCGraphicsContext.h"
+#include "CCLayerTreeHostClient.h"
#include "CCLayerTreeHostCommon.h"
#include "CCOcclusionTracker.h"
#include "CCPrioritizedTextureManager.h"
@@ -33,28 +34,6 @@ class HeadsUpDisplayLayerChromium;
class Region;
struct CCScrollAndScaleSet;
-class CCLayerTreeHostClient {
-public:
- virtual void willBeginFrame() = 0;
- // Marks finishing compositing-related tasks on the main thread. In threaded mode, this corresponds to didCommit().
- virtual void didBeginFrame() = 0;
- virtual void animate(double frameBeginTime) = 0;
- virtual void layout() = 0;
- virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) = 0;
- virtual PassOwnPtr<WebKit::WebCompositorOutputSurface> createOutputSurface() = 0;
- virtual void didRecreateOutputSurface(bool success) = 0;
- virtual void willCommit() = 0;
- virtual void didCommit() = 0;
- virtual void didCommitAndDrawFrame() = 0;
- virtual void didCompleteSwapBuffers() = 0;
-
- // Used only in the single-threaded path.
- virtual void scheduleComposite() = 0;
-
-protected:
- virtual ~CCLayerTreeHostClient() { }
-};
-
struct CCLayerTreeSettings {
CCLayerTreeSettings()
: acceleratePainting(false)
diff --git a/cc/CCLayerTreeHostClient.h b/cc/CCLayerTreeHostClient.h
new file mode 100644
index 0000000..389e5dc
--- /dev/null
+++ b/cc/CCLayerTreeHostClient.h
@@ -0,0 +1,41 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CCLayerTreeHostClient_h
+#define CCLayerTreeHostClient_h
+
+#include <wtf/PassOwnPtr.h>
+
+namespace WebKit {
+class WebCompositorOutputSurface;
+}
+
+namespace WebCore {
+class IntSize;
+
+class CCLayerTreeHostClient {
+public:
+ virtual void willBeginFrame() = 0;
+ // Marks finishing compositing-related tasks on the main thread. In threaded mode, this corresponds to didCommit().
+ virtual void didBeginFrame() = 0;
+ virtual void animate(double frameBeginTime) = 0;
+ virtual void layout() = 0;
+ virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) = 0;
+ virtual PassOwnPtr<WebKit::WebCompositorOutputSurface> createOutputSurface() = 0;
+ virtual void didRecreateOutputSurface(bool success) = 0;
+ virtual void willCommit() = 0;
+ virtual void didCommit() = 0;
+ virtual void didCommitAndDrawFrame() = 0;
+ virtual void didCompleteSwapBuffers() = 0;
+
+ // Used only in the single-threaded path.
+ virtual void scheduleComposite() = 0;
+
+protected:
+ virtual ~CCLayerTreeHostClient() { }
+};
+
+}
+
+#endif // CCLayerTreeHostClient_h
diff --git a/cc/CCLayerTreeHostCommonTest.cpp b/cc/CCLayerTreeHostCommonTest.cpp
index ee9077a..34c9940 100644
--- a/cc/CCLayerTreeHostCommonTest.cpp
+++ b/cc/CCLayerTreeHostCommonTest.cpp
@@ -16,6 +16,7 @@
#include "CCSingleThreadProxy.h"
#include "CCThread.h"
#include "ContentLayerChromium.h"
+#include "ContentLayerChromiumClient.h"
#include "LayerChromium.h"
#include <gmock/gmock.h>
@@ -3360,14 +3361,14 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists)
EXPECT_EQ(4, resultLayer->id());
}
-class MockContentLayerDelegate : public ContentLayerDelegate {
+class MockContentLayerChromiumClient : public ContentLayerChromiumClient {
public:
- MockContentLayerDelegate() { }
- virtual ~MockContentLayerDelegate() { }
+ MockContentLayerChromiumClient() { }
+ virtual ~MockContentLayerChromiumClient() { }
virtual void paintContents(SkCanvas*, const IntRect& clip, FloatRect& opaque) OVERRIDE { }
};
-PassRefPtr<ContentLayerChromium> createDrawableContentLayerChromium(ContentLayerDelegate* delegate)
+PassRefPtr<ContentLayerChromium> createDrawableContentLayerChromium(ContentLayerChromiumClient* delegate)
{
RefPtr<ContentLayerChromium> toReturn = ContentLayerChromium::create(delegate);
toReturn->setIsDrawable(true);
@@ -3377,7 +3378,7 @@ PassRefPtr<ContentLayerChromium> createDrawableContentLayerChromium(ContentLayer
TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI)
{
// Verify draw and screen space transforms of layers not in a surface.
- MockContentLayerDelegate delegate;
+ MockContentLayerChromiumClient delegate;
WebTransformationMatrix identityMatrix;
RefPtr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&delegate);
@@ -3449,7 +3450,7 @@ TEST(CCLayerTreeHostCommonTest, verifyLayerTransformsInHighDPI)
TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI)
{
- MockContentLayerDelegate delegate;
+ MockContentLayerChromiumClient delegate;
WebTransformationMatrix identityMatrix;
RefPtr<ContentLayerChromium> parent = createDrawableContentLayerChromium(&delegate);
diff --git a/cc/CCLayerTreeHostTest.cpp b/cc/CCLayerTreeHostTest.cpp
index 9828f85..794760f 100644
--- a/cc/CCLayerTreeHostTest.cpp
+++ b/cc/CCLayerTreeHostTest.cpp
@@ -15,6 +15,7 @@
#include "CCThreadedTest.h"
#include "CCTimingFunction.h"
#include "ContentLayerChromium.h"
+#include "ContentLayerChromiumClient.h"
#include "Extensions3DChromium.h"
#include "FakeWebCompositorOutputSurface.h"
#include <gmock/gmock.h>
@@ -1169,7 +1170,7 @@ TEST_F(CCLayerTreeHostTestSetVisible, runMultiThread)
runTest(true);
}
-class TestOpacityChangeLayerDelegate : public ContentLayerDelegate {
+class TestOpacityChangeLayerDelegate : public ContentLayerChromiumClient {
public:
TestOpacityChangeLayerDelegate(CCLayerTreeHostTest* test)
: m_test(test)
@@ -1188,7 +1189,7 @@ private:
class ContentLayerChromiumWithUpdateTracking : public ContentLayerChromium {
public:
- static PassRefPtr<ContentLayerChromiumWithUpdateTracking> create(ContentLayerDelegate *delegate) { return adoptRef(new ContentLayerChromiumWithUpdateTracking(delegate)); }
+ static PassRefPtr<ContentLayerChromiumWithUpdateTracking> create(ContentLayerChromiumClient* client) { return adoptRef(new ContentLayerChromiumWithUpdateTracking(client)); }
int paintContentsCount() { return m_paintContentsCount; }
void resetPaintContentsCount() { m_paintContentsCount = 0; }
@@ -1200,8 +1201,8 @@ public:
}
private:
- explicit ContentLayerChromiumWithUpdateTracking(ContentLayerDelegate* delegate)
- : ContentLayerChromium(delegate)
+ explicit ContentLayerChromiumWithUpdateTracking(ContentLayerChromiumClient* client)
+ : ContentLayerChromium(client)
, m_paintContentsCount(0)
{
setAnchorPoint(FloatPoint(0, 0));
@@ -1253,7 +1254,7 @@ TEST_F(CCLayerTreeHostTestOpacityChange, runMultiThread)
runTest(true);
}
-class MockContentLayerDelegate : public ContentLayerDelegate {
+class MockContentLayerChromiumClient : public ContentLayerChromiumClient {
public:
bool drawsContent() const { return true; }
MOCK_CONST_METHOD0(preserves3D, bool());
@@ -1265,8 +1266,8 @@ class CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers : public CCLay
public:
CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers()
- : m_rootLayer(ContentLayerChromium::create(&m_delegate))
- , m_childLayer(ContentLayerChromium::create(&m_delegate))
+ : m_rootLayer(ContentLayerChromium::create(&m_client))
+ , m_childLayer(ContentLayerChromium::create(&m_client))
{
}
@@ -1356,7 +1357,7 @@ public:
}
private:
- MockContentLayerDelegate m_delegate;
+ MockContentLayerChromiumClient m_client;
RefPtr<ContentLayerChromium> m_rootLayer;
RefPtr<ContentLayerChromium> m_childLayer;
};
@@ -1370,7 +1371,7 @@ TEST_F(CCLayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers, runMultiThre
class CCLayerTreeHostTestAtomicCommit : public CCLayerTreeHostTest {
public:
CCLayerTreeHostTestAtomicCommit()
- : m_layer(ContentLayerChromiumWithUpdateTracking::create(&m_delegate))
+ : m_layer(ContentLayerChromiumWithUpdateTracking::create(&m_client))
{
// Make sure partial texture updates are turned off.
m_settings.maxPartialTextureUpdates = 0;
@@ -1444,7 +1445,7 @@ public:
}
private:
- MockContentLayerDelegate m_delegate;
+ MockContentLayerChromiumClient m_client;
RefPtr<ContentLayerChromiumWithUpdateTracking> m_layer;
};
@@ -1468,8 +1469,8 @@ static void setLayerPropertiesForTesting(LayerChromium* layer, LayerChromium* pa
class CCLayerTreeHostTestAtomicCommitWithPartialUpdate : public CCLayerTreeHostTest {
public:
CCLayerTreeHostTestAtomicCommitWithPartialUpdate()
- : m_parent(ContentLayerChromiumWithUpdateTracking::create(&m_delegate))
- , m_child(ContentLayerChromiumWithUpdateTracking::create(&m_delegate))
+ : m_parent(ContentLayerChromiumWithUpdateTracking::create(&m_client))
+ , m_child(ContentLayerChromiumWithUpdateTracking::create(&m_client))
, m_numCommits(0)
{
// Allow one partial texture update.
@@ -1591,7 +1592,7 @@ public:
}
private:
- MockContentLayerDelegate m_delegate;
+ MockContentLayerChromiumClient m_client;
RefPtr<ContentLayerChromiumWithUpdateTracking> m_parent;
RefPtr<ContentLayerChromiumWithUpdateTracking> m_child;
int m_numCommits;
@@ -2270,7 +2271,7 @@ public:
private:
const IntSize m_scrollAmount;
IntSize m_reportedScrollAmount;
- MockContentLayerDelegate m_mockDelegate;
+ MockContentLayerChromiumClient m_mockDelegate;
RefPtr<LayerChromium> m_childLayer;
RefPtr<LayerChromium> m_rootScrollLayer;
};
@@ -2372,7 +2373,7 @@ public:
}
private:
- MockContentLayerDelegate m_mockDelegate;
+ MockContentLayerChromiumClient m_mockDelegate;
RefPtr<ContentLayerChromiumWithUpdateTracking> m_rootLayer;
RefPtr<ContentLayerChromiumWithUpdateTracking> m_surfaceLayer1;
RefPtr<ContentLayerChromiumWithUpdateTracking> m_replicaLayer1;
@@ -2620,7 +2621,7 @@ public:
}
private:
- MockContentLayerDelegate m_delegate;
+ MockContentLayerChromiumClient m_client;
RefPtr<EvictionTestLayer> m_layer;
CCLayerTreeHostImpl* m_implForEvictTextures;
int m_numCommits;
@@ -2716,7 +2717,7 @@ public:
}
private:
- MockContentLayerDelegate m_delegate;
+ MockContentLayerChromiumClient m_client;
RefPtr<EvictionTestLayer> m_layer;
CCLayerTreeHostImpl* m_implForEvictTextures;
int m_numCommits;
@@ -2763,11 +2764,11 @@ private:
class CCLayerTreeHostTestLostContextWhileUpdatingResources : public CCLayerTreeHostTest {
public:
CCLayerTreeHostTestLostContextWhileUpdatingResources()
- : m_parent(ContentLayerChromiumWithUpdateTracking::create(&m_delegate))
+ : m_parent(ContentLayerChromiumWithUpdateTracking::create(&m_client))
, m_numChildren(50)
{
for (int i = 0; i < m_numChildren; i++)
- m_children.append(ContentLayerChromiumWithUpdateTracking::create(&m_delegate));
+ m_children.append(ContentLayerChromiumWithUpdateTracking::create(&m_client));
}
virtual PassOwnPtr<WebKit::WebCompositorOutputSurface> createOutputSurface()
@@ -2805,7 +2806,7 @@ public:
}
private:
- MockContentLayerDelegate m_delegate;
+ MockContentLayerChromiumClient m_client;
RefPtr<ContentLayerChromiumWithUpdateTracking> m_parent;
int m_numChildren;
Vector<RefPtr<ContentLayerChromiumWithUpdateTracking> > m_children;
diff --git a/cc/ContentLayerChromium.cpp b/cc/ContentLayerChromium.cpp
index 7465ed4..4a5b788 100644
--- a/cc/ContentLayerChromium.cpp
+++ b/cc/ContentLayerChromium.cpp
@@ -12,6 +12,7 @@
#include "BitmapSkPictureCanvasLayerTextureUpdater.h"
#include "CCLayerTreeHost.h"
#include "CCSettings.h"
+#include "ContentLayerChromiumClient.h"
#include "FrameBufferSkPictureCanvasLayerTextureUpdater.h"
#include "LayerPainterChromium.h"
#include <public/Platform.h>
@@ -19,34 +20,34 @@
namespace WebCore {
-ContentLayerPainter::ContentLayerPainter(ContentLayerDelegate* delegate)
- : m_delegate(delegate)
+ContentLayerPainter::ContentLayerPainter(ContentLayerChromiumClient* client)
+ : m_client(client)
{
}
-PassOwnPtr<ContentLayerPainter> ContentLayerPainter::create(ContentLayerDelegate* delegate)
+PassOwnPtr<ContentLayerPainter> ContentLayerPainter::create(ContentLayerChromiumClient* client)
{
- return adoptPtr(new ContentLayerPainter(delegate));
+ return adoptPtr(new ContentLayerPainter(client));
}
void ContentLayerPainter::paint(SkCanvas* canvas, const IntRect& contentRect, FloatRect& opaque)
{
double paintStart = currentTime();
- m_delegate->paintContents(canvas, contentRect, opaque);
+ m_client->paintContents(canvas, contentRect, opaque);
double paintEnd = currentTime();
double pixelsPerSec = (contentRect.width() * contentRect.height()) / (paintEnd - paintStart);
WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPaintDurationMS", (paintEnd - paintStart) * 1000, 0, 120, 30);
WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30);
}
-PassRefPtr<ContentLayerChromium> ContentLayerChromium::create(ContentLayerDelegate* delegate)
+PassRefPtr<ContentLayerChromium> ContentLayerChromium::create(ContentLayerChromiumClient* client)
{
- return adoptRef(new ContentLayerChromium(delegate));
+ return adoptRef(new ContentLayerChromium(client));
}
-ContentLayerChromium::ContentLayerChromium(ContentLayerDelegate* delegate)
+ContentLayerChromium::ContentLayerChromium(ContentLayerChromiumClient* client)
: TiledLayerChromium()
- , m_delegate(delegate)
+ , m_client(client)
{
}
@@ -56,7 +57,7 @@ ContentLayerChromium::~ContentLayerChromium()
bool ContentLayerChromium::drawsContent() const
{
- return TiledLayerChromium::drawsContent() && m_delegate;
+ return TiledLayerChromium::drawsContent() && m_client;
}
void ContentLayerChromium::setTexturePriorities(const CCPriorityCalculator& priorityCalc)
@@ -84,11 +85,11 @@ void ContentLayerChromium::createTextureUpdaterIfNeeded()
if (m_textureUpdater)
return;
if (layerTreeHost()->settings().acceleratePainting)
- m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate));
+ m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_client));
else if (CCSettings::perTilePaintingEnabled())
- m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate));
+ m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_client));
else
- m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate));
+ m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_client));
m_textureUpdater->setOpaque(opaque());
GC3Denum textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFormat;
diff --git a/cc/ContentLayerChromium.h b/cc/ContentLayerChromium.h
index fa68d11..32bbc76 100644
--- a/cc/ContentLayerChromium.h
+++ b/cc/ContentLayerChromium.h
@@ -15,39 +15,32 @@ class SkCanvas;
namespace WebCore {
+class ContentLayerChromiumClient;
class FloatRect;
class IntRect;
class LayerTextureUpdater;
-class ContentLayerDelegate {
-public:
- virtual void paintContents(SkCanvas*, const IntRect& clip, FloatRect& opaque) = 0;
-
-protected:
- virtual ~ContentLayerDelegate() { }
-};
-
class ContentLayerPainter : public LayerPainterChromium {
WTF_MAKE_NONCOPYABLE(ContentLayerPainter);
public:
- static PassOwnPtr<ContentLayerPainter> create(ContentLayerDelegate*);
+ static PassOwnPtr<ContentLayerPainter> create(ContentLayerChromiumClient*);
virtual void paint(SkCanvas*, const IntRect& contentRect, FloatRect& opaque) OVERRIDE;
private:
- explicit ContentLayerPainter(ContentLayerDelegate*);
+ explicit ContentLayerPainter(ContentLayerChromiumClient*);
- ContentLayerDelegate* m_delegate;
+ ContentLayerChromiumClient* m_client;
};
// A layer that renders its contents into an SkCanvas.
class ContentLayerChromium : public TiledLayerChromium {
public:
- static PassRefPtr<ContentLayerChromium> create(ContentLayerDelegate*);
+ static PassRefPtr<ContentLayerChromium> create(ContentLayerChromiumClient*);
virtual ~ContentLayerChromium();
- void clearDelegate() { m_delegate = 0; }
+ void clearClient() { m_client = 0; }
virtual bool drawsContent() const OVERRIDE;
virtual void setTexturePriorities(const CCPriorityCalculator&) OVERRIDE;
@@ -57,14 +50,14 @@ public:
virtual void setOpaque(bool) OVERRIDE;
protected:
- explicit ContentLayerChromium(ContentLayerDelegate*);
+ explicit ContentLayerChromium(ContentLayerChromiumClient*);
private:
virtual LayerTextureUpdater* textureUpdater() const OVERRIDE { return m_textureUpdater.get(); }
virtual void createTextureUpdaterIfNeeded() OVERRIDE;
- ContentLayerDelegate* m_delegate;
+ ContentLayerChromiumClient* m_client;
RefPtr<LayerTextureUpdater> m_textureUpdater;
};
diff --git a/cc/ContentLayerChromiumClient.h b/cc/ContentLayerChromiumClient.h
new file mode 100644
index 0000000..f2f85b2
--- /dev/null
+++ b/cc/ContentLayerChromiumClient.h
@@ -0,0 +1,24 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ContentLayerChromiumClient_h
+#define ContentLayerChromiumClient_h
+
+class SkCanvas;
+
+namespace WebCore {
+class FloatRect;
+class IntRect;
+
+class ContentLayerChromiumClient {
+public:
+ virtual void paintContents(SkCanvas*, const IntRect& clip, FloatRect& opaque) = 0;
+
+protected:
+ virtual ~ContentLayerChromiumClient() { }
+};
+
+}
+
+#endif // ContentLayerChromiumClient_h
diff --git a/cc/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp b/cc/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp
index 800950e..cc3ad38 100644
--- a/cc/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp
+++ b/cc/FrameBufferSkPictureCanvasLayerTextureUpdater.cpp
@@ -82,11 +82,16 @@ LayerTextureUpdater::SampledTexelFormat FrameBufferSkPictureCanvasLayerTextureUp
void FrameBufferSkPictureCanvasLayerTextureUpdater::updateTextureRect(WebGraphicsContext3D* context, GrContext* grContext, CCResourceProvider* resourceProvider, CCPrioritizedTexture* texture, const IntRect& sourceRect, const IntSize& destOffset)
{
- // Make sure ganesh uses the correct GL context.
- context->makeContextCurrent();
-
texture->acquireBackingTexture(resourceProvider);
+ // Flush the context in which the backing texture is created so that it
+ // is available in other shared contexts. It is important to do here
+ // because the backing texture is created in one context while it is
+ // being written to in another.
+ resourceProvider->flush();
CCResourceProvider::ScopedWriteLockGL lock(resourceProvider, texture->resourceId());
+
+ // Make sure ganesh uses the correct GL context.
+ context->makeContextCurrent();
// Create an accelerated canvas to draw on.
OwnPtr<SkCanvas> canvas = createAcceleratedCanvas(grContext, texture->size(), lock.textureId());
diff --git a/cc/TextureLayerChromium.cpp b/cc/TextureLayerChromium.cpp
index 0ba2e61..f55e74b 100644
--- a/cc/TextureLayerChromium.cpp
+++ b/cc/TextureLayerChromium.cpp
@@ -10,6 +10,7 @@
#include "CCLayerTreeHost.h"
#include "CCTextureLayerImpl.h"
+#include "TextureLayerChromiumClient.h"
#include <public/WebGraphicsContext3D.h>
namespace WebCore {
diff --git a/cc/TextureLayerChromium.h b/cc/TextureLayerChromium.h
index 5728d74..ab3b39a 100644
--- a/cc/TextureLayerChromium.h
+++ b/cc/TextureLayerChromium.h
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
#ifndef TextureLayerChromium_h
#define TextureLayerChromium_h
@@ -16,19 +15,7 @@ class WebGraphicsContext3D;
namespace WebCore {
-class TextureLayerChromiumClient {
-public:
- // Called to prepare this layer's texture for compositing. The client may queue a texture
- // upload or copy on the CCTextureUpdateQueue.
- // Returns the texture ID to be used for compositing.
- virtual unsigned prepareTexture(CCTextureUpdateQueue&) = 0;
-
- // Returns the context that is providing the texture. Used for rate limiting and detecting lost context.
- virtual WebKit::WebGraphicsContext3D* context() = 0;
-
-protected:
- virtual ~TextureLayerChromiumClient() { }
-};
+class TextureLayerChromiumClient;
// A Layer containing a the rendered output of a plugin instance.
class TextureLayerChromium : public LayerChromium {
diff --git a/cc/TextureLayerChromiumClient.h b/cc/TextureLayerChromiumClient.h
new file mode 100644
index 0000000..1fc0dcf
--- /dev/null
+++ b/cc/TextureLayerChromiumClient.h
@@ -0,0 +1,31 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef TextureLayerChromiumClient_h
+#define TextureLayerChromiumClient_h
+
+namespace WebKit {
+class WebGraphicsContext3D;
+}
+
+namespace WebCore {
+class CCTextureUpdateQueue;
+
+class TextureLayerChromiumClient {
+public:
+ // Called to prepare this layer's texture for compositing. The client may queue a texture
+ // upload or copy on the CCTextureUpdateQueue.
+ // Returns the texture ID to be used for compositing.
+ virtual unsigned prepareTexture(CCTextureUpdateQueue&) = 0;
+
+ // Returns the context that is providing the texture. Used for rate limiting and detecting lost context.
+ virtual WebKit::WebGraphicsContext3D* context() = 0;
+
+protected:
+ virtual ~TextureLayerChromiumClient() { }
+};
+
+}
+
+#endif // TextureLayerChromiumClient_h
diff --git a/cc/cc.gyp b/cc/cc.gyp
index a182c6a..a66c5cc 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -65,6 +65,7 @@
'CCLayerTilingData.h',
'CCLayerTreeHost.cpp',
'CCLayerTreeHost.h',
+ 'CCLayerTreeHostClient.h',
'CCLayerTreeHostCommon.cpp',
'CCLayerTreeHostCommon.h',
'CCLayerTreeHostImpl.cpp',
@@ -163,6 +164,7 @@
'CanvasLayerTextureUpdater.h',
'ContentLayerChromium.cpp',
'ContentLayerChromium.h',
+ 'ContentLayerChromiumClient.h',
'FrameBufferSkPictureCanvasLayerTextureUpdater.cpp',
'FrameBufferSkPictureCanvasLayerTextureUpdater.h',
'GeometryBinding.cpp',
@@ -198,6 +200,7 @@
'TextureCopier.h',
'TextureLayerChromium.cpp',
'TextureLayerChromium.h',
+ 'TextureLayerChromiumClient.h',
'TextureUploader.h',
'ThrottledTextureUploader.cpp',
'ThrottledTextureUploader.h',