Title: [151262] trunk/Source
Revision
151262
Author
[email protected]
Date
2013-06-06 02:43:20 -0700 (Thu, 06 Jun 2013)

Log Message

Coordinated Graphics : Refactor CoordinatedSurface to manage the lifecycle of GraphicsContext
https://bugs.webkit.org/show_bug.cgi?id=108899

Patch by Jae Hyun Park <[email protected]> on 2013-06-06
Reviewed by Noam Rosenthal.

This is a preparation patch for Threaded Coordinated Graphics.

This patch changes CoordinatedSurface to be responsible for the
lifecycle of GraphicsContext used in Coordinated Graphics System.
CoordinatedImageBacking and UpdateAtlas do not ask for the ownership
of GraphicsContext anymore. Instead, those classes use client pattern to
ask the CoordiantedSurface to paint to the GraphicsContext.

This refactoring is needed to implement CoordinatedSurface for Threaded
Coordinated Graphics.

Source/WebCore:

No new tests, covered by existing tests.

* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::paintToSurface):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
* platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
(WebCore::ImageBackingSurfaceClient::ImageBackingSurfaceClient):
(WebCore::CoordinatedImageBacking::update):
* platform/graphics/texmap/coordinated/CoordinatedSurface.h:
(WebCore::CoordinatedSurface::Client::~Client):
* platform/graphics/texmap/coordinated/CoordinatedTile.cpp:
(WebCore::CoordinatedTile::updateBackBuffer):
(WebCore::CoordinatedTile::paintToSurfaceContext):
* platform/graphics/texmap/coordinated/CoordinatedTile.h:
* platform/graphics/texmap/coordinated/UpdateAtlas.cpp:
(WebCore::UpdateAtlasSurfaceClient::UpdateAtlasSurfaceClient):
(WebCore::UpdateAtlas::paintOnAvailableBuffer):
* platform/graphics/texmap/coordinated/UpdateAtlas.h:

Source/WebKit2:

* Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp:
(WebKit::WebCoordinatedSurface::paintToSurface):
* Shared/CoordinatedGraphics/WebCoordinatedSurface.h:
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
(WebKit::CoordinatedLayerTreeHost::paintToSurface):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (151261 => 151262)


--- trunk/Source/WebCore/ChangeLog	2013-06-06 09:19:57 UTC (rev 151261)
+++ trunk/Source/WebCore/ChangeLog	2013-06-06 09:43:20 UTC (rev 151262)
@@ -1,3 +1,40 @@
+2013-06-06  Jae Hyun Park  <[email protected]>
+
+        Coordinated Graphics : Refactor CoordinatedSurface to manage the lifecycle of GraphicsContext
+        https://bugs.webkit.org/show_bug.cgi?id=108899
+
+        Reviewed by Noam Rosenthal.
+
+        This is a preparation patch for Threaded Coordinated Graphics.
+
+        This patch changes CoordinatedSurface to be responsible for the
+        lifecycle of GraphicsContext used in Coordinated Graphics System.
+        CoordinatedImageBacking and UpdateAtlas do not ask for the ownership
+        of GraphicsContext anymore. Instead, those classes use client pattern to
+        ask the CoordiantedSurface to paint to the GraphicsContext.
+
+        This refactoring is needed to implement CoordinatedSurface for Threaded
+        Coordinated Graphics.
+
+        No new tests, covered by existing tests.
+
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
+        (WebCore::CoordinatedGraphicsLayer::paintToSurface):
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
+        * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
+        (WebCore::ImageBackingSurfaceClient::ImageBackingSurfaceClient):
+        (WebCore::CoordinatedImageBacking::update):
+        * platform/graphics/texmap/coordinated/CoordinatedSurface.h:
+        (WebCore::CoordinatedSurface::Client::~Client):
+        * platform/graphics/texmap/coordinated/CoordinatedTile.cpp:
+        (WebCore::CoordinatedTile::updateBackBuffer):
+        (WebCore::CoordinatedTile::paintToSurfaceContext):
+        * platform/graphics/texmap/coordinated/CoordinatedTile.h:
+        * platform/graphics/texmap/coordinated/UpdateAtlas.cpp:
+        (WebCore::UpdateAtlasSurfaceClient::UpdateAtlasSurfaceClient):
+        (WebCore::UpdateAtlas::paintOnAvailableBuffer):
+        * platform/graphics/texmap/coordinated/UpdateAtlas.h:
+
 2013-06-05  Ryosuke Niwa  <[email protected]>
 
         Revert the second half of r151257. WebGLRenderingContext::create can return null.

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp (151261 => 151262)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp	2013-06-06 09:19:57 UTC (rev 151261)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp	2013-06-06 09:43:20 UTC (rev 151262)
@@ -959,11 +959,11 @@
     return contentsOpaque() ? Color::white : Color::transparent;
 }
 
