1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:07:36 +00:00

DevTools: Remove redundant default destructor and forward declarations

Problem:
- Default destructors (and constructors) are in `.cpp` files. This
  prevents the compiler's optimizer from inlining them when it thinks
  inlining is appropriate (unless LTO is used).
- Forward declarations can prevent some optimizations, such as
  inlining of constructors and destructors.

Solution:
- Remove them or set them to `= default` and let the compiler handle
  the generation of them.
- Remove unneeded forward declarations.
This commit is contained in:
Lenny Maiorani 2021-05-21 13:15:07 -06:00 committed by Linus Groh
parent 4d34802f74
commit 6ac454e70a
9 changed files with 43 additions and 53 deletions

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <InspectorServer/InspectorClientEndpoint.h>
#include <InspectorServer/InspectorServerEndpoint.h>
#include <LibIPC/ServerConnection.h>
namespace Inspector {
class InspectorServerClient final
: public IPC::ServerConnection<InspectorClientEndpoint, InspectorServerEndpoint>
, public InspectorClientEndpoint {
C_OBJECT(InspectorServerClient);
public:
virtual void handshake() override
{
greet();
}
virtual ~InspectorServerClient() override = default;
private:
InspectorServerClient()
: IPC::ServerConnection<InspectorClientEndpoint, InspectorServerEndpoint>(*this, "/tmp/portal/inspector")
{
handshake();
}
virtual void dummy() override { }
};
}

View file

@ -8,37 +8,11 @@
#include "RemoteObject.h"
#include "RemoteObjectGraphModel.h"
#include "RemoteObjectPropertyModel.h"
#include <InspectorServer/InspectorClientEndpoint.h>
#include <InspectorServer/InspectorServerEndpoint.h>
#include <LibIPC/ServerConnection.h>
#include <stdio.h>
#include <stdlib.h>
namespace Inspector {
class InspectorServerClient final
: public IPC::ServerConnection<InspectorClientEndpoint, InspectorServerEndpoint>
, public InspectorClientEndpoint {
C_OBJECT(InspectorServerClient);
public:
virtual void handshake() override
{
greet();
}
virtual ~InspectorServerClient() override { }
private:
InspectorServerClient()
: IPC::ServerConnection<InspectorClientEndpoint, InspectorServerEndpoint>(*this, "/tmp/portal/inspector")
{
handshake();
}
virtual void dummy() override { }
};
RemoteProcess* s_the;
RemoteProcess& RemoteProcess::the()
@ -54,10 +28,6 @@ RemoteProcess::RemoteProcess(pid_t pid)
m_client = InspectorServerClient::construct();
}
RemoteProcess::~RemoteProcess()
{
}
void RemoteProcess::handle_identify_response(const JsonObject& response)
{
int pid = response.get("pid").to_int();

View file

@ -6,12 +6,12 @@
#pragma once
#include "InspectorServerClient.h"
#include <AK/NonnullOwnPtrVector.h>
#include <LibCore/LocalSocket.h>
namespace Inspector {
class InspectorServerClient;
class RemoteObjectGraphModel;
class RemoteObject;
@ -20,7 +20,6 @@ public:
static RemoteProcess& the();
explicit RemoteProcess(pid_t);
~RemoteProcess();
void update();
pid_t pid() const { return m_pid; }