Skip to content

Commit

Permalink
Userland: Rename IPC ClientConnection => ConnectionFromClient
Browse files Browse the repository at this point in the history
This was done with CLion's automatic rename feature and with:
find . -name ClientConnection.h
    | rename 's/ClientConnection\.h/ConnectionFromClient.h/'

find . -name ClientConnection.cpp
    | rename 's/ClientConnection\.cpp/ConnectionFromClient.cpp/'
  • Loading branch information
itamar8910 authored and awesomekling committed Feb 25, 2022
1 parent efac862 commit 3a71748
Show file tree
Hide file tree
Showing 137 changed files with 896 additions and 896 deletions.
2 changes: 1 addition & 1 deletion Documentation/Browser/ProcessArchitecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ In the GUI application process, a `OutOfProcessWebView` widget is placed somewhe

Internally, the `OutOfProcessWebView` has a `WebContentClient` object that implements the client side of the **WebContent** IPC protocol.

The `WebContentClient` speaks to a `WebContent::ClientConnection` in the **WebContent** process. Internally, the `WebContent::ClientConnection` has a `WebContent::PageHost` which hosts the **LibWeb** engine's main `Web::Page` object.
The `WebContentClient` speaks to a `WebContent::ConnectionFromClient` in the **WebContent** process. Internally, the `WebContent::ConnectionFromClient` has a `WebContent::PageHost` which hosts the **LibWeb** engine's main `Web::Page` object.

Inside **LibWeb**, a `Web::Page` has a main `Web::Frame`, which may have subframes corresponding to `<frame>` or `<iframe>` HTML elements. Each `Web::Frame` has a `Web::Document`, which is the root node of the DOM tree.

Expand Down
2 changes: 1 addition & 1 deletion Meta/Lagom/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ if (BUILD_LAGOM)