-PassOwnPtr<GraphicsContext> CoordinatedGraphicsLayer::beginContentUpdate(const IntSize& size, uint32_t& atlas, IntPoint& offset)
+bool CoordinatedGraphicsLayer::paintToSurface(const IntSize& size, uint32_t& atlas, IntPoint& offset, CoordinatedSurface::Client* client)
 {
     ASSERT(m_coordinator);
     ASSERT(m_coordinator->isFlushingLayerChanges());
-    return m_coordinator->beginContentUpdate(size, contentsOpaque() ? CoordinatedSurface::NoFlags : CoordinatedSurface::SupportsAlpha, atlas, offset);
+    return m_coordinator->paintToSurface(size, contentsOpaque() ? CoordinatedSurface::NoFlags : CoordinatedSurface::SupportsAlpha, atlas, offset, client);
 }
 
 void CoordinatedGraphicsLayer::createTile(uint32_t tileID, const SurfaceUpdateInfo& updateInfo, const IntRect& tileRect)

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h (151261 => 151262)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h	2013-06-06 09:19:57 UTC (rev 151261)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h	2013-06-06 09:43:20 UTC (rev 151262)
@@ -52,7 +52,7 @@
     virtual FloatRect visibleContentsRect() const = 0;
     virtual PassRefPtr<CoordinatedImageBacking> createImageBackingIfNeeded(Image*) = 0;
     virtual void detachLayer(CoordinatedGraphicsLayer*) = 0;
-    virtual PassOwnPtr<GraphicsContext> beginContentUpdate(const IntSize&, CoordinatedSurface::Flags, uint32_t& atlasID, IntPoint&) = 0;
+    virtual bool paintToSurface(const IntSize&, CoordinatedSurface::Flags, uint32_t& atlasID, IntPoint&, CoordinatedSurface::Client*) = 0;
 
     virtual void syncLayerState(CoordinatedLayerID, CoordinatedGraphicsLayerState&) = 0;
 };
@@ -142,7 +142,7 @@
     virtual void createTile(uint32_t tileID, const SurfaceUpdateInfo&, const IntRect&) OVERRIDE;
     virtual void updateTile(uint32_t tileID, const SurfaceUpdateInfo&, const IntRect&) OVERRIDE;
     virtual void removeTile(uint32_t tileID) OVERRIDE;
-    virtual PassOwnPtr<GraphicsContext> beginContentUpdate(const IntSize&, uint32_t& atlasID, IntPoint&) OVERRIDE;
+    virtual bool paintToSurface(const IntSize&, uint32_t& /* atlasID */, IntPoint&, CoordinatedSurface::Client*) OVERRIDE;
 
     void setCoordinator(CoordinatedGraphicsLayerClient*);
 

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp (151261 => 151262)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp	2013-06-06 09:19:57 UTC (rev 151261)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp	2013-06-06 09:43:20 UTC (rev 151262)
@@ -33,6 +33,24 @@
 
 namespace WebCore {
 
+class ImageBackingSurfaceClient : public CoordinatedSurface::Client {
+public:
+    ImageBackingSurfaceClient(Image* image, const IntRect& rect)
+        : m_image(image)
+        , m_rect(rect)
+    {
+    }
+
+    virtual void paintToSurfaceContext(GraphicsContext* context) OVERRIDE
+    {
+        context->drawImage(m_image, ColorSpaceDeviceRGB, m_rect, m_rect);
+    }
+
+private:
+    Image* m_image;
+    IntRect m_rect;
+};
+
 CoordinatedImageBackingID CoordinatedImageBacking::getCoordinatedImageBackingID(Image* image)
 {
     // CoordinatedImageBacking keeps a RefPtr<Image> member, so the same Image pointer can not refer two different instances until CoordinatedImageBacking releases the member.
@@ -109,9 +127,10 @@
     }
 
     IntRect rect(IntPoint::zero(), m_image->size());
-    OwnPtr<GraphicsContext> context = m_surface->createGraphicsContext(rect);
-    context->drawImage(m_image.get(), ColorSpaceDeviceRGB, rect, rect);
 
+    ImageBackingSurfaceClient surfaceClient(m_image.get(), rect);
+    m_surface->paintToSurface(rect, &surfaceClient);
+
     m_nativeImagePtr = m_image->nativeImageForCurrentFrame();
 
     m_client->updateImageBacking(id(), m_surface);

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedSurface.h (151261 => 151262)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedSurface.h	2013-06-06 09:19:57 UTC (rev 151261)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedSurface.h	2013-06-06 09:43:20 UTC (rev 151262)
@@ -39,6 +39,12 @@
     };
     typedef unsigned Flags;
 
