Changeset 120142 in webkit
- Timestamp:
- Jun 12, 2012, 5:10:03 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/Platform/ChangeLog
r120023 r120142 1 2012-06-12 James Robinson <jamesr@chromium.org> 2 3 [chromium] Port Canvas2DLayerBridge over to WebExternalTextureLayer 4 https://bugs.webkit.org/show_bug.cgi?id=88597 5 6 Reviewed by Adrienne Walker. 7 8 This adds two new APIs to WebExternalTextureLayer that are used by the accelerated 2d canvas path: 9 - willModifyTexture() is called to indicate that a system outside the compositor's control is about to modify 10 the texture backing the WebExternalTextureLayer. This indicates to the compositor that it needs to avoid 11 producing more frames using this texture until it can do a full commit - either by double buffering or 12 appropriate flow control. 13 14 - setRateLimitContext() is called to enable rate limiting for this texture. The rate limiting logic blocks if 15 too many invalidate() or invalidateRect() calls are made on the texture outside of the context of a 16 WebLayerTreeViewClient::updateAnimations() call to prevent a non-vsynced producer from getting too far ahead of 17 the compositor. 18 19 * chromium/public/WebExternalTextureLayer.h: 20 (WebKit::WebExternalTextureLayer::WebExternalTextureLayer): 21 (WebExternalTextureLayer): 22 1 23 2012-06-11 James Robinson <jamesr@chromium.org> 2 24 -
trunk/Source/Platform/chromium/public/WebExternalTextureLayer.h
r120023 r120142 77 77 WEBKIT_EXPORT void setPremultipliedAlpha(bool); 78 78 79 // Indicates that the most recently provided texture ID is about to be modified externally. 80 WEBKIT_EXPORT void willModifyTexture(); 81 82 // Sets whether this context should be rate limited by the compositor. Rate limiting works by blocking 83 // invalidate() and invalidateRect() calls if the compositor is too many frames behind. 84 WEBKIT_EXPORT void setRateLimitContext(bool); 85 79 86 private: 80 87 #if WEBKIT_IMPLEMENTATION -
trunk/Source/WebCore/ChangeLog
r120136 r120142 1 2012-06-12 James Robinson <jamesr@chromium.org> 2 3 [chromium] Port Canvas2DLayerBridge over to WebExternalTextureLayer 4 https://bugs.webkit.org/show_bug.cgi?id=88597 5 6 Reviewed by Adrienne Walker. 7 8 This converts Canvas2DLayerBridge to using public WebLayer API types instead of LayerChromium types. 9 10 * platform/graphics/chromium/Canvas2DLayerBridge.cpp: 11 (WebCore::AcceleratedDeviceContext::AcceleratedDeviceContext): 12 (WebCore::AcceleratedDeviceContext::prepareForDraw): 13 (AcceleratedDeviceContext): 14 (WebCore::Canvas2DLayerBridge::Canvas2DLayerBridge): 15 (WebCore::Canvas2DLayerBridge::~Canvas2DLayerBridge): 16 (WebCore::Canvas2DLayerBridge::skCanvas): 17 (WebCore::Canvas2DLayerBridge::prepareTexture): 18 (WebCore::Canvas2DLayerBridge::context): 19 (WebCore::Canvas2DLayerBridge::layer): 20 (WebCore::Canvas2DLayerBridge::contextAcquired): 21 * platform/graphics/chromium/Canvas2DLayerBridge.h: 22 (WebCore): 23 (Canvas2DLayerBridge): 24 1 25 2012-06-12 Alexis Menard <alexis.menard@openbossa.org> 2 26 -
trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp
r120117 r120142 34 34 #include "SkCanvas.h" 35 35 #include "SkDeferredCanvas.h" 36 #include "TextureLayerChromium.h"37 36 #include "cc/CCProxy.h" 38 37 #include "cc/CCTextureUpdater.h" 38 #include <public/WebGraphicsContext3D.h> 39 40 using WebKit::WebExternalTextureLayer; 41 using WebKit::WebGraphicsContext3D; 42 using WebKit::WebTextureUpdater; 39 43 40 44 namespace WebCore { … … 42 46 class AcceleratedDeviceContext : public SkDeferredCanvas::DeviceContext { 43 47 public: 44 AcceleratedDeviceContext( GraphicsContext3D* context, TextureLayerChromium*layer, bool useDoubleBuffering)48 AcceleratedDeviceContext(WebGraphicsContext3D* context, WebExternalTextureLayer layer, bool useDoubleBuffering) 45 49 : m_layer(layer) 46 50 , m_context() … … 48 52 { 49 53 ASSERT(context); 50 ASSERT( layer);54 ASSERT(!layer.isNull()); 51 55 m_context = context; 52 56 } … … 55 59 { 56 60 if (!m_useDoubleBuffering) 57 m_layer ->willModifyTexture();61 m_layer.willModifyTexture(); 58 62 m_context->makeContextCurrent(); 59 63 } 60 64 61 65 private: 62 TextureLayerChromium*m_layer;63 GraphicsContext3D* m_context;66 WebExternalTextureLayer m_layer; 67 WebGraphicsContext3D* m_context; 64 68 bool m_useDoubleBuffering; 65 69 }; … … 93 97 } 94 98 95 m_layer = TextureLayerChromium::create(this);96 m_layer ->setTextureId(textureId);97 m_layer ->setRateLimitContext(!CCProxy::hasImplThread() || m_useDoubleBuffering);99 m_layer = WebExternalTextureLayer::create(this); 100 m_layer.setTextureId(textureId); 101 m_layer.setRateLimitContext(!CCProxy::hasImplThread() || m_useDoubleBuffering); 98 102 } 99 103 … … 101 105 Canvas2DLayerBridge::~Canvas2DLayerBridge() 102 106 { 103 m_layer ->setTextureId(0);107 m_layer.setTextureId(0); 104 108 if (m_useDoubleBuffering) { 105 109 m_context->makeContextCurrent(); … … 107 111 m_context->flush(); 108 112 } 109 m_layer ->clearClient();113 m_layer.clearClient(); 110 114 } 111 115 … … 113 117 { 114 118 if (m_deferralMode == Deferred) { 115 SkAutoTUnref<AcceleratedDeviceContext> deviceContext(new AcceleratedDeviceContext( m_context.get(), m_layer.get(), m_useDoubleBuffering));119 SkAutoTUnref<AcceleratedDeviceContext> deviceContext(new AcceleratedDeviceContext(context(), m_layer, m_useDoubleBuffering)); 116 120 m_canvas = new SkDeferredCanvas(device, deviceContext.get()); 117 121 } else … … 122 126 123 127 124 unsigned Canvas2DLayerBridge::prepareTexture( CCTextureUpdater& updater)128 unsigned Canvas2DLayerBridge::prepareTexture(WebTextureUpdater& updater) 125 129 { 126 130 m_context->makeContextCurrent(); … … 141 145 } 142 146 143 Web Kit::WebGraphicsContext3D* Canvas2DLayerBridge::context()147 WebGraphicsContext3D* Canvas2DLayerBridge::context() 144 148 { 145 149 return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_context.get()); … … 148 152 LayerChromium* Canvas2DLayerBridge::layer() const 149 153 { 150 return m_layer. get();154 return m_layer.unwrap<LayerChromium>(); 151 155 } 152 156 … … 154 158 { 155 159 if (m_deferralMode == NonDeferred && !m_useDoubleBuffering) 156 m_layer ->willModifyTexture();160 m_layer.willModifyTexture(); 157 161 } 158 162 -
trunk/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.h
r120023 r120142 29 29 #include "ImageBuffer.h" // For DeferralMode enum. 30 30 #include "IntSize.h" 31 #include "TextureLayerChromium.h" 31 #include <public/WebExternalTextureLayer.h> 32 #include <public/WebExternalTextureLayerClient.h> 32 33 #include <wtf/PassOwnPtr.h> 33 34 #include <wtf/RefPtr.h> … … 43 44 44 45 class LayerChromium; 45 class TextureLayerChromium;46 46 47 class Canvas2DLayerBridge : public TextureLayerChromiumClient {47 class Canvas2DLayerBridge : public WebKit::WebExternalTextureLayerClient { 48 48 WTF_MAKE_NONCOPYABLE(Canvas2DLayerBridge); 49 49 public: … … 55 55 virtual ~Canvas2DLayerBridge(); 56 56 57 // TextureLayerChromiumClient implementation.58 virtual unsigned prepareTexture( CCTextureUpdater&) OVERRIDE;57 // WebKit::WebExternalTextureLayerClient implementation. 58 virtual unsigned prepareTexture(WebKit::WebTextureUpdater&) OVERRIDE; 59 59 virtual WebKit::WebGraphicsContext3D* context() OVERRIDE; 60 60 … … 72 72 IntSize m_size; 73 73 SkCanvas* m_canvas; 74 RefPtr<TextureLayerChromium>m_layer;74 WebKit::WebExternalTextureLayer m_layer; 75 75 RefPtr<GraphicsContext3D> m_context; 76 76 }; -
trunk/Source/WebKit/chromium/ChangeLog
r120135 r120142 1 2012-06-12 James Robinson <jamesr@chromium.org> 2 3 [chromium] Port Canvas2DLayerBridge over to WebExternalTextureLayer 4 https://bugs.webkit.org/show_bug.cgi?id=88597 5 6 Reviewed by Adrienne Walker. 7 8 Implementations for new WebExternalTextureLayer APIs, updates test. 9 10 * src/WebExternalTextureLayer.cpp: 11 (WebKit::WebExternalTextureLayer::willModifyTexture): 12 (WebKit): 13 (WebKit::WebExternalTextureLayer::setRateLimitContext): 14 * tests/Canvas2DLayerBridgeTest.cpp: 15 (Canvas2DLayerBridgeTest::fullLifecycleTest): 16 1 17 2012-06-12 Adrienne Walker <enne@google.com> 2 18 -
trunk/Source/WebKit/chromium/src/WebExternalTextureLayer.cpp
r120023 r120142 113 113 } 114 114 115 void WebExternalTextureLayer::willModifyTexture() 116 { 117 unwrap<TextureLayerChromium>()->willModifyTexture(); 118 } 119 120 void WebExternalTextureLayer::setRateLimitContext(bool rateLimit) 121 { 122 unwrap<TextureLayerChromium>()->setRateLimitContext(rateLimit); 123 } 124 115 125 WebExternalTextureLayer::WebExternalTextureLayer(PassRefPtr<TextureLayerChromium> layer) 116 126 : WebLayer(layer) -
trunk/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp
r120117 r120142 30 30 #include "GraphicsContext3DPrivate.h" 31 31 #include "ImageBuffer.h" 32 #include " TextureCopier.h"32 #include "LayerChromium.h" 33 33 #include "TextureManager.h" 34 34 #include "WebCompositor.h" … … 60 60 }; 61 61 62 class Mock TextureCopier : public TextureCopier {62 class MockWebTextureUpdater : public WebTextureUpdater { 63 63 public: 64 MOCK_METHOD 4(copyTexture, void(CCGraphicsContext*, unsigned, unsigned, const IntSize&));64 MOCK_METHOD3(appendCopy, void(unsigned, unsigned, WebSize)); 65 65 }; 66 66 … … 85 85 MockCanvasContext& implMock = *static_cast<MockCanvasContext*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(implContext.get())); 86 86 87 MockTextureCopier copierMock; 88 CCTextureUpdater updater; 87 MockWebTextureUpdater updater; 89 88 90 89 const IntSize size(300, 150); … … 110 109 111 110 EXPECT_CALL(mainMock, flush()); 111 if (threadMode == Threaded && deferralMode == NonDeferred) 112 EXPECT_CALL(updater, appendCopy(backTextureId, frontTextureId, WebSize(300, 150))); 112 113 EXPECT_EQ(frontTextureId, bridge->prepareTexture(updater)); 113 114 ::testing::Mock::VerifyAndClearExpectations(&mainMock); 114 115 if (threadMode == Threaded && deferralMode == NonDeferred) { 116 EXPECT_CALL(copierMock, copyTexture(ccImplContext.get(), backTextureId, frontTextureId, size)); 117 EXPECT_CALL(implMock, flush()); 118 } 119 updater.update(ccImplContext.get(), 0, &copierMock, 0, 100); 120 ::testing::Mock::VerifyAndClearExpectations(&implMock); 115 ::testing::Mock::VerifyAndClearExpectations(&updater); 121 116 122 117 if (threadMode == Threaded && deferralMode == NonDeferred) {
Note:
See TracChangeset
for help on using the changeset viewer.