Title: [225176] trunk/Source/WebKit
Revision
225176
Author
[email protected]
Date
2017-11-27 09:08:48 -0800 (Mon, 27 Nov 2017)

Log Message

[CoordGraphics] Prettify ID value handling in UpdateAtlas and UpdateAtlas::Client
https://bugs.webkit.org/show_bug.cgi?id=180038

Reviewed by Carlos Garcia Campos.

In the UpdateAtlas class, provide an ID type that aliases to uint32_t.
The m_id member variable (ex-m_ID) uses this type, and it's also now
used in the Client interface.

While poking around, the header is modified to use '#pragma once',
and m_id is moved to the more logical first position among member
variables.

The static ID variable is modified to use the new type, and renamed
to s_nextID. Comment alongside the namespace scope closure is fixed
to use the appropriate name.

createUpdateAtlas() and removeUpdateAtlas() methods in the
CompositingCoordinator class are modified to use the UpdateAtlas::ID
type, and the former has the second parameter changed from RefPtr<>
to Ref<>.

* WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
(WebKit::CompositingCoordinator::createUpdateAtlas):
(WebKit::CompositingCoordinator::removeUpdateAtlas):
* WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
* WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp:
(WebKit::UpdateAtlas::UpdateAtlas):
(WebKit::UpdateAtlas::~UpdateAtlas):
(WebKit::UpdateAtlas::getCoordinatedBuffer):
* WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (225175 => 225176)


--- trunk/Source/WebKit/ChangeLog	2017-11-27 17:06:23 UTC (rev 225175)
+++ trunk/Source/WebKit/ChangeLog	2017-11-27 17:08:48 UTC (rev 225176)
@@ -1,5 +1,39 @@
 2017-11-27  Zan Dobersek  <[email protected]>
 
+        [CoordGraphics] Prettify ID value handling in UpdateAtlas and UpdateAtlas::Client
+        https://bugs.webkit.org/show_bug.cgi?id=180038
+
+        Reviewed by Carlos Garcia Campos.
+
+        In the UpdateAtlas class, provide an ID type that aliases to uint32_t.
+        The m_id member variable (ex-m_ID) uses this type, and it's also now
+        used in the Client interface.
+
+        While poking around, the header is modified to use '#pragma once',
+        and m_id is moved to the more logical first position among member
+        variables.
+
+        The static ID variable is modified to use the new type, and renamed
+        to s_nextID. Comment alongside the namespace scope closure is fixed
+        to use the appropriate name.
+
+        createUpdateAtlas() and removeUpdateAtlas() methods in the
+        CompositingCoordinator class are modified to use the UpdateAtlas::ID
+        type, and the former has the second parameter changed from RefPtr<>
+        to Ref<>.
+
+        * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
+        (WebKit::CompositingCoordinator::createUpdateAtlas):
+        (WebKit::CompositingCoordinator::removeUpdateAtlas):
+        * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
+        * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp:
+        (WebKit::UpdateAtlas::UpdateAtlas):
+        (WebKit::UpdateAtlas::~UpdateAtlas):
+        (WebKit::UpdateAtlas::getCoordinatedBuffer):
+        * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h:
+
+2017-11-27  Zan Dobersek  <[email protected]>
+
         [CoordGraphics] CompositingCoordinator: clean up Client vtable, GraphicsLayerClient overrides
         https://bugs.webkit.org/show_bug.cgi?id=180037
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp (225175 => 225176)


--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp	2017-11-27 17:06:23 UTC (rev 225175)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp	2017-11-27 17:08:48 UTC (rev 225176)
@@ -284,16 +284,16 @@
     return std::unique_ptr<GraphicsLayer>(layer);
 }
 
-void CompositingCoordinator::createUpdateAtlas(uint32_t atlasID, RefPtr<CoordinatedBuffer>&& buffer)
+void CompositingCoordinator::createUpdateAtlas(UpdateAtlas::ID id, Ref<CoordinatedBuffer>&& buffer)
 {
-    m_state.updateAtlasesToCreate.append(std::make_pair(atlasID, WTFMove(buffer)));
+    m_state.updateAtlasesToCreate.append(std::make_pair(id, WTFMove(buffer)));
 }
 