+    class Client {
+    public:
+        virtual ~Client() { }
+        virtual void paintToSurfaceContext(GraphicsContext*) = 0;
+    };
+
     typedef PassRefPtr<CoordinatedSurface> Factory(const IntSize&, Flags);
     static void setFactory(Factory);
     static PassRefPtr<CoordinatedSurface> create(const IntSize&, Flags);
@@ -48,8 +54,7 @@
     bool supportsAlpha() const { return flags() & SupportsAlpha; }
     virtual IntSize size() const = 0;
 
-    // Create a graphics context that can be used to paint into the backing store.
-    virtual PassOwnPtr<GraphicsContext> createGraphicsContext(const IntRect&) = 0;
+    virtual void paintToSurface(const IntRect&, Client*) = 0;
 
 #if USE(TEXTURE_MAPPER)
     virtual void copyToTexture(PassRefPtr<BitmapTexture>, const IntRect& target, const IntPoint& sourceOffset) = 0;

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedTile.cpp (151261 => 151262)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedTile.cpp	2013-06-06 09:19:57 UTC (rev 151261)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedTile.cpp	2013-06-06 09:43:20 UTC (rev 151262)
@@ -73,17 +73,13 @@
         return Vector<IntRect>();
 
     SurfaceUpdateInfo updateInfo;
-    OwnPtr<GraphicsContext> graphicsContext = m_client->beginContentUpdate(m_dirtyRect.size(), updateInfo.atlasID, updateInfo.surfaceOffset);
-    if (!graphicsContext)
+
+    if (!m_client->paintToSurface(m_dirtyRect.size(), updateInfo.atlasID, updateInfo.surfaceOffset, this))
         return Vector<IntRect>();
-    graphicsContext->translate(-m_dirtyRect.x(), -m_dirtyRect.y());
-    graphicsContext->scale(FloatSize(m_tiledBackingStore->contentsScale(), m_tiledBackingStore->contentsScale()));
-    m_tiledBackingStore->client()->tiledBackingStorePaint(graphicsContext.get(), m_tiledBackingStore->mapToContents(m_dirtyRect));
 
     updateInfo.updateRect = m_dirtyRect;
     updateInfo.updateRect.move(-m_rect.x(), -m_rect.y());
     updateInfo.scaleFactor = m_tiledBackingStore->contentsScale();
-    graphicsContext.release();
 
     static uint32_t id = 1;
     if (m_ID == InvalidCoordinatedTileID) {
@@ -101,6 +97,13 @@
     return updatedRects;
 }
 
