Coordinated Graphics: Add CoordinatedSurface to remove the dependency of ShareableSur...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Dec 2012 08:28:29 +0000 (08:28 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Dec 2012 08:28:29 +0000 (08:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=100819

Patch by Huang Dongsung <luxtella@company100.net> on 2012-12-10
Reviewed by Noam Rosenthal.

Internal Review by Gwang Yoon Hwang and Jae Hyun Park.

It is a preparation patch for Threaded Coordinated Graphics on WK1.

Create a CoordinatedSurface class that can be the base class both for
the current IPC-based ShareableSurface, renamed here to
WebCoordinatedSurface, and to a future thread-based surface
implementation.

* CMakeLists.txt:
* Shared/CoordinatedGraphics/CoordinatedSurface.h: Added.
(WebCore):
(WebKit):
(CoordinatedSurface):
(WebKit::CoordinatedSurface::~CoordinatedSurface):
(WebKit::CoordinatedSurface::supportsAlpha):
* Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp: Renamed from Source/WebKit2/Shared/ShareableSurface.cpp.
  Extends CoordinatedSurface.
(WebKit):
(WebKit::WebCoordinatedSurface::Handle::Handle):
(WebKit::WebCoordinatedSurface::Handle::encode):
(WebKit::WebCoordinatedSurface::Handle::decode):
(WebKit::CoordinatedSurface::create):
(WebKit::WebCoordinatedSurface::create):
(WebKit::WebCoordinatedSurface::createWithSurface):
(WebKit::WebCoordinatedSurface::createGraphicsContext):
(WebKit::WebCoordinatedSurface::WebCoordinatedSurface):
(WebKit::WebCoordinatedSurface::~WebCoordinatedSurface):
(WebKit::WebCoordinatedSurface::createHandle):
(WebKit::WebCoordinatedSurface::copyToTexture):
* Shared/CoordinatedGraphics/WebCoordinatedSurface.h: Renamed from Source/WebKit2/Shared/ShareableSurface.h.
(WebCore):
(WebKit):
(WebCoordinatedSurface):
(Handle):
(WebKit::WebCoordinatedSurface::Handle::graphicsSurfaceToken):
(WebKit::WebCoordinatedSurface::isBackedByGraphicsSurface):
* Target.pri:
* UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp:
(WebKit::CoordinatedBackingStoreTile::swapBuffers):
(WebKit::CoordinatedBackingStoreTile::setBackBuffer):
(WebKit::CoordinatedBackingStore::updateTile):
* UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h:
(WebKit):
(CoordinatedBackingStoreTile):
(CoordinatedBackingStore):
* UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp:
(WebKit::LayerTreeCoordinatorProxy::createUpdateAtlas):
(WebKit::LayerTreeCoordinatorProxy::updateImageBacking):
* UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h:
(LayerTreeCoordinatorProxy):
* UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in:
* UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:
(WebKit::LayerTreeRenderer::updateImageBacking):
* UIProcess/CoordinatedGraphics/LayerTreeRenderer.h:
(TileUpdate):
(WebKit::LayerTreeRenderer::TileUpdate::TileUpdate):
(LayerTreeRenderer):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::beginContentUpdate):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h:
(CoordinatedGraphicsLayerClient):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedImageBacking.cpp:
(WebKit::CoordinatedImageBacking::update):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedImageBacking.h:
(Coordinator):
(CoordinatedImageBacking):
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp:
(WebKit::LayerTreeCoordinator::updateImageBacking):
(WebKit::LayerTreeCoordinator::createUpdateAtlas):
(WebKit::LayerTreeCoordinator::beginContentUpdate):
(WebKit::LayerTreeCoordinator::releaseInactiveAtlasesTimerFired):
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h:
(LayerTreeCoordinator):
* WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp:
(WebKit::UpdateAtlas::UpdateAtlas):
(WebKit::UpdateAtlas::beginPaintingOnAvailableBuffer):
* WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h:
(UpdateAtlasClient):
(UpdateAtlas):
(WebKit::UpdateAtlas::supportsAlpha):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137117 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
Source/WebKit2/CMakeLists.txt
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedSurface.h [new file with mode: 0644]
Source/WebKit2/Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp [moved from Source/WebKit2/Shared/ShareableSurface.cpp with 61% similarity]
Source/WebKit2/Shared/CoordinatedGraphics/WebCoordinatedSurface.h [moved from Source/WebKit2/Shared/ShareableSurface.h with 50% similarity]
Source/WebKit2/Target.pri
Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp
Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h
Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp
Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h
Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in
Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp
Source/WebKit2/UIProcess/CoordinatedGraphics/LayerTreeRenderer.h
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedImageBacking.cpp
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedImageBacking.h
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h

index 83b6eebd2608d2993763dbbc9b7acdfe3d32abe0..47f5bdd9f7dcebbf74a2a7f105c2e9985b58d7bc 100644 (file)
@@ -156,7 +156,6 @@ set(WebKit2_SOURCES
     Shared/SecurityOriginData.cpp
     Shared/SessionState.cpp
     Shared/ShareableBitmap.cpp
-    Shared/ShareableSurface.cpp
     Shared/StatisticsData.cpp
     Shared/SurfaceUpdateInfo.cpp
     Shared/UpdateInfo.cpp
@@ -221,6 +220,7 @@ set(WebKit2_SOURCES
 
     Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp
     Shared/CoordinatedGraphics/CoordinatedLayerInfo.cpp
+    Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp
     Shared/CoordinatedGraphics/WebCustomFilterProgramProxy.cpp
 
     Shared/Plugins/NPIdentifierData.cpp
index 6f6bce3ac24b11f7aee88e6eb462f34e7308bbf3..e0137e5406b85d8a8cc35f4bbc489619642a04d4 100644 (file)
@@ -1,3 +1,92 @@
+2012-12-10  Huang Dongsung  <luxtella@company100.net>
+
+        Coordinated Graphics: Add CoordinatedSurface to remove the dependency of ShareableSurface from Coordinated Graphics.
+        https://bugs.webkit.org/show_bug.cgi?id=100819
+
+        Reviewed by Noam Rosenthal.
+
+        Internal Review by Gwang Yoon Hwang and Jae Hyun Park.
+
+        It is a preparation patch for Threaded Coordinated Graphics on WK1.
+
+        Create a CoordinatedSurface class that can be the base class both for
+        the current IPC-based ShareableSurface, renamed here to
+        WebCoordinatedSurface, and to a future thread-based surface
+        implementation.
+
+        * CMakeLists.txt:
+        * Shared/CoordinatedGraphics/CoordinatedSurface.h: Added.
+        (WebCore):
+        (WebKit):
+        (CoordinatedSurface):
+        (WebKit::CoordinatedSurface::~CoordinatedSurface):
+        (WebKit::CoordinatedSurface::supportsAlpha):
+        * Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp: Renamed from Source/WebKit2/Shared/ShareableSurface.cpp.
+          Extends CoordinatedSurface.
+        (WebKit):
+        (WebKit::WebCoordinatedSurface::Handle::Handle):
+        (WebKit::WebCoordinatedSurface::Handle::encode):
+        (WebKit::WebCoordinatedSurface::Handle::decode):
+        (WebKit::CoordinatedSurface::create):
+        (WebKit::WebCoordinatedSurface::create):
+        (WebKit::WebCoordinatedSurface::createWithSurface):
+        (WebKit::WebCoordinatedSurface::createGraphicsContext):
+        (WebKit::WebCoordinatedSurface::WebCoordinatedSurface):
+        (WebKit::WebCoordinatedSurface::~WebCoordinatedSurface):
+        (WebKit::WebCoordinatedSurface::createHandle):
+        (WebKit::WebCoordinatedSurface::copyToTexture):
+        * Shared/CoordinatedGraphics/WebCoordinatedSurface.h: Renamed from Source/WebKit2/Shared/ShareableSurface.h.
+        (WebCore):
+        (WebKit):
+        (WebCoordinatedSurface):
+        (Handle):
+        (WebKit::WebCoordinatedSurface::Handle::graphicsSurfaceToken):
+        (WebKit::WebCoordinatedSurface::isBackedByGraphicsSurface):
+        * Target.pri:
+        * UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp:
+        (WebKit::CoordinatedBackingStoreTile::swapBuffers):
+        (WebKit::CoordinatedBackingStoreTile::setBackBuffer):
+        (WebKit::CoordinatedBackingStore::updateTile):
+        * UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h:
+        (WebKit):
+        (CoordinatedBackingStoreTile):
+        (CoordinatedBackingStore):
+        * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.cpp:
+        (WebKit::LayerTreeCoordinatorProxy::createUpdateAtlas):
+        (WebKit::LayerTreeCoordinatorProxy::updateImageBacking):
+        * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.h:
+        (LayerTreeCoordinatorProxy):
+        * UIProcess/CoordinatedGraphics/LayerTreeCoordinatorProxy.messages.in:
+        * UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp:
+        (WebKit::LayerTreeRenderer::updateImageBacking):
+        * UIProcess/CoordinatedGraphics/LayerTreeRenderer.h:
+        (TileUpdate):
+        (WebKit::LayerTreeRenderer::TileUpdate::TileUpdate):
+        (LayerTreeRenderer):
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp:
+        (WebCore::CoordinatedGraphicsLayer::beginContentUpdate):
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h:
+        (CoordinatedGraphicsLayerClient):
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedImageBacking.cpp:
+        (WebKit::CoordinatedImageBacking::update):
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedImageBacking.h:
+        (Coordinator):
+        (CoordinatedImageBacking):
+        * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp:
+        (WebKit::LayerTreeCoordinator::updateImageBacking):
+        (WebKit::LayerTreeCoordinator::createUpdateAtlas):
+        (WebKit::LayerTreeCoordinator::beginContentUpdate):
+        (WebKit::LayerTreeCoordinator::releaseInactiveAtlasesTimerFired):
+        * WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h:
+        (LayerTreeCoordinator):
+        * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp:
+        (WebKit::UpdateAtlas::UpdateAtlas):
+        (WebKit::UpdateAtlas::beginPaintingOnAvailableBuffer):
+        * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h:
+        (UpdateAtlasClient):
+        (UpdateAtlas):
+        (WebKit::UpdateAtlas::supportsAlpha):
+
 2012-12-09  Huang Dongsung  <luxtella@company100.net>
 
         Coordinated Graphics: Reorder messages to LayerTreeCoordinatorProxy
diff --git a/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedSurface.h b/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedSurface.h
new file mode 100644 (file)
index 0000000..def71c2
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+ Copyright (C) 2012 Company 100, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB.  If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CoordinatedSurface_h
+#define CoordinatedSurface_h
+
+#if USE(COORDINATED_GRAPHICS)
+#include "IntRect.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/ThreadSafeRefCounted.h>
+
+namespace WebCore {
+class BitmapTexture;
+class GraphicsContext;
+}
+
+namespace WebKit {
+
+class CoordinatedSurface : public ThreadSafeRefCounted<CoordinatedSurface> {
+public:
+    enum Flag {
+        NoFlags = 0,
+        SupportsAlpha = 1 << 0,
+    };
+    typedef unsigned Flags;
+
+    static PassRefPtr<CoordinatedSurface> create(const WebCore::IntSize&, Flags);
+
+    virtual ~CoordinatedSurface() { }
+
+    bool supportsAlpha() { return flags() & SupportsAlpha; }
+    virtual WebCore::IntSize size() const = 0;
+
+    // Create a graphics context that can be used to paint into the backing store.
+    virtual PassOwnPtr<WebCore::GraphicsContext> createGraphicsContext(const WebCore::IntRect&) = 0;
+
+#if USE(TEXTURE_MAPPER)
+    virtual void copyToTexture(PassRefPtr<WebCore::BitmapTexture>, const WebCore::IntRect& target, const WebCore::IntPoint& sourceOffset) = 0;
+#endif
+
+protected:
+    virtual Flags flags() const = 0;
+};
+
+} // namespace WebKit
+
+#endif
+#endif // CoordinatedSurface_h
similarity index 61%
rename from Source/WebKit2/Shared/ShareableSurface.cpp
rename to Source/WebKit2/Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp
index bf8fa1069935c966745662f0f127fdb2947c6585..f790c79fce60c58e80570b33f956904c51f81b39 100644 (file)
@@ -1,5 +1,6 @@
 /*
  Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+ Copyright (C) 2012 Company 100, Inc.
 
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Library General Public
@@ -18,8 +19,9 @@
  */
 
 #include "config.h"
-#include "ShareableSurface.h"
+#include "WebCoordinatedSurface.h"
 
+#if USE(COORDINATED_GRAPHICS)
 #include "CoordinatedGraphicsArgumentCoders.h"
 #include "GraphicsContext.h"
 #include "WebCoreArgumentCoders.h"
@@ -33,11 +35,11 @@ using namespace WebCore;
 
 namespace WebKit {
 
-ShareableSurface::Handle::Handle()
+WebCoordinatedSurface::Handle::Handle()
 {
 }
 
-void ShareableSurface::Handle::encode(CoreIPC::ArgumentEncoder& encoder) const
+void WebCoordinatedSurface::Handle::encode(CoreIPC::ArgumentEncoder& encoder) const
 {
     encoder.encode(m_size);
     encoder.encode(m_flags);
@@ -49,7 +51,7 @@ void ShareableSurface::Handle::encode(CoreIPC::ArgumentEncoder& encoder) const
     encoder.encode(m_bitmapHandle);
 }
 
-bool ShareableSurface::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle& handle)
+bool WebCoordinatedSurface::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle& handle)
 {
     if (!decoder->decode(handle.m_size))
         return false;
@@ -67,29 +69,33 @@ bool ShareableSurface::Handle::decode(CoreIPC::ArgumentDecoder* decoder, Handle&
     return true;
 }
 
-PassRefPtr<ShareableSurface> ShareableSurface::create(const IntSize& size, ShareableBitmap::Flags flags, Hints hints)
+PassRefPtr<CoordinatedSurface> CoordinatedSurface::create(const WebCore::IntSize& size, CoordinatedSurface::Flags flags)
 {
+    return WebCoordinatedSurface::create(size, flags);
+}
+
+PassRefPtr<WebCoordinatedSurface> WebCoordinatedSurface::create(const IntSize& size, CoordinatedSurface::Flags flags)
+{
+    RefPtr<WebCoordinatedSurface> surface;
 #if USE(GRAPHICS_SURFACE)
-    if (hints & SupportsGraphicsSurface) {
-        RefPtr<ShareableSurface> surface = createWithSurface(size, flags);
-        if (surface)
-            return surface.release();
-    }
+    surface = createWithSurface(size, flags);
 #endif
-    UNUSED_PARAM(hints);
 
-    return create(size, flags, ShareableBitmap::createShareable(size, flags));
+    if (!surface)
+        surface = create(size, flags, ShareableBitmap::createShareable(size, (flags & SupportsAlpha) ? ShareableBitmap::SupportsAlpha : ShareableBitmap::NoFlags));
+
+    return surface.release();
 }
 
 #if USE(GRAPHICS_SURFACE)
-PassRefPtr<ShareableSurface> ShareableSurface::createWithSurface(const IntSize& size, ShareableBitmap::Flags flags)
+PassRefPtr<WebCoordinatedSurface> WebCoordinatedSurface::createWithSurface(const IntSize& size, CoordinatedSurface::Flags flags)
 {
     GraphicsSurface::Flags surfaceFlags =
-            GraphicsSurface::SupportsSoftwareWrite
-            | GraphicsSurface::SupportsCopyToTexture
-            | GraphicsSurface::SupportsSharing;
+        GraphicsSurface::SupportsSoftwareWrite
+        | GraphicsSurface::SupportsCopyToTexture
+        | GraphicsSurface::SupportsSharing;
 
-    if (flags & ShareableBitmap::SupportsAlpha)
+    if (flags & SupportsAlpha)
         surfaceFlags |= GraphicsSurface::SupportsAlpha;
 
     // This might return null, if the system is unable to provide a new graphics surface.
@@ -99,12 +105,12 @@ PassRefPtr<ShareableSurface> ShareableSurface::createWithSurface(const IntSize&
         return 0;
 
     ASSERT(surface);
-    return adoptRef(new ShareableSurface(size, flags, surface.release()));
+    return adoptRef(new WebCoordinatedSurface(size, flags, surface.release()));
 }
 #endif
 
-PassOwnPtr<WebCore::GraphicsContext> ShareableSurface::createGraphicsContext(const IntRect& rect)
-{    
+PassOwnPtr<WebCore::GraphicsContext> WebCoordinatedSurface::createGraphicsContext(const IntRect& rect)
+{
 #if USE(GRAPHICS_SURFACE)
     if (isBackedByGraphicsSurface())
         return m_graphicsSurface->beginPaint(rect, 0 /* Write without retaining pixels*/);
@@ -117,12 +123,12 @@ PassOwnPtr<WebCore::GraphicsContext> ShareableSurface::createGraphicsContext(con
     return graphicsContext.release();
 }
 
-PassRefPtr<ShareableSurface> ShareableSurface::create(const IntSize& size, ShareableBitmap::Flags flags, PassRefPtr<ShareableBitmap> bitmap)
+PassRefPtr<WebCoordinatedSurface> WebCoordinatedSurface::create(const IntSize& size, CoordinatedSurface::Flags flags, PassRefPtr<ShareableBitmap> bitmap)
 {
-    return adoptRef(new ShareableSurface(size, flags, bitmap));
+    return adoptRef(new WebCoordinatedSurface(size, flags, bitmap));
 }
 
-ShareableSurface::ShareableSurface(const IntSize& size, ShareableBitmap::Flags flags, PassRefPtr<ShareableBitmap> bitmap)
+WebCoordinatedSurface::WebCoordinatedSurface(const IntSize& size, CoordinatedSurface::Flags flags, PassRefPtr<ShareableBitmap> bitmap)
     : m_size(size)
     , m_flags(flags)
     , m_bitmap(bitmap)
@@ -130,30 +136,33 @@ ShareableSurface::ShareableSurface(const IntSize& size, ShareableBitmap::Flags f
 }
 
 #if USE(GRAPHICS_SURFACE)
-ShareableSurface::ShareableSurface(const WebCore::IntSize& size, ShareableBitmap::Flags flags, PassRefPtr<WebCore::GraphicsSurface> surface)
+WebCoordinatedSurface::WebCoordinatedSurface(const WebCore::IntSize& size, CoordinatedSurface::Flags flags, PassRefPtr<WebCore::GraphicsSurface> surface)
     : m_size(size)
     , m_flags(flags)
     , m_graphicsSurface(surface)
 {
 }
 
-PassRefPtr<ShareableSurface> ShareableSurface::create(const IntSize& size, ShareableBitmap::Flags flags, PassRefPtr<GraphicsSurface> surface)
+PassRefPtr<WebCoordinatedSurface> WebCoordinatedSurface::create(const IntSize& size, CoordinatedSurface::Flags flags, PassRefPtr<GraphicsSurface> surface)
 {
-    return adoptRef(new ShareableSurface(size, flags, surface));
+    return adoptRef(new WebCoordinatedSurface(size, flags, surface));
 }
 #endif
 
-ShareableSurface::~ShareableSurface()
+WebCoordinatedSurface::~WebCoordinatedSurface()
 {
 }
 
-PassRefPtr<ShareableSurface> ShareableSurface::create(const Handle& handle)
+PassRefPtr<WebCoordinatedSurface> WebCoordinatedSurface::create(const Handle& handle)
 {
 #if USE(GRAPHICS_SURFACE)
     if (handle.graphicsSurfaceToken().isValid()) {
-        RefPtr<GraphicsSurface> surface = GraphicsSurface::create(handle.m_size, handle.m_flags, handle.m_graphicsSurfaceToken);
+        GraphicsSurface::Flags surfaceFlags = 0;
+        if (handle.m_flags & SupportsAlpha)
+            surfaceFlags |= GraphicsSurface::SupportsAlpha;
+        RefPtr<GraphicsSurface> surface = GraphicsSurface::create(handle.m_size, surfaceFlags, handle.m_graphicsSurfaceToken);
         if (surface)
-            return adoptRef(new ShareableSurface(handle.m_size, handle.m_flags, PassRefPtr<GraphicsSurface>(surface)));
+            return adoptRef(new WebCoordinatedSurface(handle.m_size, handle.m_flags, PassRefPtr<GraphicsSurface>(surface)));
     }
 #endif
 
@@ -164,7 +173,7 @@ PassRefPtr<ShareableSurface> ShareableSurface::create(const Handle& handle)
     return create(handle.m_size, handle.m_flags, bitmap.release());
 }
 
-bool ShareableSurface::createHandle(Handle& handle)
+bool WebCoordinatedSurface::createHandle(Handle& handle)
 {
     handle.m_size = m_size;
     handle.m_flags = m_flags;
@@ -181,7 +190,7 @@ bool ShareableSurface::createHandle(Handle& handle)
 }
 
 #if USE(TEXTURE_MAPPER)
-void ShareableSurface::copyToTexture(PassRefPtr<WebCore::BitmapTexture> passTexture, const IntRect& target, const IntPoint& sourceOffset)
+void WebCoordinatedSurface::copyToTexture(PassRefPtr<WebCore::BitmapTexture> passTexture, const IntRect& target, const IntPoint& sourceOffset)
 {
     RefPtr<BitmapTexture> texture(passTexture);
 
@@ -208,3 +217,4 @@ void ShareableSurface::copyToTexture(PassRefPtr<WebCore::BitmapTexture> passText
 #endif // USE(TEXTURE_MAPPER)
 
 } // namespace WebKit
+#endif // USE(COORDINATED_GRAPHICS)
similarity index 50%
rename from Source/WebKit2/Shared/ShareableSurface.h
rename to Source/WebKit2/Shared/CoordinatedGraphics/WebCoordinatedSurface.h
index e0e7a39f28a767155a4e9bffdce97fa459b7df4e..b828aad8174542edd37b18e37f26cdc94ab809f0 100644 (file)
@@ -1,5 +1,6 @@
 /*
  Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+ Copyright (C) 2012 Company 100, Inc.
 
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Library General Public
  Boston, MA 02110-1301, USA.
  */
 
-#ifndef ShareableSurface_h
-#define ShareableSurface_h
+#ifndef WebCoordinatedSurface_h
+#define WebCoordinatedSurface_h
 
+#if USE(COORDINATED_GRAPHICS)
+#include "CoordinatedSurface.h"
 #include "ShareableBitmap.h"
 
-#include <wtf/ThreadSafeRefCounted.h>
-
 #if USE(GRAPHICS_SURFACE)
 #include "GraphicsSurface.h"
 #endif
 
 namespace WebCore {
 class BitmapTexture;
-class Image;
 class GraphicsContext;
 }
 
 namespace WebKit {
 
-class ShareableSurface : public ThreadSafeRefCounted<ShareableSurface> {
+class WebCoordinatedSurface : public CoordinatedSurface {
 public:
-    enum Hint {
-        SupportsGraphicsSurface = 0x01
-    };
-
-    typedef unsigned Hints;
-
     class Handle {
         WTF_MAKE_NONCOPYABLE(Handle);
     public:
         Handle();
 
-        bool isNull() const;
-
         void encode(CoreIPC::ArgumentEncoder&) const;
         static bool decode(CoreIPC::ArgumentDecoder*, Handle&);
 
@@ -59,56 +51,54 @@ public:
 #endif
 
     private:
-        friend class ShareableSurface;
+        friend class WebCoordinatedSurface;
         mutable ShareableBitmap::Handle m_bitmapHandle;
 #if USE(GRAPHICS_SURFACE)
         WebCore::GraphicsSurfaceToken m_graphicsSurfaceToken;
 #endif
         WebCore::IntSize m_size;
-        ShareableBitmap::Flags m_flags;
+        CoordinatedSurface::Flags m_flags;
     };
 
-    // Create a new ShareableSurface, and allocate either a GraphicsSurface or a ShareableBitmap as backing.
-    static PassRefPtr<ShareableSurface> create(const WebCore::IntSize&, ShareableBitmap::Flags, Hints);
+    // Create a new WebCoordinatedSurface, and allocate either a GraphicsSurface or a ShareableBitmap as backing.
+    static PassRefPtr<WebCoordinatedSurface> create(const WebCore::IntSize&, Flags);
 
     // Create a shareable surface from a handle.
-    static PassRefPtr<ShareableSurface> create(const Handle&);
-
-    ShareableBitmap::Flags flags() const { return m_flags; }
+    static PassRefPtr<WebCoordinatedSurface> create(const Handle&);
 
     // Create a handle.
     bool createHandle(Handle&);
 
-    ~ShareableSurface();
+    virtual ~WebCoordinatedSurface();
 
-    const WebCore::IntSize& size() const { return m_size; }
-    WebCore::IntRect bounds() const { return WebCore::IntRect(WebCore::IntPoint(), size()); }
+    virtual WebCore::IntSize size() const OVERRIDE { return m_size; }
 
-    // Create a graphics context that can be used to paint into the backing store.
-    PassOwnPtr<WebCore::GraphicsContext> createGraphicsContext(const WebCore::IntRect&);
+    virtual PassOwnPtr<WebCore::GraphicsContext> createGraphicsContext(const WebCore::IntRect&) OVERRIDE;
 
 #if USE(TEXTURE_MAPPER)
-    void copyToTexture(PassRefPtr<WebCore::BitmapTexture>, const WebCore::IntRect& target, const WebCore::IntPoint& sourceOffset);
+    virtual void copyToTexture(PassRefPtr<WebCore::BitmapTexture>, const WebCore::IntRect& target, const WebCore::IntPoint& sourceOffset) OVERRIDE;
 #endif
 
 private:
-    ShareableSurface(const WebCore::IntSize&, ShareableBitmap::Flags, PassRefPtr<ShareableBitmap>);
+    WebCoordinatedSurface(const WebCore::IntSize&, Flags, PassRefPtr<ShareableBitmap>);
+
+    virtual Flags flags() const OVERRIDE { return m_flags; }
 
-    // Create a ShareableSurface referencing an existing ShareableBitmap.
-    static PassRefPtr<ShareableSurface> create(const WebCore::IntSize&, ShareableBitmap::Flags, PassRefPtr<ShareableBitmap>);
+    // Create a WebCoordinatedSurface referencing an existing ShareableBitmap.
+    static PassRefPtr<WebCoordinatedSurface> create(const WebCore::IntSize&, Flags, PassRefPtr<ShareableBitmap>);
 
 #if USE(GRAPHICS_SURFACE)
-    ShareableSurface(const WebCore::IntSize&, ShareableBitmap::Flags, PassRefPtr<WebCore::GraphicsSurface>);
+    WebCoordinatedSurface(const WebCore::IntSize&, Flags, PassRefPtr<WebCore::GraphicsSurface>);
     // Create a shareable bitmap backed by a graphics surface.
-    static PassRefPtr<ShareableSurface> createWithSurface(const WebCore::IntSize&, ShareableBitmap::Flags);
-    // Create a ShareableSurface referencing an existing GraphicsSurface.
-    static PassRefPtr<ShareableSurface> create(const WebCore::IntSize&, ShareableBitmap::Flags, PassRefPtr<WebCore::GraphicsSurface>);
+    static PassRefPtr<WebCoordinatedSurface> createWithSurface(const WebCore::IntSize&, Flags);
+    // Create a WebCoordinatedSurface referencing an existing GraphicsSurface.
+    static PassRefPtr<WebCoordinatedSurface> create(const WebCore::IntSize&, Flags, PassRefPtr<WebCore::GraphicsSurface>);
 
     bool isBackedByGraphicsSurface() const { return !!m_graphicsSurface; }
 #endif
 
     WebCore::IntSize m_size;
-    ShareableBitmap::Flags m_flags;
+    Flags m_flags;
     RefPtr<ShareableBitmap> m_bitmap;
 
 #if USE(GRAPHICS_SURFACE)
@@ -118,4 +108,5 @@ private:
 
 } // namespace WebKit
 
-#endif // ShareableSurface_h
+#endif // USE(COORDINATED_GRAPHICS)
+#endif // WebCoordinatedSurface_h
index 1260b3c1aa46bb5cb24634abcc1b12f4d9431473..221b03140a42f914d87a69266c2b3e03baed3bd3 100644 (file)
@@ -71,7 +71,6 @@ HEADERS += \
     Shared/API/c/qt/WKImageQt.h \
     Shared/APIClientTraits.h \
     Shared/ShareableBitmap.h \
-    Shared/ShareableSurface.h \
     Shared/CacheModel.h \
     Shared/ChildProcess.h \
     Shared/ChildProcessProxy.h \
@@ -136,6 +135,8 @@ HEADERS += \
     Shared/WebUserContentURLPattern.h \
     Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.h \
     Shared/CoordinatedGraphics/CoordinatedLayerInfo.h \
+    Shared/CoordinatedGraphics/CoordinatedSurface.h \
+    Shared/CoordinatedGraphics/WebCoordinatedSurface.h \
     Shared/CoordinatedGraphics/WebCustomFilterProgram.h \
     Shared/Plugins/Netscape/NetscapePluginModule.h \
     Shared/Plugins/NPRemoteObjectMap.h \
@@ -442,7 +443,6 @@ SOURCES += \
     Shared/Plugins/Netscape/NetscapePluginModuleNone.cpp \
     Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp \
     Shared/ShareableBitmap.cpp \
-    Shared/ShareableSurface.cpp \
     Shared/Plugins/NPRemoteObjectMap.cpp \
     Shared/Plugins/NPIdentifierData.cpp \
     Shared/Plugins/NPObjectMessageReceiver.cpp \
@@ -505,6 +505,7 @@ SOURCES += \
     Shared/WebWheelEvent.cpp \
     Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp \
     Shared/CoordinatedGraphics/CoordinatedLayerInfo.cpp \
+    Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp \
     Shared/CoordinatedGraphics/WebCustomFilterProgramProxy.cpp \
     Shared/qt/ArgumentCodersQt.cpp \
     Shared/qt/LayerTreeContextQt.cpp \
index 70e9ce25ff3d79db7324cc2c5e8b902120143a02..4a7bb1086ee7a867b2d3fd680c5a37db05b8b7d8 100644 (file)
@@ -21,8 +21,8 @@
 #include "CoordinatedBackingStore.h"
 
 #if USE(COORDINATED_GRAPHICS)
+#include "CoordinatedSurface.h"
 #include "GraphicsLayer.h"
-#include "ShareableSurface.h"
 #include "TextureMapper.h"
 #include "TextureMapperGL.h"
 
@@ -51,13 +51,13 @@ void CoordinatedBackingStoreTile::swapBuffers(WebCore::TextureMapper* textureMap
 
     ASSERT(textureMapper->maxTextureSize().width() >= m_tileRect.size().width() && textureMapper->maxTextureSize().height() >= m_tileRect.size().height());
     if (shouldReset)
-        texture->reset(m_tileRect.size(), m_surface->flags() & ShareableBitmap::SupportsAlpha ? BitmapTexture::SupportsAlpha : 0);
+        texture->reset(m_tileRect.size(), m_surface->supportsAlpha());
 
     m_surface->copyToTexture(texture, m_sourceRect, m_surfaceOffset);
     m_surface.clear();
 }
 
-void CoordinatedBackingStoreTile::setBackBuffer(const IntRect& tileRect, const IntRect& sourceRect, PassRefPtr<ShareableSurface> buffer, const IntPoint& offset)
+void CoordinatedBackingStoreTile::setBackBuffer(const IntRect& tileRect, const IntRect& sourceRect, PassRefPtr<CoordinatedSurface> buffer, const IntPoint& offset)
 {
     m_sourceRect = sourceRect;
     m_tileRect = tileRect;
@@ -84,7 +84,7 @@ void CoordinatedBackingStore::removeAllTiles()
         m_tilesToRemove.add(it->key);
 }
 
-void CoordinatedBackingStore::updateTile(uint32_t id, const IntRect& sourceRect, const IntRect& tileRect, PassRefPtr<ShareableSurface> backBuffer, const IntPoint& offset)
+void CoordinatedBackingStore::updateTile(uint32_t id, const IntRect& sourceRect, const IntRect& tileRect, PassRefPtr<CoordinatedSurface> backBuffer, const IntPoint& offset)
 {
     HashMap<uint32_t, CoordinatedBackingStoreTile>::iterator it = m_tiles.find(id);
     ASSERT(it != m_tiles.end());
index cd151f8476ecd5bfcb0c2286a54c133153f85a99..ae5af8d4fa2fc9ebd2119727fcadd85962330f99 100644 (file)
@@ -29,7 +29,7 @@
 
 namespace WebKit {
 
-class ShareableSurface;
+class CoordinatedSurface;
 
 class CoordinatedBackingStoreTile : public WebCore::TextureMapperTile {
 public:
@@ -44,10 +44,10 @@ public:
     inline void incrementRepaintCount() { ++m_repaintCount; }
     inline int repaintCount() const { return m_repaintCount; }
     void swapBuffers(WebCore::TextureMapper*);
-    void setBackBuffer(const WebCore::IntRect&, const WebCore::IntRect&, PassRefPtr<ShareableSurface> buffer, const WebCore::IntPoint&);
+    void setBackBuffer(const WebCore::IntRect&, const WebCore::IntRect&, PassRefPtr<CoordinatedSurface> buffer, const WebCore::IntPoint&);
 
 private:
-    RefPtr<ShareableSurface> m_surface;
+    RefPtr<CoordinatedSurface> m_surface;
     WebCore::IntRect m_sourceRect;
     WebCore::IntRect m_tileRect;
     WebCore::IntPoint m_surfaceOffset;
@@ -60,7 +60,7 @@ public:
     void createTile(uint32_t tileID, float);
     void removeTile(uint32_t tileID);
     void removeAllTiles();
-    void updateTile(uint32_t tileID, const WebCore::IntRect&, const WebCore::IntRect&, PassRefPtr<ShareableSurface>, const WebCore::IntPoint&);
+    void updateTile(uint32_t tileID, const WebCore::IntRect&, const WebCore::IntRect&, PassRefPtr<CoordinatedSurface>, const WebCore::IntPoint&);
     static PassRefPtr<CoordinatedBackingStore> create() { return adoptRef(new CoordinatedBackingStore); }
     void commitTileOperations(WebCore::TextureMapper*);
     PassRefPtr<WebCore::BitmapTexture> texture() const;
index d370448648fe884ea9e4edfe156dc676836de739..6eb1493ad1aa820b6616b704768a3f5ae7bf4315 100644 (file)
@@ -25,7 +25,6 @@
 #include "CoordinatedLayerInfo.h"
 #include "LayerTreeCoordinatorMessages.h"
 #include "LayerTreeRenderer.h"
-#include "UpdateInfo.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebPageProxy.h"
 #include "WebProcessProxy.h"
@@ -79,10 +78,10 @@ void LayerTreeCoordinatorProxy::removeTileForLayer(CoordinatedLayerID layerID, u
     dispatchUpdate(bind(&LayerTreeRenderer::removeTile, m_renderer.get(), layerID, tileID));
 }
 
-void LayerTreeCoordinatorProxy::createUpdateAtlas(int atlasID, const ShareableSurface::Handle& handle)
+void LayerTreeCoordinatorProxy::createUpdateAtlas(int atlasID, const WebCoordinatedSurface::Handle& handle)
 {
     ASSERT(!m_surfaces.contains(atlasID));
-    m_surfaces.add(atlasID, ShareableSurface::create(handle));
+    m_surfaces.add(atlasID, WebCoordinatedSurface::create(handle));
 }
 
 void LayerTreeCoordinatorProxy::removeUpdateAtlas(int atlasID)
@@ -146,9 +145,9 @@ void LayerTreeCoordinatorProxy::createImageBacking(CoordinatedImageBackingID ima
     dispatchUpdate(bind(&LayerTreeRenderer::createImageBacking, m_renderer.get(), imageID));
 }
 
-void LayerTreeCoordinatorProxy::updateImageBacking(CoordinatedImageBackingID imageID, const ShareableSurface::Handle& handle)
+void LayerTreeCoordinatorProxy::updateImageBacking(CoordinatedImageBackingID imageID, const WebCoordinatedSurface::Handle& handle)
 {
-    dispatchUpdate(bind(&LayerTreeRenderer::updateImageBacking, m_renderer.get(), imageID, ShareableSurface::create(handle)));
+    dispatchUpdate(bind(&LayerTreeRenderer::updateImageBacking, m_renderer.get(), imageID, WebCoordinatedSurface::create(handle)));
 }
 
 void LayerTreeCoordinatorProxy::clearImageBackingContents(CoordinatedImageBackingID imageID)
index 1e09dd5f4a6a94f571447959343e6569dc7bfb68..ddf61b3fec1d46804db60c47f0e5cd723e64e2fb 100644 (file)
@@ -27,8 +27,8 @@
 #include "CoordinatedLayerInfo.h"
 #include "DrawingAreaProxy.h"
 #include "Region.h"
-#include "ShareableSurface.h"
 #include "SurfaceUpdateInfo.h"
+#include "WebCoordinatedSurface.h"
 #include <WebCore/GraphicsContext.h>
 #include <WebCore/GraphicsLayer.h>
 #include <WebCore/GraphicsLayerAnimation.h>
@@ -69,10 +69,10 @@ public:
     void createTileForLayer(CoordinatedLayerID, uint32_t tileID, const WebCore::IntRect&, const SurfaceUpdateInfo&);
     void updateTileForLayer(CoordinatedLayerID, uint32_t tileID, const WebCore::IntRect&, const SurfaceUpdateInfo&);
     void removeTileForLayer(CoordinatedLayerID, uint32_t tileID);
-    void createUpdateAtlas(int atlasID, const ShareableSurface::Handle&);
+    void createUpdateAtlas(int atlasID, const WebCoordinatedSurface::Handle&);
     void removeUpdateAtlas(int atlasID);
     void createImageBacking(CoordinatedImageBackingID);
-    void updateImageBacking(CoordinatedImageBackingID, const ShareableSurface::Handle&);
+    void updateImageBacking(CoordinatedImageBackingID, const WebCoordinatedSurface::Handle&);
     void clearImageBackingContents(CoordinatedImageBackingID);
     void removeImageBacking(CoordinatedImageBackingID);
     void didReceiveLayerTreeCoordinatorProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
@@ -102,7 +102,7 @@ protected:
     WebCore::FloatRect m_lastSentVisibleRect;
     float m_lastSentScale;
     WebCore::FloatPoint m_lastSentTrajectoryVector;
-    typedef HashMap<int /* atlasID */, RefPtr<ShareableSurface> > SurfaceMap;
+    typedef HashMap<int /* atlasID */, RefPtr<CoordinatedSurface> > SurfaceMap;
     SurfaceMap m_surfaces;
 };
 
index e1458cdac6f3281e78600578a7a759df84d29df1..17e17dafc8fce0e6815c2a822bf51c1186185ac4 100644 (file)
@@ -33,10 +33,10 @@ messages -> LayerTreeCoordinatorProxy {
     CreateTileForLayer(uint32_t layerID, uint32_t tileID, WebCore::IntRect tileRect, WebKit::SurfaceUpdateInfo updateInfo)
     UpdateTileForLayer(uint32_t layerID, uint32_t tileID, WebCore::IntRect tileRect, WebKit::SurfaceUpdateInfo updateInfo)
     RemoveTileForLayer(uint32_t layerID, uint32_t tileID)
-    CreateUpdateAtlas(int atlasID, WebKit::ShareableSurface::Handle handle)
+    CreateUpdateAtlas(int atlasID, WebKit::WebCoordinatedSurface::Handle handle)
     RemoveUpdateAtlas(int atlasID)
     CreateImageBacking(uint64_t imageID)
-    UpdateImageBacking(uint64_t imageID, WebKit::ShareableSurface::Handle handle)
+    UpdateImageBacking(uint64_t imageID, WebKit::WebCoordinatedSurface::Handle handle)
     ClearImageBackingContents(uint64_t imageID)
     RemoveImageBacking(uint64_t imageID)
     DidRenderFrame(WebCore::IntSize contentsSize, WebCore::IntRect coveredRect)
index 3423606b37255cfa7ed65134f35a990287746937..6341d355bfe8717cfc016d09ae6cae19f48c94b5 100644 (file)
@@ -524,7 +524,7 @@ void LayerTreeRenderer::createImageBacking(CoordinatedImageBackingID imageID)
     m_imageBackings.add(imageID, backingStore.release());
 }
 
-void LayerTreeRenderer::updateImageBacking(CoordinatedImageBackingID imageID, PassRefPtr<ShareableSurface> surface)
+void LayerTreeRenderer::updateImageBacking(CoordinatedImageBackingID imageID, PassRefPtr<CoordinatedSurface> surface)
 {
     ASSERT(m_imageBackings.contains(imageID));
     ImageBackingMap::iterator it = m_imageBackings.find(imageID);
index a5ae87dc55e796fbb47081c15dd30eb85f56c30c..a67227409e7f00fecc0073176e1fed0d7c855fb5 100644 (file)
@@ -23,7 +23,7 @@
 #if USE(COORDINATED_GRAPHICS)
 #include "BackingStore.h"
 #include "CoordinatedLayerInfo.h"
-#include "ShareableSurface.h"
+#include "CoordinatedSurface.h"
 #include "TextureMapper.h"
 #include "TextureMapperBackingStore.h"
 #include <WebCore/GraphicsContext.h>
@@ -56,9 +56,9 @@ public:
     struct TileUpdate {
         WebCore::IntRect sourceRect;
         WebCore::IntRect tileRect;
-        RefPtr<ShareableSurface> surface;
+        RefPtr<CoordinatedSurface> surface;
         WebCore::IntPoint offset;
-        TileUpdate(const WebCore::IntRect& source, const WebCore::IntRect& tile, PassRefPtr<ShareableSurface> newSurface, const WebCore::IntPoint& newOffset)
+        TileUpdate(const WebCore::IntRect& source, const WebCore::IntRect& tile, PassRefPtr<CoordinatedSurface> newSurface, const WebCore::IntPoint& newOffset)
             : sourceRect(source)
             , tileRect(tile)
             , surface(newSurface)
@@ -105,7 +105,7 @@ public:
     void updateTile(CoordinatedLayerID, uint32_t tileID, const TileUpdate&);
     void flushLayerChanges();
     void createImageBacking(CoordinatedImageBackingID);
-    void updateImageBacking(CoordinatedImageBackingID, PassRefPtr<ShareableSurface>);
+    void updateImageBacking(CoordinatedImageBackingID, PassRefPtr<CoordinatedSurface>);
     void clearImageBackingContents(CoordinatedImageBackingID);
     void removeImageBacking(CoordinatedImageBackingID);
     void setLayerAnimations(CoordinatedLayerID, const WebCore::GraphicsLayerAnimations&);
index af079832d6cd98d929dbace2b029662240b1a377..d0e9c6d32b671d7a15d448b700e1647a38ae3fec 100644 (file)
@@ -740,7 +740,7 @@ PassOwnPtr<GraphicsContext> CoordinatedGraphicsLayer::beginContentUpdate(const I
     if (!m_coordinator)
         return PassOwnPtr<WebCore::GraphicsContext>();
 
-    return m_coordinator->beginContentUpdate(size, contentsOpaque() ? 0 : ShareableBitmap::SupportsAlpha, atlas, offset);
+    return m_coordinator->beginContentUpdate(size, contentsOpaque() ? CoordinatedSurface::NoFlags : CoordinatedSurface::SupportsAlpha, atlas, offset);
 }
 
 void CoordinatedGraphicsLayer::createTile(uint32_t tileID, const SurfaceUpdateInfo& updateInfo, const WebCore::IntRect& tileRect)
index d9fbe7ec4a1a7873516d957815696ae830399893..473bae30616d3f37bf7c31519b4265496579f4e1 100644 (file)
@@ -30,7 +30,6 @@
 #include "GraphicsLayerTransform.h"
 #include "Image.h"
 #include "IntSize.h"
-#include "ShareableBitmap.h"
 #include "TiledBackingStore.h"
 #include "TiledBackingStoreClient.h"
 #include "TransformationMatrix.h"
@@ -75,7 +74,7 @@ public:
 
     virtual void detachLayer(WebCore::CoordinatedGraphicsLayer*) = 0;
     virtual void syncFixedLayers() = 0;
-    virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, ShareableBitmap::Flags, int& atlasID, WebCore::IntPoint&) = 0;
+    virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, CoordinatedSurface::Flags, int& atlasID, WebCore::IntPoint&) = 0;
 };
 }
 
index 55ca9da7b594cb698f78a6c90ab14194f9a1b1b1..14681158b08a71d81b7f5a6ee132841b4ab9da33 100644 (file)
@@ -103,10 +103,10 @@ void CoordinatedImageBacking::update()
         }
     }
 
-    m_surface = ShareableSurface::create(m_image->size(), m_image->currentFrameHasAlpha() ? ShareableBitmap::SupportsAlpha : ShareableBitmap::NoFlags, ShareableSurface::SupportsGraphicsSurface);
-    m_handle = adoptPtr(new ShareableSurface::Handle());
+    m_surface = CoordinatedSurface::create(m_image->size(), m_image->currentFrameHasAlpha() ? CoordinatedSurface::SupportsAlpha : CoordinatedSurface::NoFlags);
+    m_handle = adoptPtr(new WebCoordinatedSurface::Handle());
 
-    if (!m_surface->createHandle(*m_handle)) {
+    if (!static_cast<WebCoordinatedSurface*>(m_surface.get())->createHandle(*m_handle)) {
         releaseSurfaceIfNeeded();
         m_isDirty = false;
         return;
index 65e824672b939f8ac85cf0ae465db82c3739069a..edc6e442b1b67c1b6776e55e8f0260859886bdf2 100644 (file)
@@ -29,8 +29,9 @@
 
 #if USE(COORDINATED_GRAPHICS)
 #include "CoordinatedLayerInfo.h"
+#include "CoordinatedSurface.h"
 #include "Image.h"
-#include "ShareableSurface.h"
+#include "WebCoordinatedSurface.h"
 #include <WebCore/Timer.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
@@ -42,7 +43,7 @@ public:
     class Coordinator {
     public:
         virtual void createImageBacking(CoordinatedImageBackingID) = 0;
-        virtual void updateImageBacking(CoordinatedImageBackingID, const ShareableSurface::Handle&) = 0;
+        virtual void updateImageBacking(CoordinatedImageBackingID, const WebCoordinatedSurface::Handle&) = 0;
         virtual void clearImageBackingContents(CoordinatedImageBackingID) = 0;
         virtual void removeImageBacking(CoordinatedImageBackingID) = 0;
     };
@@ -80,8 +81,8 @@ private:
     CoordinatedImageBackingID m_id;
     Vector<Host*> m_hosts;
 
-    RefPtr<ShareableSurface> m_surface;
-    OwnPtr<ShareableSurface::Handle> m_handle;
+    RefPtr<CoordinatedSurface> m_surface;
+    OwnPtr<WebCoordinatedSurface::Handle> m_handle;
 
     WebCore::Timer<CoordinatedImageBacking> m_clearContentsTimer;
 
index 3a2e765703ee7ec20d55be11d226eddfef69e2c2..117cdbaa65055a9c587eb9019d6fcf54c0d6f517 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2011 Apple Inc. All rights reserved.
  * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (C) 2012 Company 100, Inc.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -577,7 +578,7 @@ void LayerTreeCoordinator::createImageBacking(CoordinatedImageBackingID imageID)
     m_webPage->send(Messages::LayerTreeCoordinatorProxy::CreateImageBacking(imageID));
 }
 
-void LayerTreeCoordinator::updateImageBacking(CoordinatedImageBackingID imageID, const ShareableSurface::Handle& handle)
+void LayerTreeCoordinator::updateImageBacking(CoordinatedImageBackingID imageID, const WebCoordinatedSurface::Handle& handle)
 {
     m_shouldSyncFrame = true;
     m_webPage->send(Messages::LayerTreeCoordinatorProxy::UpdateImageBacking(imageID, handle));
@@ -665,7 +666,7 @@ void LayerTreeCoordinator::removeTile(CoordinatedLayerID layerID, uint32_t tileI
     m_webPage->send(Messages::LayerTreeCoordinatorProxy::RemoveTileForLayer(layerID, tileID));
 }
 
-void LayerTreeCoordinator::createUpdateAtlas(int atlasID, const ShareableSurface::Handle& handle)
+void LayerTreeCoordinator::createUpdateAtlas(int atlasID, const WebCoordinatedSurface::Handle& handle)
 {
     m_webPage->send(Messages::LayerTreeCoordinatorProxy::CreateUpdateAtlas(atlasID, handle));
 }
@@ -775,12 +776,12 @@ void LayerTreeCoordinator::purgeBackingStores()
     m_updateAtlases.clear();
 }
 
-PassOwnPtr<WebCore::GraphicsContext> LayerTreeCoordinator::beginContentUpdate(const WebCore::IntSize& size, ShareableBitmap::Flags flags, int& atlasID, WebCore::IntPoint& offset)
+PassOwnPtr<GraphicsContext> LayerTreeCoordinator::beginContentUpdate(const IntSize& size, CoordinatedSurface::Flags flags, int& atlasID, IntPoint& offset)
 {
-    OwnPtr<WebCore::GraphicsContext> graphicsContext;
+    OwnPtr<GraphicsContext> graphicsContext;
     for (unsigned i = 0; i < m_updateAtlases.size(); ++i) {
         UpdateAtlas* atlas = m_updateAtlases[i].get();
-        if (atlas->flags() == flags) {
+        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)
@@ -811,7 +812,7 @@ void LayerTreeCoordinator::releaseInactiveAtlasesTimerFired(Timer<LayerTreeCoord
         UpdateAtlas* atlas = m_updateAtlases[i].get();
         if (!atlas->isInUse())
             atlas->addTimeInactive(ReleaseInactiveAtlasesTimerInterval);
-        bool usableForNonCompositedContent = atlas->flags() == ShareableBitmap::NoFlags;
+        bool usableForNonCompositedContent = !atlas->supportsAlpha();
         if (atlas->isInactive()) {
             if (!foundActiveAtlasForNonCompositedContent && !atlasToKeepAnyway && usableForNonCompositedContent)
                 atlasToKeepAnyway = m_updateAtlases[i].release();
index 24783e0aaedcad08934d409861dd01c19626c8fa..70578e55c3b3c7a40a60b1db637a2afd41374bbd 100644 (file)
@@ -28,6 +28,7 @@
 #include "LayerTreeHost.h"
 #include "Timer.h"
 #include "UpdateAtlas.h"
+#include "WebCoordinatedSurface.h"
 #include <WebCore/GraphicsLayerClient.h>
 #include <WebCore/GraphicsLayerFactory.h>
 #include <wtf/OwnPtr.h>
@@ -103,10 +104,10 @@ public:
     virtual void detachLayer(WebCore::CoordinatedGraphicsLayer*);
     virtual void syncFixedLayers();
 
-    virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, ShareableBitmap::Flags, int& atlasID, WebCore::IntPoint&);
+    virtual PassOwnPtr<WebCore::GraphicsContext> beginContentUpdate(const WebCore::IntSize&, CoordinatedSurface::Flags, int& atlasID, WebCore::IntPoint&);
 
     // UpdateAtlasClient
-    virtual void createUpdateAtlas(int atlasID, const ShareableSurface::Handle&);
+    virtual void createUpdateAtlas(int atlasID, const WebCoordinatedSurface::Handle&);
     virtual void removeUpdateAtlas(int atlasID);
 
 #if ENABLE(REQUEST_ANIMATION_FRAME)
@@ -125,7 +126,7 @@ private:
 
     // CoordinatedImageBacking::Coordinator
     virtual void createImageBacking(CoordinatedImageBackingID) OVERRIDE;
-    virtual void updateImageBacking(CoordinatedImageBackingID, const ShareableSurface::Handle&) OVERRIDE;
+    virtual void updateImageBacking(CoordinatedImageBackingID, const WebCoordinatedSurface::Handle&) OVERRIDE;
     virtual void clearImageBackingContents(CoordinatedImageBackingID) OVERRIDE;
     virtual void removeImageBacking(CoordinatedImageBackingID) OVERRIDE;
 
index 9a5418f1eaaa3487b4e424b9a95620208309754e..9965318d0fa552b674eca150a188ea0817ea14bd 100644 (file)
@@ -1,5 +1,6 @@
 /*
  Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+ Copyright (C) 2012 Company 100, Inc.
 
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Library General Public
@@ -30,7 +31,7 @@ using namespace WebCore;
 
 namespace WebKit {
 
-UpdateAtlas::UpdateAtlas(UpdateAtlasClient* client, int dimension, ShareableBitmap::Flags flags)
+UpdateAtlas::UpdateAtlas(UpdateAtlasClient* client, int dimension, CoordinatedSurface::Flags flags)
     : m_client(client)
     , m_flags(flags)
     , m_inactivityInSeconds(0)
@@ -39,9 +40,9 @@ UpdateAtlas::UpdateAtlas(UpdateAtlasClient* client, int dimension, ShareableBitm
     static int nextID = 0;
     m_ID = ++nextID;
     IntSize size = nextPowerOfTwo(IntSize(dimension, dimension));
-    m_surface = ShareableSurface::create(size, flags, ShareableSurface::SupportsGraphicsSurface);
+    m_surface = CoordinatedSurface::create(size, flags);
 
-    if (!m_surface->createHandle(m_handle)) {
+    if (!static_cast<WebCoordinatedSurface*>(m_surface.get())->createHandle(m_handle)) {
         m_isVaild = false;
         return;
     }
@@ -86,7 +87,7 @@ PassOwnPtr<GraphicsContext> UpdateAtlas::beginPaintingOnAvailableBuffer(int& atl
     offset = rect.location();
     OwnPtr<GraphicsContext> graphicsContext = m_surface->createGraphicsContext(rect);
 
-    if (flags() & ShareableBitmap::SupportsAlpha) {
+    if (supportsAlpha()) {
         graphicsContext->setCompositeOperation(CompositeCopy);
         graphicsContext->fillRect(IntRect(IntPoint::zero(), size), Color::transparent, ColorSpaceDeviceRGB);
         graphicsContext->setCompositeOperation(CompositeSourceOver);
index 7cefe9c979421586273f4e0cd309a20234c71ad1..d0b779e04b9fe368feaa62c5313f2de9c8554d13 100644 (file)
@@ -1,5 +1,6 @@
 /*
  Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+ Copyright (C) 2012 Company 100, Inc.
 
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Library General Public
@@ -22,7 +23,7 @@
 
 #include "AreaAllocator.h"
 #include "IntSize.h"
-#include "ShareableSurface.h"
+#include "WebCoordinatedSurface.h"
 
 #if USE(COORDINATED_GRAPHICS)
 namespace WebCore {
@@ -34,14 +35,14 @@ namespace WebKit {
 
 class UpdateAtlasClient {
 public:
-    virtual void createUpdateAtlas(int atlasID, const ShareableSurface::Handle&) = 0;
+    virtual void createUpdateAtlas(int atlasID, const WebCoordinatedSurface::Handle&) = 0;
     virtual void removeUpdateAtlas(int atlasID) = 0;
 };
 
 class UpdateAtlas {
     WTF_MAKE_NONCOPYABLE(UpdateAtlas);
 public:
-    UpdateAtlas(UpdateAtlasClient*, int dimension, ShareableBitmap::Flags);
+    UpdateAtlas(UpdateAtlasClient*, int dimension, CoordinatedSurface::Flags);
     ~UpdateAtlas();
 
     inline WebCore::IntSize size() const { return m_surface->size(); }
@@ -49,7 +50,7 @@ public:
     // Returns a null pointer of there is no available buffer.
     PassOwnPtr<WebCore::GraphicsContext> beginPaintingOnAvailableBuffer(int& atlasID, const WebCore::IntSize&, WebCore::IntPoint& offset);
     void didSwapBuffers();
-    ShareableBitmap::Flags flags() const { return m_flags; }
+    bool supportsAlpha() const { return m_surface->supportsAlpha(); }
 
     void addTimeInactive(double seconds)
     {
@@ -70,8 +71,8 @@ private:
     UpdateAtlasClient* m_client;
     OwnPtr<GeneralAreaAllocator> m_areaAllocator;
     ShareableBitmap::Flags m_flags;
-    RefPtr<ShareableSurface> m_surface;
-    ShareableSurface::Handle m_handle;
+    RefPtr<CoordinatedSurface> m_surface;
+    WebCoordinatedSurface::Handle m_handle;
     double m_inactivityInSeconds;
     int m_ID;
     bool m_isVaild;