瀏覽代碼

AK+WindowServer: Remove did_construct() framework used only once

There is also make_ref_counted(), which does not call did_construct(),
so the method was not guaranteed to be run. Since there is only a single
user, and `WindowServer::Window` is a final class anyway (so there is no
need to separate the constructor and post-constructor phases), let's get
rid of this concept.

(The following commits reduce the opportunities to call
make_ref_counted, but still.)
Ben Wiederhake 3 年之前
父節點
當前提交
2e6bb987a3

+ 0 - 2
Userland/Libraries/LibCore/Object.h

@@ -70,8 +70,6 @@ public:                                                                \
     static inline NonnullRefPtr<klass> construct(Args&&... args)       \
     {                                                                  \
         auto obj = adopt_ref(*new Klass(forward<Args>(args)...));      \
-        if constexpr (requires { declval<Klass>().did_construct(); })  \
-            obj->did_construct();                                      \
         return obj;                                                    \
     }
 

+ 1 - 0
Userland/Services/WindowServer/Window.cpp

@@ -85,6 +85,7 @@ Window::Window(Core::Object& parent, WindowType type)
         m_minimum_size = s_default_normal_minimum_size;
 
     WindowManager::the().add_window(*this);
+    frame().window_was_constructed({});
 }
 
 Window::Window(ClientConnection& client, WindowType window_type, int window_id, bool modal, bool minimizable, bool closeable, bool frameless, bool resizable, bool fullscreen, bool accessory, Window* parent_window)

+ 0 - 5
Userland/Services/WindowServer/Window.h

@@ -362,11 +362,6 @@ public:
     const Vector<Screen*, default_screen_count>& screens() const { return m_screens; }
     Vector<Screen*, default_screen_count>& screens() { return m_screens; }
 
-    void did_construct()
-    {
-        frame().window_was_constructed({});
-    }
-
     void set_moving_to_another_stack(bool value) { m_moving_to_another_stack = value; }
     bool is_moving_to_another_stack() const { return m_moving_to_another_stack; }