# Audio
file(GLOB LIBAUDIO_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibAudio/*.cpp")
list(REMOVE_ITEM LIBAUDIO_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../../Userland/Libraries/LibAudio/ClientConnection.cpp")
list(REMOVE_ITEM LIBAUDIO_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/../../Userland/Libraries/LibAudio/ConnectionFromClient.cpp")
lagom_lib(Audio audio
SOURCES ${LIBAUDIO_SOURCES}
)
Expand Down
8 changes: 4 additions & 4 deletions Userland/Applets/Audio/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

#include <AK/Array.h>
#include <LibAudio/ClientConnection.h>
#include <LibAudio/ConnectionFromClient.h>
#include <LibConfig/Client.h>
#include <LibCore/System.h>
#include <LibGUI/Application.h>
Expand Down Expand Up @@ -43,14 +43,14 @@ class AudioWidget final : public GUI::Widget {
{ 0, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/audio-volume-zero.png")) },
{ 0, TRY(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/audio-volume-muted.png")) } }
};
auto audio_client = TRY(Audio::ClientConnection::try_create());
auto audio_client = TRY(Audio::ConnectionFromClient::try_create());
NonnullRefPtr<AudioWidget> audio_widget = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) AudioWidget(move(audio_client), move(volume_level_bitmaps))));
TRY(audio_widget->try_initialize_graphical_elements());
return audio_widget;
}

private:
AudioWidget(NonnullRefPtr<Audio::ClientConnection> audio_client, Array<VolumeBitmapPair, 5> volume_level_bitmaps)
AudioWidget(NonnullRefPtr<Audio::ConnectionFromClient> audio_client, Array<VolumeBitmapPair, 5> volume_level_bitmaps)
: m_audio_client(move(audio_client))
, m_volume_level_bitmaps(move(volume_level_bitmaps))
, m_show_percent(Config::read_bool("AudioApplet", "Applet", "ShowPercent", false))
Expand Down Expand Up @@ -222,7 +222,7 @@ class AudioWidget final : public GUI::Widget {
height);
}

NonnullRefPtr<Audio::ClientConnection> m_audio_client;
NonnullRefPtr<Audio::ConnectionFromClient> m_audio_client;
Array<VolumeBitmapPair, 5> m_volume_level_bitmaps;
bool m_show_percent { false };
bool m_audio_muted { false };
Expand Down
2 changes: 1 addition & 1 deletion Userland/Applications/Piano/AudioPlayerLoop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ AudioPlayerLoop::AudioPlayerLoop(TrackManager& track_manager, bool& need_to_writ
, m_need_to_write_wav(need_to_write_wav)
, m_wav_writer(wav_writer)
{
m_audio_client = Audio::ClientConnection::try_create().release_value_but_fixme_should_propagate_errors();
m_audio_client = Audio::ConnectionFromClient::try_create().release_value_but_fixme_should_propagate_errors();
m_audio_client->on_finish_playing_buffer = [this](int buffer_id) {
(void)buffer_id;
enqueue_audio();
Expand Down
4 changes: 2 additions & 2 deletions Userland/Applications/Piano/AudioPlayerLoop.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "Music.h"
#include <LibAudio/Buffer.h>
#include <LibAudio/ClientConnection.h>
#include <LibAudio/ConnectionFromClient.h>
#include <LibAudio/WavWriter.h>
#include <LibCore/Object.h>

Expand All @@ -31,7 +31,7 @@ class AudioPlayerLoop final : public Core::Object {
TrackManager& m_track_manager;
Array<Sample, sample_count> m_buffer;
Optional<Audio::ResampleHelper<double>> m_resampler;
RefPtr<Audio::ClientConnection> m_audio_client;
RefPtr<Audio::ConnectionFromClient> m_audio_client;

bool m_should_play_audio = true;

Expand Down
2 changes: 1 addition & 1 deletion Userland/Applications/Piano/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "TrackManager.h"
#include <AK/Queue.h>
#include <LibAudio/Buffer.h>
#include <LibAudio/ClientConnection.h>
#include <LibAudio/ConnectionFromClient.h>
#include <LibAudio/WavWriter.h>
#include <LibCore/EventLoop.h>
#include <LibCore/System.h>
Expand Down
2 changes: 1 addition & 1 deletion Userland/Applications/SoundPlayer/PlaybackManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "PlaybackManager.h"

PlaybackManager::PlaybackManager(NonnullRefPtr<Audio::ClientConnection> connection)
PlaybackManager::PlaybackManager(NonnullRefPtr<Audio::ConnectionFromClient> connection)
: m_connection(connection)
{
m_timer = Core::Timer::construct(PlaybackManager::update_rate_ms, [&]() {
Expand Down
8 changes: 4 additions & 4 deletions Userland/Applications/SoundPlayer/PlaybackManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
#include <AK/Queue.h>
#include <AK/Vector.h>
#include <LibAudio/Buffer.h>
#include <LibAudio/ClientConnection.h>
#include <LibAudio/ConnectionFromClient.h>
#include <LibAudio/Loader.h>
#include <LibCore/Timer.h>

class PlaybackManager final {
public:
PlaybackManager(NonnullRefPtr<Audio::ClientConnection>);
PlaybackManager(NonnullRefPtr<Audio::ConnectionFromClient>);
~PlaybackManager() = default;

void play();
Expand All @@ -34,7 +34,7 @@ class PlaybackManager final {
float total_length() const { return m_total_length; }
RefPtr<Audio::Buffer> current_buffer() const { return m_current_buffer; }

NonnullRefPtr<Audio::ClientConnection> connection() const { return m_connection; }
NonnullRefPtr<Audio::ConnectionFromClient> connection() const { return m_connection; }

Function<void()> on_update;
Function<void(Audio::Buffer&)> on_load_sample_buffer;
Expand All @@ -55,7 +55,7 @@ class PlaybackManager final {
size_t m_device_samples_per_buffer { 0 };
size_t m_source_buffer_size_bytes { 0 };
RefPtr<Audio::Loader> m_loader { nullptr };
NonnullRefPtr<Audio::ClientConnection> m_connection;
NonnullRefPtr<Audio::ConnectionFromClient> m_connection;
RefPtr<Audio::Buffer> m_current_buffer;
Queue<i32, always_enqueued_buffer_count + 1> m_enqueued_buffers;
Optional<Audio::ResampleHelper<double>> m_resampler;
Expand Down
2 changes: 1 addition & 1 deletion Userland/Applications/SoundPlayer/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "Player.h"

Player::Player(Audio::ClientConnection& audio_client_connection)
Player::Player(Audio::ConnectionFromClient& audio_client_connection)
: m_audio_client_connection(audio_client_connection)
, m_playback_manager(audio_client_connection)
{
Expand Down
4 changes: 2 additions & 2 deletions Userland/Applications/SoundPlayer/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Player {
Shuffling,
};

explicit Player(Audio::ClientConnection& audio_client_connection);
explicit Player(Audio::ConnectionFromClient& audio_client_connection);
virtual ~Player() = default;

void play_file_path(String const& path);
Expand Down Expand Up @@ -90,7 +90,7 @@ class Player {
LoopMode m_loop_mode;
ShuffleMode m_shuffle_mode;

Audio::ClientConnection& m_audio_client_connection;
Audio::ConnectionFromClient& m_audio_client_connection;
PlaybackManager m_playback_manager;

String m_loaded_filename;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <LibGUI/Window.h>
#include <LibGfx/Bitmap.h>

SoundPlayerWidgetAdvancedView::SoundPlayerWidgetAdvancedView(GUI::Window& window, Audio::ClientConnection& connection)
SoundPlayerWidgetAdvancedView::SoundPlayerWidgetAdvancedView(GUI::Window& window, Audio::ConnectionFromClient& connection)
: Player(connection)
, m_window(window)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "Player.h"
#include "VisualizationWidget.h"
#include <AK/NonnullRefPtr.h>
#include <LibAudio/ClientConnection.h>
#include <LibAudio/ConnectionFromClient.h>
#include <LibGUI/Splitter.h>
#include <LibGUI/Widget.h>

Expand Down Expand Up @@ -50,7 +50,7 @@ class SoundPlayerWidgetAdvancedView final : public GUI::Widget
void keydown_event(GUI::KeyEvent&) override;

private:
SoundPlayerWidgetAdvancedView(GUI::Window&, Audio::ClientConnection&);
SoundPlayerWidgetAdvancedView(GUI::Window&, Audio::ConnectionFromClient&);

void sync_previous_next_buttons();

Expand Down
4 changes: 2 additions & 2 deletions Userland/Applications/SoundPlayer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "Player.h"
#include "SampleWidget.h"
#include "SoundPlayerWidgetAdvancedView.h"
#include <LibAudio/ClientConnection.h>
#include <LibAudio/ConnectionFromClient.h>
#include <LibCore/System.h>
#include <LibGUI/Action.h>
#include <LibGUI/ActionGroup.h>
Expand All @@ -28,7 +28,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::pledge("stdio recvfd sendfd rpath thread unix"));

auto app = TRY(GUI::Application::try_create(arguments));
auto audio_client = TRY(Audio::ClientConnection::try_create());
auto audio_client = TRY(Audio::ConnectionFromClient::try_create());

TRY(Core::System::pledge("stdio recvfd sendfd rpath thread"));

Expand Down
2 changes: 1 addition & 1 deletion Userland/Applications/VideoPlayer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/

#include <LibAudio/ClientConnection.h>
#include <LibAudio/ConnectionFromClient.h>
#include <LibGUI/Application.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/ImageWidget.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ compile_ipc(LanguageClient.ipc LanguageClientEndpoint.h)

set(SOURCES
CodeComprehensionEngine.cpp
ClientConnection.cpp
ConnectionFromClient.cpp
FileDB.cpp)
set(GENERATED_SOURCES
LanguageClientEndpoint.h
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

namespace LanguageServers {

class ClientConnection;
class ConnectionFromClient;

class CodeComprehensionEngine {
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@
* SPDX-License-Identifier: BSD-2-Clause
*/

#include "ClientConnection.h"
#include "ConnectionFromClient.h"
#include <AK/Debug.h>
#include <AK/HashMap.h>
#include <LibCore/File.h>
#include <LibGUI/TextDocument.h>

namespace LanguageServers {

static HashMap<int, RefPtr<ClientConnection>> s_connections;
static HashMap<int, RefPtr<ConnectionFromClient>> s_connections;

ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket)
: IPC::ClientConnection<LanguageClientEndpoint, LanguageServerEndpoint>(*this, move(socket), 1)
ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket)
: IPC::ConnectionFromClient<LanguageClientEndpoint, LanguageServerEndpoint>(*this, move(socket), 1)
{
s_connections.set(1, *this);
}