+void CoordinatedTile::paintToSurfaceContext(GraphicsContext* context)
+{
+    context->translate(-m_dirtyRect.x(), -m_dirtyRect.y());
+    context->scale(FloatSize(m_tiledBackingStore->contentsScale(), m_tiledBackingStore->contentsScale()));
+    m_tiledBackingStore->client()->tiledBackingStorePaint(context, m_tiledBackingStore->mapToContents(m_dirtyRect));
+}
+
 void CoordinatedTile::swapBackBufferToFront()
 {
     // Handled by tiledBackingStorePaintEnd.

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedTile.h (151261 => 151262)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedTile.h	2013-06-06 09:19:57 UTC (rev 151261)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedTile.h	2013-06-06 09:43:20 UTC (rev 151262)
@@ -28,6 +28,7 @@
 
 #if USE(TILED_BACKING_STORE)
 
+#include "CoordinatedSurface.h"
 #include "IntRect.h"
 #include "Tile.h"
 #include "TiledBackingStore.h"
@@ -39,7 +40,7 @@
 class SurfaceUpdateInfo;
 class TiledBackingStore;
 
-class CoordinatedTile : public Tile {
+class CoordinatedTile : public Tile, public CoordinatedSurface::Client {
 public:
     static PassRefPtr<Tile> create(CoordinatedTileClient* client, TiledBackingStore* tiledBackingStore, const Coordinate& tileCoordinate) { return adoptRef(new CoordinatedTile(client, tiledBackingStore, tileCoordinate)); }
     ~CoordinatedTile();
@@ -55,6 +56,8 @@
     const IntRect& rect() const { return m_rect; }
     void resize(const IntSize&);
 
+    virtual void paintToSurfaceContext(GraphicsContext*) OVERRIDE;
+
 private:
     CoordinatedTile(CoordinatedTileClient*, TiledBackingStore*, const Coordinate&);
 
@@ -75,7 +78,7 @@
     virtual void createTile(uint32_t tileID, const SurfaceUpdateInfo&, const IntRect&) = 0;
     virtual void updateTile(uint32_t tileID, const SurfaceUpdateInfo&, const IntRect&) = 0;
     virtual void removeTile(uint32_t tileID) = 0;
-    virtual PassOwnPtr<GraphicsContext> beginContentUpdate(const IntSize&, uint32_t& atlasID, IntPoint&) = 0;
+    virtual bool paintToSurface(const IntSize&, uint32_t& atlasID, IntPoint&, CoordinatedSurface::Client*) = 0;
 };
 
 class CoordinatedTileBackend : public TiledBackingStoreBackend {

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.cpp (151261 => 151262)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.cpp	2013-06-06 09:19:57 UTC (rev 151261)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.cpp	2013-06-06 09:43:20 UTC (rev 151262)
@@ -30,6 +30,32 @@
 
 namespace WebCore {
 
+class UpdateAtlasSurfaceClient : public CoordinatedSurface::Client {
+public:
+    UpdateAtlasSurfaceClient(CoordinatedSurface::Client* client, const IntSize& size, bool supportsAlpha)
+        : m_client(client)
+        , m_size(size)
+        , m_supportsAlpha(supportsAlpha)
+    {
+    }
+
+    virtual void paintToSurfaceContext(GraphicsContext* context) OVERRIDE
+    {
+        if (m_supportsAlpha) {
+            context->setCompositeOperation(CompositeCopy);
+            context->fillRect(IntRect(IntPoint::zero(), m_size), Color::transparent, ColorSpaceDeviceRGB);
+            context->setCompositeOperation(CompositeSourceOver);
+        }
+
+        m_client->paintToSurfaceContext(context);
+    }
+
+private:
+    CoordinatedSurface::Client* m_client;
+    IntSize m_size;
+    bool m_supportsAlpha;
+};
+
 UpdateAtlas::UpdateAtlas(Client* client, int dimension, CoordinatedSurface::Flags flags)
     : m_client(client)
     , m_inactivityInSeconds(0)
@@ -61,32 +87,29 @@
     m_areaAllocator.clear();
 }
 
-PassOwnPtr<GraphicsContext> UpdateAtlas::beginPaintingOnAvailableBuffer(uint32_t& atlasID, const IntSize& size, IntPoint& offset)
+
+bool UpdateAtlas::paintOnAvailableBuffer(const IntSize& size, uint32_t& atlasID, IntPoint& offset, CoordinatedSurface::Client* client)
 {
     m_inactivityInSeconds = 0;
     buildLayoutIfNeeded();
     IntRect rect = m_areaAllocator->allocate(size);
 
-    // No available buffer was found, returning null.
+    // No available buffer was found.
     if (rect.isEmpty())
-        return PassOwnPtr<GraphicsContext>();
+        return false;
 
     if (!m_surface)
-        return PassOwnPtr<GraphicsContext>();
+        return false;
 
     atlasID = m_ID;
 
     // FIXME: Use tri-state buffers, to allow faster updates.
     offset = rect.location();
-    OwnPtr<GraphicsContext> graphicsContext = m_surface->createGraphicsContext(rect);
 
-    if (supportsAlpha()) {
-        graphicsContext->setCompositeOperation(CompositeCopy);
-        graphicsContext->fillRect(IntRect(IntPoint::zero(), size), Color::transparent, ColorSpaceDeviceRGB);
-        graphicsContext->setCompositeOperation(CompositeSourceOver);
-    }
+    UpdateAtlasSurfaceClient surfaceClient(client, size, supportsAlpha());
+    m_surface->paintToSurface(rect, &surfaceClient);
 
-    return graphicsContext.release();
+    return true;
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.h (151261 => 151262)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.h	2013-06-06 09:19:57 UTC (rev 151261)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.h	2013-06-06 09:43:20 UTC (rev 151262)
@@ -45,8 +45,8 @@
 
     inline IntSize size() const { return m_surface->size(); }
 
-    // Returns a null pointer of there is no available buffer.
-    PassOwnPtr<GraphicsContext> beginPaintingOnAvailableBuffer(uint32_t& atlasID, const IntSize&, IntPoint& offset);
+    // Returns false if there is no available buffer.
+    bool paintOnAvailableBuffer(const IntSize&, uint32_t& atlasID, IntPoint& offset, CoordinatedSurface::Client*);
     void didSwapBuffers();
     bool supportsAlpha() const { return m_surface->supportsAlpha(); }
 

Modified: trunk/Source/WebKit2/ChangeLog (151261 => 151262)


--- trunk/Source/WebKit2/ChangeLog	2013-06-06 09:19:57 UTC (rev 151261)
+++ trunk/Source/WebKit2/ChangeLog	2013-06-06 09:43:20 UTC (rev 151262)
@@ -1,3 +1,28 @@
+2013-06-06  Jae Hyun Park  <[email protected]>
+
+        Coordinated Graphics : Refactor CoordinatedSurface to manage the lifecycle of GraphicsContext
+        https://bugs.webkit.org/show_bug.cgi?id=108899
+
+        Reviewed by Noam Rosenthal.
+
+        This is a preparation patch for Threaded Coordinated Graphics.
+
+        This patch changes CoordinatedSurface to be responsible for the
+        lifecycle of GraphicsContext used in Coordinated Graphics System.
+        CoordinatedImageBacking and UpdateAtlas do not ask for the ownership
+        of GraphicsContext anymore. Instead, those classes use client pattern to
+        ask the CoordiantedSurface to paint to the GraphicsContext.
+
+        This refactoring is needed to implement CoordinatedSurface for Threaded
+        Coordinated Graphics.
+
+        * Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp:
+        (WebKit::WebCoordinatedSurface::paintToSurface):
+        * Shared/CoordinatedGraphics/WebCoordinatedSurface.h:
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
+        (WebKit::CoordinatedLayerTreeHost::paintToSurface):
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
+
 2013-06-05  Kangil Han  <[email protected]>
 
         [EFL][WK2] Fix test_ewk2_view unit test timed out issue

Modified: trunk/Source/WebKit2/Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp (151261 => 151262)


--- trunk/Source/WebKit2/Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp	2013-06-06 09:19:57 UTC (rev 151261)
+++ trunk/Source/WebKit2/Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp	2013-06-06 09:43:20 UTC (rev 151262)
@@ -183,6 +183,14 @@
     return true;
 }
 
+void WebCoordinatedSurface::paintToSurface(const IntRect& rect, CoordinatedSurface::Client* client)
+{
+    ASSERT(client);
+
+    OwnPtr<GraphicsContext> context = createGraphicsContext(rect);
+    client->paintToSurfaceContext(context.get());
+}
+
 #if USE(TEXTURE_MAPPER)
 void WebCoordinatedSurface::copyToTexture(PassRefPtr<WebCore::BitmapTexture> passTexture, const IntRect& target, const IntPoint& sourceOffset)
 {

Modified: trunk/Source/WebKit2/Shared/CoordinatedGraphics/WebCoordinatedSurface.h (151261 => 151262)


--- trunk/Source/WebKit2/Shared/CoordinatedGraphics/WebCoordinatedSurface.h	2013-06-06 09:19:57 UTC (rev 151261)
+++ trunk/Source/WebKit2/Shared/CoordinatedGraphics/WebCoordinatedSurface.h	2013-06-06 09:43:20 UTC (rev 151262)
@@ -73,7 +73,7 @@
 
     virtual WebCore::IntSize size() const OVERRIDE { return m_size; }
 
-    virtual PassOwnPtr<WebCore::GraphicsContext> createGraphicsContext(const WebCore::IntRect&) OVERRIDE;
+    virtual void paintToSurface(const WebCore::IntRect&, WebCore::CoordinatedSurface::Client*) OVERRIDE;
 
 #if USE(TEXTURE_MAPPER)
     virtual void copyToTexture(PassRefPtr<WebCore::BitmapTexture>, const WebCore::IntRect& target, const WebCore::IntPoint& sourceOffset) OVERRIDE;
@@ -87,6 +87,7 @@
     // Create a WebCoordinatedSurface referencing an existing ShareableBitmap.
     static PassRefPtr<WebCoordinatedSurface> create(const WebCore::IntSize&, Flags, PassRefPtr<ShareableBitmap>);
 
+    PassOwnPtr<WebCore::GraphicsContext> createGraphicsContext(const WebCore::IntRect&);
 #if USE(GRAPHICS_SURFACE)
     WebCoordinatedSurface(const WebCore::IntSize&, Flags, PassRefPtr<WebCore::GraphicsSurface>);
     // Create a shareable bitmap backed by a graphics surface.

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp (151261 => 151262)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp	2013-06-06 09:19:57 UTC (rev 151261)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp	2013-06-06 09:43:20 UTC (rev 151262)
@@ -670,23 +670,21 @@
     m_updateAtlases.clear();
 }
 
-PassOwnPtr<GraphicsContext> CoordinatedLayerTreeHost::beginContentUpdate(const IntSize& size, CoordinatedSurface::Flags flags, uint32_t& atlasID, IntPoint& offset)
+bool CoordinatedLayerTreeHost::paintToSurface(const IntSize& size, CoordinatedSurface::Flags flags, uint32_t& atlasID, IntPoint& offset, CoordinatedSurface::Client* client)
 {
-    OwnPtr<GraphicsContext> graphicsContext;
     for (unsigned i = 0; i < m_updateAtlases.size(); ++i) {
         UpdateAtlas* atlas = m_updateAtlases[i].get();
         if (atlas->supportsAlpha() == (flags & CoordinatedSurface::SupportsAlpha)) {
-            // This will return null if there is no available buffer space.
-            graphicsContext = atlas->beginPaintingOnAvailableBuffer(atlasID, size, offset);
-            if (graphicsContext)
-                return graphicsContext.release();
+            // This will false if there is no available buffer space.
+            if (atlas->paintOnAvailableBuffer(size, atlasID, offset, client))
+                return true;
         }
     }
 
     static const int ScratchBufferDimension = 1024; // Should be a power of two.
     m_updateAtlases.append(adoptPtr(new UpdateAtlas(this, ScratchBufferDimension, flags)));
     scheduleReleaseInactiveAtlases();
-    return m_updateAtlases.last()->beginPaintingOnAvailableBuffer(atlasID, size, offset);
+    return m_updateAtlases.last()->paintOnAvailableBuffer(size, atlasID, offset, client);
 }
 
 const double ReleaseInactiveAtlasesTimerInterval = 0.5;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h (151261 => 151262)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h	2013-06-06 09:19:57 UTC (rev 151261)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h	2013-06-06 09:43:20 UTC (rev 151262)
@@ -124,7 +124,7 @@
     virtual WebCore::FloatRect visibleContentsRect() const;
     virtual PassRefPtr<WebCore::CoordinatedImageBacking> createImageBackingIfNeeded(WebCore::Image*) OVERRIDE;
     virtual void detachLayer(WebCore::CoordinatedGraphicsLayer*);
-    virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, WebCore::CoordinatedSurface::Flags, uint32_t& atlasID, WebCore::IntPoint&);
+    virtual bool paintToSurface(const WebCore::IntSize&, WebCore::CoordinatedSurface::Flags, uint32_t& /* atlasID */, WebCore::IntPoint&, WebCore::CoordinatedSurface::Client*) OVERRIDE;
     virtual void syncLayerState(WebCore::CoordinatedLayerID, WebCore::CoordinatedGraphicsLayerState&);
 
     // UpdateAtlas::Client
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to