[CoordGraphics] Move UpdateAtlas, AreaAllocator into the platform layer
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Dec 2017 07:04:44 +0000 (07:04 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Dec 2017 07:04:44 +0000 (07:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=180641

Reviewed by Michael Catanzaro.

Source/WebCore:

Move the UpdateAtlas and AreaAllocator classes and their source files
into the platform layer. This still means using the WebCore namespace,
but apart from that these two classes have no dependency on anything in
the WebKit layer, so they can be moved from there.

No new tests -- no change in functionality.

* platform/TextureMapper.cmake:
* platform/graphics/texmap/coordinated/AreaAllocator.cpp: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.cpp.
(WebCore::AreaAllocator::AreaAllocator):
(WebCore::AreaAllocator::~AreaAllocator):
(WebCore::AreaAllocator::expand):
(WebCore::AreaAllocator::expandBy):
(WebCore::AreaAllocator::release):
(WebCore::AreaAllocator::overhead const):
(WebCore::AreaAllocator::roundAllocation const):
(WebCore::GeneralAreaAllocator::GeneralAreaAllocator):
(WebCore::GeneralAreaAllocator::~GeneralAreaAllocator):
(WebCore::GeneralAreaAllocator::freeNode):
(WebCore::GeneralAreaAllocator::expand):
(WebCore::fitsWithin):
(WebCore::GeneralAreaAllocator::allocate):
(WebCore::GeneralAreaAllocator::allocateFromNode):
(WebCore::GeneralAreaAllocator::splitNode):
(WebCore::GeneralAreaAllocator::updateLargestFree):
(WebCore::GeneralAreaAllocator::release):
(WebCore::GeneralAreaAllocator::overhead const):
* platform/graphics/texmap/coordinated/AreaAllocator.h: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.h.
(WebCore::nextPowerOfTwo):
(WebCore::AreaAllocator::size const):
(WebCore::AreaAllocator::minimumAllocation const):
(WebCore::AreaAllocator::setMinimumAllocation):
(WebCore::AreaAllocator::margin const):
(WebCore::AreaAllocator::setMargin):
* platform/graphics/texmap/coordinated/UpdateAtlas.cpp: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp.
(WebCore::UpdateAtlas::UpdateAtlas):
(WebCore::UpdateAtlas::~UpdateAtlas):
(WebCore::UpdateAtlas::buildLayoutIfNeeded):
(WebCore::UpdateAtlas::didSwapBuffers):
(WebCore::UpdateAtlas::getCoordinatedBuffer):
* platform/graphics/texmap/coordinated/UpdateAtlas.h: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h.
(WebCore::UpdateAtlas::size const):
(WebCore::UpdateAtlas::supportsAlpha const):
(WebCore::UpdateAtlas::addTimeInactive):
(WebCore::UpdateAtlas::isInactive const):
(WebCore::UpdateAtlas::isInUse const):

Source/WebKit:

Move the UpdateAtlas and AreaAllocator classes into the platform layer,
moving over build targets and adjust UpdateAtlas class references in
CompositingCoordinator.

* PlatformGTK.cmake:
* PlatformWPE.cmake:
* PlatformWin.cmake:
* WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:

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

Source/WebCore/ChangeLog
Source/WebCore/platform/TextureMapper.cmake
Source/WebCore/platform/graphics/texmap/coordinated/AreaAllocator.cpp [moved from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.cpp with 99% similarity]
Source/WebCore/platform/graphics/texmap/coordinated/AreaAllocator.h [moved from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.h with 55% similarity]
Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.cpp [moved from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp with 91% similarity]
Source/WebCore/platform/graphics/texmap/coordinated/UpdateAtlas.h [moved from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h with 85% similarity]
Source/WebKit/ChangeLog
Source/WebKit/PlatformGTK.cmake
Source/WebKit/PlatformWPE.cmake
Source/WebKit/PlatformWin.cmake
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h

index eb7ed5a..5d5c95c 100644 (file)
@@ -1,3 +1,57 @@
+2017-12-11  Zan Dobersek  <zdobersek@igalia.com>
+
+        [CoordGraphics] Move UpdateAtlas, AreaAllocator into the platform layer
+        https://bugs.webkit.org/show_bug.cgi?id=180641
+
+        Reviewed by Michael Catanzaro.
+
+        Move the UpdateAtlas and AreaAllocator classes and their source files
+        into the platform layer. This still means using the WebCore namespace,
+        but apart from that these two classes have no dependency on anything in
+        the WebKit layer, so they can be moved from there.
+
+        No new tests -- no change in functionality.
+
+        * platform/TextureMapper.cmake:
+        * platform/graphics/texmap/coordinated/AreaAllocator.cpp: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.cpp.
+        (WebCore::AreaAllocator::AreaAllocator):
+        (WebCore::AreaAllocator::~AreaAllocator):
+        (WebCore::AreaAllocator::expand):
+        (WebCore::AreaAllocator::expandBy):
+        (WebCore::AreaAllocator::release):
+        (WebCore::AreaAllocator::overhead const):
+        (WebCore::AreaAllocator::roundAllocation const):
+        (WebCore::GeneralAreaAllocator::GeneralAreaAllocator):
+        (WebCore::GeneralAreaAllocator::~GeneralAreaAllocator):
+        (WebCore::GeneralAreaAllocator::freeNode):
+        (WebCore::GeneralAreaAllocator::expand):
+        (WebCore::fitsWithin):
+        (WebCore::GeneralAreaAllocator::allocate):
+        (WebCore::GeneralAreaAllocator::allocateFromNode):
+        (WebCore::GeneralAreaAllocator::splitNode):
+        (WebCore::GeneralAreaAllocator::updateLargestFree):
+        (WebCore::GeneralAreaAllocator::release):
+        (WebCore::GeneralAreaAllocator::overhead const):
+        * platform/graphics/texmap/coordinated/AreaAllocator.h: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.h.
+        (WebCore::nextPowerOfTwo):
+        (WebCore::AreaAllocator::size const):
+        (WebCore::AreaAllocator::minimumAllocation const):
+        (WebCore::AreaAllocator::setMinimumAllocation):
+        (WebCore::AreaAllocator::margin const):
+        (WebCore::AreaAllocator::setMargin):
+        * platform/graphics/texmap/coordinated/UpdateAtlas.cpp: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp.
+        (WebCore::UpdateAtlas::UpdateAtlas):
+        (WebCore::UpdateAtlas::~UpdateAtlas):
+        (WebCore::UpdateAtlas::buildLayoutIfNeeded):
+        (WebCore::UpdateAtlas::didSwapBuffers):
+        (WebCore::UpdateAtlas::getCoordinatedBuffer):
+        * platform/graphics/texmap/coordinated/UpdateAtlas.h: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h.
+        (WebCore::UpdateAtlas::size const):
+        (WebCore::UpdateAtlas::supportsAlpha const):
+        (WebCore::UpdateAtlas::addTimeInactive):
+        (WebCore::UpdateAtlas::isInactive const):
+        (WebCore::UpdateAtlas::isInUse const):
+
 2017-12-11  Ryosuke Niwa  <rniwa@webkit.org>
 
         Disable NoEventDispatchAssertion release assertion in WebKit1
index 0d6ed19..5f6b7f3 100644 (file)
@@ -35,10 +35,12 @@ if (USE_COORDINATED_GRAPHICS)
         platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp
         platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp
 
+        platform/graphics/texmap/coordinated/AreaAllocator.cpp
         platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
         platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp
         platform/graphics/texmap/coordinated/Tile.cpp
         platform/graphics/texmap/coordinated/TiledBackingStore.cpp
+        platform/graphics/texmap/coordinated/UpdateAtlas.cpp
     )
 
     # FIXME: Move this into Nicosia.cmake once the component is set for long-term use.
@@ -22,9 +22,7 @@
 
 #if USE(COORDINATED_GRAPHICS)
 
-using namespace WebCore;
-
-namespace WebKit {
+namespace WebCore {
 
 AreaAllocator::AreaAllocator(const IntSize& size)
     : m_size(size)
  *
  */
 
-#ifndef AreaAllocator_h
-#define AreaAllocator_h
+#pragma once
 
 #if USE(COORDINATED_GRAPHICS)
 
-#include <WebCore/IntPoint.h>
-#include <WebCore/IntRect.h>
-#include <WebCore/IntSize.h>
+#include "IntPoint.h"
+#include "IntRect.h"
+#include "IntSize.h"
 
-namespace WebKit {
+namespace WebCore {
 
 inline int nextPowerOfTwo(int number)
 {
@@ -41,50 +40,50 @@ inline int nextPowerOfTwo(int number)
     return number;
 }
 
-inline WebCore::IntSize nextPowerOfTwo(const WebCore::IntSize& size)
+inline IntSize nextPowerOfTwo(const IntSize& size)
 {
-    return WebCore::IntSize(nextPowerOfTwo(size.width()), nextPowerOfTwo(size.height()));
+    return IntSize(nextPowerOfTwo(size.width()), nextPowerOfTwo(size.height()));
 }
 
 class AreaAllocator {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    explicit AreaAllocator(const WebCore::IntSize&);
+    explicit AreaAllocator(const IntSize&);
     virtual ~AreaAllocator();
 
-    WebCore::IntSize size() const { return m_size; }
+    IntSize size() const { return m_size; }
 
-    WebCore::IntSize minimumAllocation() const { return m_minAlloc; }
-    void setMinimumAllocation(const WebCore::IntSize& size) { m_minAlloc = size; }
+    IntSize minimumAllocation() const { return m_minAlloc; }
+    void setMinimumAllocation(const IntSize& size) { m_minAlloc = size; }
 
-    WebCore::IntSize margin() const { return m_margin; }
-    void setMargin(const WebCore::IntSize &margin) { m_margin = margin; }
+    IntSize margin() const { return m_margin; }
+    void setMargin(const IntSize &margin) { m_margin = margin; }
 
-    virtual void expand(const WebCore::IntSize&);
-    void expandBy(const WebCore::IntSize&);
+    virtual void expand(const IntSize&);
+    void expandBy(const IntSize&);
 
-    virtual WebCore::IntRect allocate(const WebCore::IntSize&) = 0;
-    virtual void release(const WebCore::IntRect&);
+    virtual IntRect allocate(const IntSize&) = 0;
+    virtual void release(const IntRect&);
 
     virtual int overhead() const;
 
 protected:
-    WebCore::IntSize m_size;
-    WebCore::IntSize m_minAlloc;
-    WebCore::IntSize m_margin;
+    IntSize m_size;
+    IntSize m_minAlloc;
+    IntSize m_margin;
 
-    WebCore::IntSize roundAllocation(const WebCore::IntSize&) const;
+    IntSize roundAllocation(const IntSize&) const;
 };
 
 class GeneralAreaAllocator final : public AreaAllocator {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    explicit GeneralAreaAllocator(const WebCore::IntSize&);
+    explicit GeneralAreaAllocator(const IntSize&);
     virtual ~GeneralAreaAllocator();
 
-    void expand(const WebCore::IntSize&) override;
-    WebCore::IntRect allocate(const WebCore::IntSize&) override;
-    void release(const WebCore::IntRect&) override;
+    void expand(const IntSize&) override;
+    IntRect allocate(const IntSize&) override;
+    void release(const IntRect&) override;
     int overhead() const override;
 
 private:
@@ -93,8 +92,8 @@ private:
     struct Node {
         WTF_MAKE_FAST_ALLOCATED;
     public:
-        WebCore::IntRect rect;
-        WebCore::IntSize largestFree;
+        IntRect rect;
+        IntSize largestFree;
         Node* parent { nullptr };
         Node* left { nullptr };
         Node* right { nullptr };
@@ -104,12 +103,11 @@ private:
     int m_nodeCount;
 
     static void freeNode(Node*);
-    WebCore::IntPoint allocateFromNode(const WebCore::IntSize&, Node*);
+    IntPoint allocateFromNode(const IntSize&, Node*);
     Node* splitNode(Node*, Split);
     static void updateLargestFree(Node*);
 };
 
-} // namespace WebKit
+} // namespace WebCore
 
 #endif // USE(COORDINATED_GRAPHICS)
-#endif // AreaAllocator_h
 
 #if USE(COORDINATED_GRAPHICS)
 
-#include <WebCore/CoordinatedGraphicsState.h>
-#include <WebCore/GraphicsContext.h>
-#include <WebCore/IntRect.h>
+#include "CoordinatedGraphicsState.h"
+#include "IntRect.h"
 
-using namespace WebCore;
-
-namespace WebKit {
+namespace WebCore {
 
 UpdateAtlas::UpdateAtlas(Client& client, const IntSize& size, Nicosia::Buffer::Flags flags)
     : m_client(client)
@@ -72,6 +69,6 @@ RefPtr<Nicosia::Buffer> UpdateAtlas::getCoordinatedBuffer(const IntSize& size, u
     return m_buffer.copyRef();
 }
 
-} // namespace WebKit
+} // namespace WebCore
 
 #endif // USE(COORDINATED_GRAPHICS)
 #pragma once
 
 #include "AreaAllocator.h"
-#include <WebCore/NicosiaBuffer.h>
+#include "NicosiaBuffer.h"
 #include <wtf/RefPtr.h>
 
 #if USE(COORDINATED_GRAPHICS)
 
 namespace WebCore {
+
 class IntRect;
 class IntSize;
-}
-
-namespace WebKit {
 
 class UpdateAtlas {
     WTF_MAKE_FAST_ALLOCATED;
@@ -45,12 +43,12 @@ public:
         virtual void removeUpdateAtlas(ID) = 0;
     };
 
-    UpdateAtlas(Client&, const WebCore::IntSize&, Nicosia::Buffer::Flags);
+    UpdateAtlas(Client&, const IntSize&, Nicosia::Buffer::Flags);
     ~UpdateAtlas();
 
-    const WebCore::IntSize& size() const { return m_buffer->size(); }
+    const IntSize& size() const { return m_buffer->size(); }
 
-    RefPtr<Nicosia::Buffer> getCoordinatedBuffer(const WebCore::IntSize&, uint32_t&, WebCore::IntRect&);
+    RefPtr<Nicosia::Buffer> getCoordinatedBuffer(const IntSize&, uint32_t&, IntRect&);
     void didSwapBuffers();
     bool supportsAlpha() const { return m_buffer->supportsAlpha(); }
 
@@ -76,6 +74,6 @@ private:
     double m_inactivityInSeconds { 0 };
 };
 
-} // namespace WebKit
+} // namespace WebCore
 
 #endif // USE(COORDINATED_GRAPHICS)
index 026a836..a2e9804 100644 (file)
@@ -1,3 +1,19 @@
+2017-12-11  Zan Dobersek  <zdobersek@igalia.com>
+
+        [CoordGraphics] Move UpdateAtlas, AreaAllocator into the platform layer
+        https://bugs.webkit.org/show_bug.cgi?id=180641
+
+        Reviewed by Michael Catanzaro.
+
+        Move the UpdateAtlas and AreaAllocator classes into the platform layer,
+        moving over build targets and adjust UpdateAtlas class references in
+        CompositingCoordinator.
+
+        * PlatformGTK.cmake:
+        * PlatformWPE.cmake:
+        * PlatformWin.cmake:
+        * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
+
 2017-12-11  Alex Christensen  <achristensen@webkit.org>
 
         Add a WKPageGroupRef setter in WKWebViewConfiguration
index ca18e15..2a55e4c 100644 (file)
@@ -386,11 +386,9 @@ list(APPEND WebKit_SOURCES
     WebProcess/WebPage/AcceleratedDrawingArea.cpp
     WebProcess/WebPage/AcceleratedSurface.cpp
 
-    WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.cpp
     WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp
     WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp
     WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp
-    WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp
 
     WebProcess/WebPage/DrawingAreaImpl.cpp
 
index 2e093cf..6ba23f7 100644 (file)
@@ -260,11 +260,9 @@ list(APPEND WebKit_SOURCES
     WebProcess/WebPage/AcceleratedDrawingArea.cpp
     WebProcess/WebPage/AcceleratedSurface.cpp
 
-    WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.cpp
     WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp
     WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp
     WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp
-    WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp
 
     WebProcess/WebPage/gstreamer/WebPageGStreamer.cpp
 
index 4874cb0..2119200 100644 (file)
@@ -46,11 +46,9 @@ list(APPEND WebKit_SOURCES
     WebProcess/WebPage/AcceleratedSurface.cpp
     WebProcess/WebPage/DrawingAreaImpl.cpp
 
-    WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.cpp
     WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp
     WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp
     WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp
-    WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp
 
     WebProcess/WebPage/win/WebInspectorUIWin.cpp
     WebProcess/WebPage/win/WebPageWin.cpp
index 77f1728..f6cd841 100644 (file)
@@ -29,7 +29,6 @@
 
 #if USE(COORDINATED_GRAPHICS)
 
-#include "UpdateAtlas.h"
 #include <WebCore/CoordinatedGraphicsLayer.h>
 #include <WebCore/CoordinatedGraphicsState.h>
 #include <WebCore/CoordinatedImageBacking.h>
@@ -38,6 +37,7 @@
 #include <WebCore/GraphicsLayerFactory.h>
 #include <WebCore/IntRect.h>
 #include <WebCore/NicosiaBuffer.h>
+#include <WebCore/UpdateAtlas.h>
 
 namespace Nicosia {
 class PaintingEngine;
@@ -54,7 +54,7 @@ namespace WebKit {
 class CompositingCoordinator final : public WebCore::GraphicsLayerClient
     , public WebCore::CoordinatedGraphicsLayerClient
     , public WebCore::CoordinatedImageBacking::Client
-    , public UpdateAtlas::Client
+    , public WebCore::UpdateAtlas::Client
     , public WebCore::GraphicsLayerFactory {
     WTF_MAKE_NONCOPYABLE(CompositingCoordinator);
 public:
@@ -122,8 +122,8 @@ private:
     void syncLayerState(WebCore::CoordinatedLayerID, WebCore::CoordinatedGraphicsLayerState&) override;
 
     // UpdateAtlas::Client
-    void createUpdateAtlas(UpdateAtlas::ID, Ref<Nicosia::Buffer>&&) override;
-    void removeUpdateAtlas(UpdateAtlas::ID) override;
+    void createUpdateAtlas(WebCore::UpdateAtlas::ID, Ref<Nicosia::Buffer>&&) override;
+    void removeUpdateAtlas(WebCore::UpdateAtlas::ID) override;
 
     // GraphicsLayerFactory
     std::unique_ptr<WebCore::GraphicsLayer> createGraphicsLayer(WebCore::GraphicsLayer::Type, WebCore::GraphicsLayerClient&) override;
@@ -153,7 +153,7 @@ private:
     HashMap<WebCore::CoordinatedImageBackingID, RefPtr<WebCore::CoordinatedImageBacking>> m_imageBackings;
 
     std::unique_ptr<Nicosia::PaintingEngine> m_paintingEngine;
-    Vector<std::unique_ptr<UpdateAtlas>> m_updateAtlases;
+    Vector<std::unique_ptr<WebCore::UpdateAtlas>> m_updateAtlases;
     Vector<uint32_t> m_atlasesToRemove;
 
     // We don't send the messages related to releasing resources to renderer during purging, because renderer already had removed all resources.