-void CompositingCoordinator::removeUpdateAtlas(uint32_t atlasID)
+void CompositingCoordinator::removeUpdateAtlas(UpdateAtlas::ID id)
 {
     if (m_isPurging)
         return;
-    m_atlasesToRemove.append(atlasID);
+    m_atlasesToRemove.append(id);
 }
 
 FloatRect CompositingCoordinator::visibleContentsRect() const

Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h (225175 => 225176)


--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h	2017-11-27 17:06:23 UTC (rev 225175)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h	2017-11-27 17:08:48 UTC (rev 225176)
@@ -118,8 +118,8 @@
     void syncLayerState(WebCore::CoordinatedLayerID, WebCore::CoordinatedGraphicsLayerState&) override;
 
     // UpdateAtlas::Client
-    void createUpdateAtlas(uint32_t atlasID, RefPtr<WebCore::CoordinatedBuffer>&&) override;
-    void removeUpdateAtlas(uint32_t atlasID) override;
+    void createUpdateAtlas(UpdateAtlas::ID, Ref<WebCore::CoordinatedBuffer>&&) override;
+    void removeUpdateAtlas(UpdateAtlas::ID) override;
 
     // GraphicsLayerFactory
     std::unique_ptr<WebCore::GraphicsLayer> createGraphicsLayer(WebCore::GraphicsLayer::Type, WebCore::GraphicsLayerClient&) override;

Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp (225175 => 225176)


--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp	2017-11-27 17:06:23 UTC (rev 225175)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp	2017-11-27 17:08:48 UTC (rev 225176)
@@ -35,15 +35,15 @@
     : m_client(client)
     , m_buffer(CoordinatedBuffer::create(size, flags))
 {
-    static uint32_t nextID = 0;
-    m_ID = ++nextID;
+    static ID s_nextID { 0 };
+    m_id = ++s_nextID;
 
-    m_client.createUpdateAtlas(m_ID, m_buffer.copyRef());
+    m_client.createUpdateAtlas(m_id, m_buffer.copyRef());
 }
 
 UpdateAtlas::~UpdateAtlas()
 {
-    m_client.removeUpdateAtlas(m_ID);
+    m_client.removeUpdateAtlas(m_id);
 }
 
 void UpdateAtlas::buildLayoutIfNeeded()
@@ -68,9 +68,10 @@
     if (allocatedRect.isEmpty())
         return nullptr;
 
-    atlasID = m_ID;
+    atlasID = m_id;
     return m_buffer.copyRef();
 }
 
-} // namespace WebCore
+} // namespace WebKit
+
 #endif // USE(COORDINATED_GRAPHICS)

Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h (225175 => 225176)


--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h	2017-11-27 17:06:23 UTC (rev 225175)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h	2017-11-27 17:08:48 UTC (rev 225176)
@@ -18,8 +18,7 @@
  Boston, MA 02110-1301, USA.
  */
 
-#ifndef UpdateAtlas_h
-#define UpdateAtlas_h
+#pragma once
 
 #include "AreaAllocator.h"
 #include <WebCore/CoordinatedBuffer.h>
@@ -35,12 +34,15 @@
 namespace WebKit {
 
 class UpdateAtlas {
+    WTF_MAKE_FAST_ALLOCATED;
     WTF_MAKE_NONCOPYABLE(UpdateAtlas);
 public:
+    using ID = uint32_t;
+
     class Client {
     public:
-        virtual void createUpdateAtlas(uint32_t /* id */, RefPtr<WebCore::CoordinatedBuffer>&&) = 0;
-        virtual void removeUpdateAtlas(uint32_t /* id */) = 0;
+        virtual void createUpdateAtlas(ID, Ref<WebCore::CoordinatedBuffer>&&) = 0;
+        virtual void removeUpdateAtlas(ID) = 0;
     };
 
     UpdateAtlas(Client&, const WebCore::IntSize&, WebCore::CoordinatedBuffer::Flags);
@@ -67,15 +69,13 @@
 private:
     void buildLayoutIfNeeded();
 
-private:
+    ID m_id { 0 };
     Client& m_client;
     std::unique_ptr<GeneralAreaAllocator> m_areaAllocator;
     Ref<WebCore::CoordinatedBuffer> m_buffer;
     double m_inactivityInSeconds { 0 };
-    uint32_t m_ID { 0 };
 };
 
 } // namespace WebKit
 
 #endif // USE(COORDINATED_GRAPHICS)
-#endif // UpdateAtlas_h
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to