void ClientConnection::die()
void ConnectionFromClient::die()
{
s_connections.remove(client_id());
exit(0);
}

void ClientConnection::greet(String const& project_root)
void ConnectionFromClient::greet(String const& project_root)
{
m_filedb.set_project_root(project_root);
if (unveil(project_root.characters(), "r") < 0) {
Expand All @@ -40,7 +40,7 @@ void ClientConnection::greet(String const& project_root)
}
}

void ClientConnection::file_opened(String const& filename, IPC::File const& file)
void ConnectionFromClient::file_opened(String const& filename, IPC::File const& file)
{
if (m_filedb.is_open(filename)) {
return;
Expand All @@ -49,7 +49,7 @@ void ClientConnection::file_opened(String const& filename, IPC::File const& file
m_autocomplete_engine->file_opened(filename);
}

void ClientConnection::file_edit_insert_text(String const& filename, String const& text, i32 start_line, i32 start_column)
void ConnectionFromClient::file_edit_insert_text(String const& filename, String const& text, i32 start_line, i32 start_column)
{
dbgln_if(LANGUAGE_SERVER_DEBUG, "InsertText for file: {}", filename);
dbgln_if(LANGUAGE_SERVER_DEBUG, "Text: {}", text);
Expand All @@ -58,15 +58,15 @@ void ClientConnection::file_edit_insert_text(String const& filename, String cons
m_autocomplete_engine->on_edit(filename);
}

void ClientConnection::file_edit_remove_text(String const& filename, i32 start_line, i32 start_column, i32 end_line, i32 end_column)
void ConnectionFromClient::file_edit_remove_text(String const& filename, i32 start_line, i32 start_column, i32 end_line, i32 end_column)
{
dbgln_if(LANGUAGE_SERVER_DEBUG, "RemoveText for file: {}", filename);
dbgln_if(LANGUAGE_SERVER_DEBUG, "[{}:{} - {}:{}]", start_line, start_column, end_line, end_column);
m_filedb.on_file_edit_remove_text(filename, start_line, start_column, end_line, end_column);
m_autocomplete_engine->on_edit(filename);
}

void ClientConnection::auto_complete_suggestions(GUI::AutocompleteProvider::ProjectLocation const& location)
void ConnectionFromClient::auto_complete_suggestions(GUI::AutocompleteProvider::ProjectLocation const& location)
{
dbgln_if(LANGUAGE_SERVER_DEBUG, "AutoCompleteSuggestions for: {} {}:{}", location.file, location.line, location.column);

Expand All @@ -81,7 +81,7 @@ void ClientConnection::auto_complete_suggestions(GUI::AutocompleteProvider::Proj
async_auto_complete_suggestions(move(suggestions));
}

void ClientConnection::set_file_content(String const& filename, String const& content)
void ConnectionFromClient::set_file_content(String const& filename, String const& content)
{
dbgln_if(LANGUAGE_SERVER_DEBUG, "SetFileContent: {}", filename);
auto document = m_filedb.get(filename);
Expand All @@ -95,7 +95,7 @@ void ClientConnection::set_file_content(String const& filename, String const& co
m_autocomplete_engine->on_edit(filename);
}

void ClientConnection::find_declaration(GUI::AutocompleteProvider::ProjectLocation const& location)
void ConnectionFromClient::find_declaration(GUI::AutocompleteProvider::ProjectLocation const& location)
{
dbgln_if(LANGUAGE_SERVER_DEBUG, "FindDeclaration: {} {}:{}", location.file, location.line, location.column);
auto document = m_filedb.get(location.file);
Expand All @@ -115,7 +115,7 @@ void ClientConnection::find_declaration(GUI::AutocompleteProvider::ProjectLocati
async_declaration_location(GUI::AutocompleteProvider::ProjectLocation { decl_location.value().file, decl_location.value().line, decl_location.value().column });
}

void ClientConnection::get_parameters_hint(GUI::AutocompleteProvider::ProjectLocation const& location)
void ConnectionFromClient::get_parameters_hint(GUI::AutocompleteProvider::ProjectLocation const& location)
{
dbgln_if(LANGUAGE_SERVER_DEBUG, "GetParametersHint: {} {}:{}", location.file, location.line, location.column);
auto document = m_filedb.get(location.file);
Expand All @@ -140,7 +140,7 @@ void ClientConnection::get_parameters_hint(GUI::AutocompleteProvider::ProjectLoc
async_parameters_hint_result(params->params, params->current_index);
}

void ClientConnection::get_tokens_info(String const& filename)
void ConnectionFromClient::get_tokens_info(String const& filename)
{
dbgln_if(LANGUAGE_SERVER_DEBUG, "GetTokenInfo: {}", filename);
auto document = m_filedb.get(filename);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@
#include "FileDB.h"
#include <AK/HashMap.h>
#include <AK/LexicalPath.h>
#include <LibIPC/ClientConnection.h>
#include <LibIPC/ConnectionFromClient.h>

#include <Userland/DevTools/HackStudio/LanguageServers/LanguageClientEndpoint.h>
#include <Userland/DevTools/HackStudio/LanguageServers/LanguageServerEndpoint.h>

namespace LanguageServers {

class ClientConnection : public IPC::ClientConnection<LanguageClientEndpoint, LanguageServerEndpoint> {
class ConnectionFromClient : public IPC::ConnectionFromClient<LanguageClientEndpoint, LanguageServerEndpoint> {
public:
explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>);
~ClientConnection() override = default;
explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>);
~ConnectionFromClient() override = default;

virtual void die() override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
#pragma once

#include "CppComprehensionEngine.h"
#include <DevTools/HackStudio/LanguageServers/ClientConnection.h>
#include <DevTools/HackStudio/LanguageServers/ConnectionFromClient.h>

namespace LanguageServers::Cpp {

class ClientConnection final : public LanguageServers::ClientConnection {
C_OBJECT(ClientConnection);
class ConnectionFromClient final : public LanguageServers::ConnectionFromClient {
C_OBJECT(ConnectionFromClient);

private:
ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket)
: LanguageServers::ClientConnection(move(socket))
ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket)
: LanguageServers::ConnectionFromClient(move(socket))
{
m_autocomplete_engine = make<CppComprehensionEngine>(m_filedb);
m_autocomplete_engine->set_declarations_of_document_callback = [this](const String& filename, Vector<GUI::AutocompleteProvider::Declaration>&& declarations) {
Expand All @@ -27,6 +27,6 @@ class ClientConnection final : public LanguageServers::ClientConnection {
};
}

virtual ~ClientConnection() override = default;
virtual ~ConnectionFromClient() override = default;
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <LibCpp/Parser.h>
#include <LibCpp/Preprocessor.h>
#include <LibRegex/Regex.h>
#include <Userland/DevTools/HackStudio/LanguageServers/ClientConnection.h>
#include <Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.h>

namespace LanguageServers::Cpp {

Expand Down
Loading

0 comments on commit 3a71748

Please sign in to comment.