mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:14:58 +00:00
Services: Fix visibility of Object-derivative constructors
Derivatives of Core::Object should be constructed through ClassName::construct(), to avoid handling ref-counted objects with refcount zero. Fixing the visibility means that misuses like this are more difficult.
This commit is contained in:
parent
b3e9a4e603
commit
4e55d649d7
19 changed files with 45 additions and 26 deletions
|
@ -14,16 +14,16 @@ class ChessEngine : public Chess::UCI::Endpoint {
|
|||
public:
|
||||
virtual ~ChessEngine() override { }
|
||||
|
||||
virtual void handle_uci() override;
|
||||
virtual void handle_position(const Chess::UCI::PositionCommand&) override;
|
||||
virtual void handle_go(const Chess::UCI::GoCommand&) override;
|
||||
|
||||
private:
|
||||
ChessEngine() { }
|
||||
ChessEngine(NonnullRefPtr<Core::IODevice> in, NonnullRefPtr<Core::IODevice> out)
|
||||
: Endpoint(in, out)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void handle_uci() override;
|
||||
virtual void handle_position(const Chess::UCI::PositionCommand&) override;
|
||||
virtual void handle_go(const Chess::UCI::GoCommand&) override;
|
||||
|
||||
private:
|
||||
Chess::Board m_board;
|
||||
};
|
||||
|
|
|
@ -18,7 +18,6 @@ class ClientConnection final
|
|||
C_OBJECT(ClientConnection);
|
||||
|
||||
public:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
virtual ~ClientConnection() override;
|
||||
|
||||
virtual void die() override;
|
||||
|
@ -28,6 +27,8 @@ public:
|
|||
void notify_about_clipboard_change();
|
||||
|
||||
private:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
|
||||
virtual Messages::ClipboardServer::GetClipboardDataResponse get_clipboard_data() override;
|
||||
virtual void set_clipboard_data(Core::AnonymousBuffer const&, String const&, IPC::Dictionary const&) override;
|
||||
};
|
||||
|
|
|
@ -40,7 +40,6 @@ class DHCPv4Client final : public Core::Object {
|
|||
C_OBJECT(DHCPv4Client)
|
||||
|
||||
public:
|
||||
explicit DHCPv4Client();
|
||||
virtual ~DHCPv4Client() override;
|
||||
|
||||
void dhcp_discover(const InterfaceDescriptor& ifname);
|
||||
|
@ -57,6 +56,8 @@ public:
|
|||
static Result<Interfaces, String> get_discoverable_interfaces();
|
||||
|
||||
private:
|
||||
explicit DHCPv4Client();
|
||||
|
||||
void try_discover_ifs();
|
||||
|
||||
HashMap<u32, OwnPtr<DHCPv4Transaction>> m_ongoing_transactions;
|
||||
|
|
|
@ -20,12 +20,13 @@ class ClientConnection final
|
|||
C_OBJECT(ClientConnection);
|
||||
|
||||
public:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
~ClientConnection() override;
|
||||
|
||||
virtual void die() override;
|
||||
|
||||
private:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
|
||||
virtual void request_file_read_only_approved(i32, i32, String const&) override;
|
||||
virtual void request_file(i32, i32, String const&, Core::OpenMode const&) override;
|
||||
virtual void prompt_open_file(i32, i32, String const&, String const&, Core::OpenMode const&) override;
|
||||
|
|
|
@ -20,12 +20,13 @@ class ClientConnection final
|
|||
C_OBJECT(ClientConnection);
|
||||
|
||||
public:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
~ClientConnection() override;
|
||||
|
||||
virtual void die() override;
|
||||
|
||||
private:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
|
||||
virtual Messages::ImageDecoderServer::DecodeImageResponse decode_image(Core::AnonymousBuffer const&) override;
|
||||
};
|
||||
|
||||
|
|
|
@ -18,12 +18,13 @@ class ClientConnection final
|
|||
C_OBJECT(ClientConnection);
|
||||
|
||||
public:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
~ClientConnection() override;
|
||||
|
||||
virtual void die() override;
|
||||
|
||||
private:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
|
||||
virtual Messages::InspectorServer::GetAllObjectsResponse get_all_objects(pid_t) override;
|
||||
virtual Messages::InspectorServer::SetInspectedObjectResponse set_inspected_object(pid_t, u64 object_id) override;
|
||||
virtual Messages::InspectorServer::SetObjectPropertyResponse set_object_property(pid_t, u64 object_id, String const& name, String const& value) override;
|
||||
|
|
|
@ -18,12 +18,13 @@ class ClientConnection final
|
|||
C_OBJECT(ClientConnection);
|
||||
|
||||
public:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
virtual ~ClientConnection() override;
|
||||
|
||||
virtual void die() override;
|
||||
|
||||
private:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
|
||||
virtual Messages::LookupServer::LookupNameResponse lookup_name(String const&) override;
|
||||
virtual Messages::LookupServer::LookupAddressResponse lookup_address(String const&) override;
|
||||
};
|
||||
|
|
|
@ -19,7 +19,6 @@ class ClientConnection final
|
|||
C_OBJECT(ClientConnection);
|
||||
|
||||
public:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
~ClientConnection() override;
|
||||
|
||||
virtual void die() override;
|
||||
|
@ -30,6 +29,8 @@ public:
|
|||
void did_request_certificates(Badge<Request>, Request&);
|
||||
|
||||
private:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
|
||||
virtual Messages::RequestServer::IsSupportedProtocolResponse is_supported_protocol(String const&) override;
|
||||
virtual Messages::RequestServer::StartRequestResponse start_request(String const&, URL const&, IPC::Dictionary const&, ByteBuffer const&) override;
|
||||
virtual Messages::RequestServer::StopRequestResponse stop_request(i32) override;
|
||||
|
|
|
@ -18,7 +18,6 @@ class ClientConnection final
|
|||
C_OBJECT(ClientConnection);
|
||||
|
||||
public:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
virtual ~ClientConnection() override;
|
||||
|
||||
virtual void die() override;
|
||||
|
@ -26,6 +25,8 @@ public:
|
|||
static RefPtr<ClientConnection> client_connection_for(int client_id);
|
||||
|
||||
private:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
|
||||
virtual Messages::SQLServer::ConnectResponse connect(String const&) override;
|
||||
virtual Messages::SQLServer::SqlStatementResponse sql_statement(int, String const&) override;
|
||||
virtual void statement_execute(int) override;
|
||||
|
|
|
@ -14,6 +14,8 @@ namespace SQLServer {
|
|||
|
||||
class DatabaseConnection final : public Core::Object {
|
||||
C_OBJECT(DatabaseConnection)
|
||||
|
||||
public:
|
||||
~DatabaseConnection() override = default;
|
||||
|
||||
static RefPtr<DatabaseConnection> connection_for(int connection_id);
|
||||
|
|
|
@ -18,6 +18,8 @@ namespace SQLServer {
|
|||
|
||||
class SQLStatement final : public Core::Object {
|
||||
C_OBJECT(SQLStatement)
|
||||
|
||||
public:
|
||||
~SQLStatement() override = default;
|
||||
|
||||
static RefPtr<SQLStatement> statement_for(int statement_id);
|
||||
|
|
|
@ -17,6 +17,7 @@ class ClipboardServerConnection final
|
|||
, public ClipboardClientEndpoint {
|
||||
C_OBJECT(ClipboardServerConnection);
|
||||
|
||||
public:
|
||||
Function<void()> on_data_changed;
|
||||
RefPtr<Gfx::Bitmap> get_bitmap();
|
||||
void set_bitmap(Gfx::Bitmap const& bitmap);
|
||||
|
|
|
@ -25,7 +25,6 @@ class ClientConnection final
|
|||
C_OBJECT(ClientConnection);
|
||||
|
||||
public:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
~ClientConnection() override;
|
||||
|
||||
virtual void die() override;
|
||||
|
@ -33,6 +32,8 @@ public:
|
|||
void initialize_js_console(Badge<PageHost>);
|
||||
|
||||
private:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
|
||||
Web::Page& page();
|
||||
const Web::Page& page() const;
|
||||
|
||||
|
|
|
@ -19,12 +19,13 @@ class ClientConnection final
|
|||
C_OBJECT(ClientConnection);
|
||||
|
||||
public:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
~ClientConnection() override;
|
||||
|
||||
virtual void die() override;
|
||||
|
||||
private:
|
||||
explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
|
||||
|
||||
virtual Messages::WebSocketServer::ConnectResponse connect(URL const&, String const&, Vector<String> const&, Vector<String> const&, IPC::Dictionary const&) override;
|
||||
virtual Messages::WebSocketServer::ReadyStateResponse ready_state(i32) override;
|
||||
virtual void send(i32, bool, ByteBuffer const&) override;
|
||||
|
|
|
@ -14,7 +14,6 @@ namespace WindowServer {
|
|||
class AppletManager : public Core::Object {
|
||||
C_OBJECT(AppletManager)
|
||||
public:
|
||||
AppletManager();
|
||||
~AppletManager();
|
||||
|
||||
static AppletManager& the();
|
||||
|
@ -35,6 +34,8 @@ public:
|
|||
void did_change_theme();
|
||||
|
||||
private:
|
||||
AppletManager();
|
||||
|
||||
void repaint();
|
||||
void draw_applet(const Window& applet);
|
||||
void set_hovered_applet(Window*);
|
||||
|
|
|
@ -28,7 +28,6 @@ class Menu final : public Core::Object {
|
|||
C_OBJECT(Menu);
|
||||
|
||||
public:
|
||||
Menu(ClientConnection*, int menu_id, String name);
|
||||
virtual ~Menu() override;
|
||||
|
||||
ClientConnection* client() { return m_client; }
|
||||
|
@ -129,6 +128,8 @@ public:
|
|||
const Vector<size_t>* items_with_alt_shortcut(u32 alt_shortcut) const;
|
||||
|
||||
private:
|
||||
Menu(ClientConnection*, int menu_id, String name);
|
||||
|
||||
virtual void event(Core::Event&) override;
|
||||
|
||||
void handle_mouse_move_event(const MouseEvent&);
|
||||
|
|
|
@ -20,7 +20,6 @@ class MenuManager final : public Core::Object {
|
|||
public:
|
||||
static MenuManager& the();
|
||||
|
||||
MenuManager();
|
||||
virtual ~MenuManager() override;
|
||||
|
||||
bool is_open(const Menu&) const;
|
||||
|
@ -48,6 +47,8 @@ public:
|
|||
Menu* hovered_menu() { return m_hovered_menu; }
|
||||
|
||||
private:
|
||||
MenuManager();
|
||||
|
||||
void close_menus(const Vector<Menu&>&);
|
||||
|
||||
virtual void event(Core::Event&) override;
|
||||
|
|
|
@ -68,7 +68,6 @@ public:
|
|||
|
||||
static WindowManager& the();
|
||||
|
||||
explicit WindowManager(Gfx::PaletteImpl const&);
|
||||
virtual ~WindowManager() override;
|
||||
|
||||
Palette palette() const { return Palette(*m_palette); }
|
||||
|
@ -322,6 +321,8 @@ public:
|
|||
void apply_cursor_theme(String const& name);
|
||||
|
||||
private:
|
||||
explicit WindowManager(Gfx::PaletteImpl const&);
|
||||
|
||||
void notify_new_active_window(Window&);
|
||||
void notify_new_active_input_window(Window&);
|
||||
void notify_previous_active_window(Window&);
|
||||
|
|
|
@ -24,13 +24,6 @@
|
|||
class SelectableLayover final : public GUI::Widget {
|
||||
C_OBJECT(SelectableLayover)
|
||||
public:
|
||||
SelectableLayover(GUI::Window* window)
|
||||
: m_window(window)
|
||||
, m_background_color(palette().threed_highlight().with_alpha(128))
|
||||
{
|
||||
set_override_cursor(Gfx::StandardCursor::Crosshair);
|
||||
}
|
||||
|
||||
virtual ~SelectableLayover() override {};
|
||||
|
||||
Gfx::IntRect region() const
|
||||
|
@ -39,6 +32,13 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
SelectableLayover(GUI::Window* window)
|
||||
: m_window(window)
|
||||
, m_background_color(palette().threed_highlight().with_alpha(128))
|
||||
{
|
||||
set_override_cursor(Gfx::StandardCursor::Crosshair);
|
||||
}
|
||||
|
||||
virtual void mousedown_event(GUI::MouseEvent& event) override
|
||||
{
|
||||
if (event.button() == GUI::MouseButton::Primary)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue