[WTF] Rename String::format to String::deprecatedFormat
[WebKit-https.git] / Source / WebKit / UIProcess / gtk / WaylandCompositor.h
index e5aba03..6e51311 100644 (file)
@@ -30,6 +30,8 @@
 #include "WebPageProxy.h"
 #include <WebCore/RefPtrCairo.h>
 #include <WebCore/WlUniquePtr.h>
+#include <gtk/gtk.h>
+#include <wayland-server.h>
 #include <wtf/HashMap.h>
 #include <wtf/NeverDestroyed.h>
 #include <wtf/Noncopyable.h>
@@ -49,11 +51,11 @@ class WebPageProxy;
 
 class WaylandCompositor {
     WTF_MAKE_NONCOPYABLE(WaylandCompositor);
-    friend class NeverDestroyed<WaylandCompositor>;
+    friend NeverDestroyed<WaylandCompositor>;
 public:
     static WaylandCompositor& singleton();
 
-    class Buffer {
+    class Buffer : public CanMakeWeakPtr<Buffer> {
         WTF_MAKE_NONCOPYABLE(Buffer); WTF_MAKE_FAST_ALLOCATED;
     public:
         static Buffer* getOrCreate(struct wl_resource*);
@@ -65,8 +67,6 @@ public:
         EGLImageKHR createImage() const;
         WebCore::IntSize size() const;
 
-        WeakPtr<Buffer> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(*this); }
-
     private:
         Buffer(struct wl_resource*);
         static void destroyListenerCallback(struct wl_listener*, void*);
@@ -74,7 +74,6 @@ public:
         struct wl_resource* m_resource { nullptr };
         struct wl_listener m_destroyListener;
         uint32_t m_busyCount { 0 };
-        WeakPtrFactory<Buffer> m_weakPtrFactory;
     };
 
     class Surface {
@@ -112,6 +111,7 @@ public:
     void bindSurfaceToWebPage(Surface*, uint64_t pageID);
     void registerWebPage(WebPageProxy&);
     void unregisterWebPage(WebPageProxy&);
+    void willDestroySurface(Surface*);
 
     bool getTexture(WebPageProxy&, unsigned&, WebCore::IntSize&);
 
@@ -121,7 +121,12 @@ private:
     bool initializeEGL();
 
     String m_displayName;
-    WebCore::WlUniquePtr<struct wl_display> m_display;
+
+    struct DisplayDeleter {
+        void operator() (struct wl_display* display) { wl_display_destroy(display); }
+    };
+    std::unique_ptr<struct wl_display, DisplayDeleter> m_display;
+
     WebCore::WlUniquePtr<struct wl_global> m_compositorGlobal;
     WebCore::WlUniquePtr<struct wl_global> m_webkitgtkGlobal;
     GRefPtr<GSource> m_eventSource;