diff options
author | Itamar <itamar8910@gmail.com> | 2022-02-25 12:18:30 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-25 22:35:12 +0100 |
commit | 3a71748e5d16a244c21aaf28ca3c4220c47f484e (patch) | |
tree | ea2751b9752bf299a2b3e3cdd613c7f8a36b7db1 /Userland | |
parent | efac8625703e9b059af0f32422d0d274f99ae475 (diff) | |
download | serenity-3a71748e5d16a244c21aaf28ca3c4220c47f484e.zip |
Userland: Rename IPC ClientConnection => ConnectionFromClient
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/'
Diffstat (limited to 'Userland')
135 files changed, 894 insertions, 894 deletions
diff --git a/Userland/Applets/Audio/main.cpp b/Userland/Applets/Audio/main.cpp index 216f977b17..383ec6f1f7 100644 --- a/Userland/Applets/Audio/main.cpp +++ b/Userland/Applets/Audio/main.cpp @@ -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> @@ -43,14 +43,14 @@ public: { 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)) @@ -222,7 +222,7 @@ private: 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 }; diff --git a/Userland/Applications/Piano/AudioPlayerLoop.cpp b/Userland/Applications/Piano/AudioPlayerLoop.cpp index 5c7bdbb2da..387a9f9622 100644 --- a/Userland/Applications/Piano/AudioPlayerLoop.cpp +++ b/Userland/Applications/Piano/AudioPlayerLoop.cpp @@ -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(); diff --git a/Userland/Applications/Piano/AudioPlayerLoop.h b/Userland/Applications/Piano/AudioPlayerLoop.h index b58a2f4944..9e50a1dee7 100644 --- a/Userland/Applications/Piano/AudioPlayerLoop.h +++ b/Userland/Applications/Piano/AudioPlayerLoop.h @@ -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> @@ -31,7 +31,7 @@ private: 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; diff --git a/Userland/Applications/Piano/main.cpp b/Userland/Applications/Piano/main.cpp index fcd8c434af..5093de32b9 100644 --- a/Userland/Applications/Piano/main.cpp +++ b/Userland/Applications/Piano/main.cpp @@ -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> diff --git a/Userland/Applications/SoundPlayer/PlaybackManager.cpp b/Userland/Applications/SoundPlayer/PlaybackManager.cpp index 4d727102de..c8e53684ac 100644 --- a/Userland/Applications/SoundPlayer/PlaybackManager.cpp +++ b/Userland/Applications/SoundPlayer/PlaybackManager.cpp @@ -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, [&]() { diff --git a/Userland/Applications/SoundPlayer/PlaybackManager.h b/Userland/Applications/SoundPlayer/PlaybackManager.h index 5683ac7cc6..2959855fa9 100644 --- a/Userland/Applications/SoundPlayer/PlaybackManager.h +++ b/Userland/Applications/SoundPlayer/PlaybackManager.h @@ -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(); @@ -34,7 +34,7 @@ public: 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; @@ -55,7 +55,7 @@ private: 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; diff --git a/Userland/Applications/SoundPlayer/Player.cpp b/Userland/Applications/SoundPlayer/Player.cpp index 31551c5c05..5f32f599f8 100644 --- a/Userland/Applications/SoundPlayer/Player.cpp +++ b/Userland/Applications/SoundPlayer/Player.cpp @@ -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) { diff --git a/Userland/Applications/SoundPlayer/Player.h b/Userland/Applications/SoundPlayer/Player.h index 277e65af2b..7466be85f1 100644 --- a/Userland/Applications/SoundPlayer/Player.h +++ b/Userland/Applications/SoundPlayer/Player.h @@ -30,7 +30,7 @@ public: 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); @@ -90,7 +90,7 @@ private: 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; diff --git a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp index 4065cdc211..ca3e27b059 100644 --- a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp +++ b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp @@ -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) { diff --git a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.h b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.h index f06edc6001..c82ea44943 100644 --- a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.h +++ b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.h @@ -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> @@ -50,7 +50,7 @@ protected: void keydown_event(GUI::KeyEvent&) override; private: - SoundPlayerWidgetAdvancedView(GUI::Window&, Audio::ClientConnection&); + SoundPlayerWidgetAdvancedView(GUI::Window&, Audio::ConnectionFromClient&); void sync_previous_next_buttons(); diff --git a/Userland/Applications/SoundPlayer/main.cpp b/Userland/Applications/SoundPlayer/main.cpp index e7a8a882ba..1521e0a7fa 100644 --- a/Userland/Applications/SoundPlayer/main.cpp +++ b/Userland/Applications/SoundPlayer/main.cpp @@ -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> @@ -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")); diff --git a/Userland/Applications/VideoPlayer/main.cpp b/Userland/Applications/VideoPlayer/main.cpp index 4f75fad855..9d3f178082 100644 --- a/Userland/Applications/VideoPlayer/main.cpp +++ b/Userland/Applications/VideoPlayer/main.cpp @@ -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> diff --git a/Userland/DevTools/HackStudio/LanguageServers/CMakeLists.txt b/Userland/DevTools/HackStudio/LanguageServers/CMakeLists.txt index 8e7c722eb7..357146c2fe 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/CMakeLists.txt +++ b/Userland/DevTools/HackStudio/LanguageServers/CMakeLists.txt @@ -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 diff --git a/Userland/DevTools/HackStudio/LanguageServers/CodeComprehensionEngine.h b/Userland/DevTools/HackStudio/LanguageServers/CodeComprehensionEngine.h index da410b4638..7a9f0db06d 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/CodeComprehensionEngine.h +++ b/Userland/DevTools/HackStudio/LanguageServers/CodeComprehensionEngine.h @@ -14,7 +14,7 @@ namespace LanguageServers { -class ClientConnection; +class ConnectionFromClient; class CodeComprehensionEngine { public: diff --git a/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.cpp b/Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.cpp index 03edcb14ee..741774ae69 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.cpp @@ -5,7 +5,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include "ClientConnection.h" +#include "ConnectionFromClient.h" #include <AK/Debug.h> #include <AK/HashMap.h> #include <LibCore/File.h> @@ -13,21 +13,21 @@ 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) { @@ -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; @@ -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); @@ -58,7 +58,7 @@ 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); @@ -66,7 +66,7 @@ void ClientConnection::file_edit_remove_text(String const& filename, i32 start_l 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); @@ -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); @@ -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); @@ -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); @@ -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); diff --git a/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.h b/Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.h index fc848b2fbb..6e909ff185 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/ClientConnection.h +++ b/Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.h @@ -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; diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.h b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ConnectionFromClient.h index 90cb30eb5b..91a34958f2 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.h +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ConnectionFromClient.h @@ -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) { @@ -27,6 +27,6 @@ private: }; } - virtual ~ClientConnection() override = default; + virtual ~ConnectionFromClient() override = default; }; } diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp b/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp index 83dc968cbc..107b6f40f3 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/CppComprehensionEngine.cpp @@ -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 { diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/main.cpp b/Userland/DevTools/HackStudio/LanguageServers/Cpp/main.cpp index 3fd711bbc2..4978a22eb9 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/main.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/main.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include "ClientConnection.h" +#include "ConnectionFromClient.h" #include "Tests.h" #include <LibCore/ArgsParser.h> #include <LibCore/EventLoop.h> @@ -34,7 +34,7 @@ ErrorOr<int> mode_server() Core::EventLoop event_loop; TRY(Core::System::pledge("stdio unix recvfd rpath")); - auto client = TRY(IPC::take_over_accepted_client_from_system_server<LanguageServers::Cpp::ClientConnection>()); + auto client = TRY(IPC::take_over_accepted_client_from_system_server<LanguageServers::Cpp::ConnectionFromClient>()); TRY(Core::System::pledge("stdio recvfd rpath")); TRY(Core::System::unveil("/usr/include", "r")); diff --git a/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.h b/Userland/DevTools/HackStudio/LanguageServers/Shell/ConnectionFromClient.h index 8ca1eb66cc..20eff7faf0 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.h +++ b/Userland/DevTools/HackStudio/LanguageServers/Shell/ConnectionFromClient.h @@ -7,17 +7,17 @@ #pragma once #include "ShellComprehensionEngine.h" -#include <DevTools/HackStudio/LanguageServers/ClientConnection.h> +#include <DevTools/HackStudio/LanguageServers/ConnectionFromClient.h> #include <LibCpp/Parser.h> namespace LanguageServers::Shell { -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<ShellComprehensionEngine>(m_filedb); m_autocomplete_engine->set_declarations_of_document_callback = [this](const String& filename, Vector<GUI::AutocompleteProvider::Declaration>&& declarations) { @@ -27,6 +27,6 @@ private: async_todo_entries_in_document(filename, move(todo_entries)); }; } - virtual ~ClientConnection() override = default; + virtual ~ConnectionFromClient() override = default; }; } diff --git a/Userland/DevTools/HackStudio/LanguageServers/Shell/ShellComprehensionEngine.cpp b/Userland/DevTools/HackStudio/LanguageServers/Shell/ShellComprehensionEngine.cpp index 0078c6c60f..9b3dcd56ee 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Shell/ShellComprehensionEngine.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Shell/ShellComprehensionEngine.cpp @@ -8,7 +8,7 @@ #include <AK/Assertions.h> #include <AK/HashTable.h> #include <LibRegex/Regex.h> -#include <Userland/DevTools/HackStudio/LanguageServers/ClientConnection.h> +#include <Userland/DevTools/HackStudio/LanguageServers/ConnectionFromClient.h> namespace LanguageServers::Shell { diff --git a/Userland/DevTools/HackStudio/LanguageServers/Shell/main.cpp b/Userland/DevTools/HackStudio/LanguageServers/Shell/main.cpp index a36673ca6c..5281db9f3e 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Shell/main.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Shell/main.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include "ClientConnection.h" +#include "ConnectionFromClient.h" #include <LibCore/EventLoop.h> #include <LibCore/LocalServer.h> #include <LibCore/System.h> @@ -16,7 +16,7 @@ ErrorOr<int> serenity_main(Main::Arguments) Core::EventLoop event_loop; TRY(Core::System::pledge("stdio unix rpath recvfd")); - auto client = TRY(IPC::take_over_accepted_client_from_system_server<LanguageServers::Shell::ClientConnection>()); + auto client = TRY(IPC::take_over_accepted_client_from_system_server<LanguageServers::Shell::ConnectionFromClient>()); TRY(Core::System::pledge("stdio rpath recvfd")); TRY(Core::System::unveil("/etc/passwd", "r")); diff --git a/Userland/Libraries/LibAudio/CMakeLists.txt b/Userland/Libraries/LibAudio/CMakeLists.txt index 8497c0cb5b..c78198a8be 100644 --- a/Userland/Libraries/LibAudio/CMakeLists.txt +++ b/Userland/Libraries/LibAudio/CMakeLists.txt @@ -1,6 +1,6 @@ set(SOURCES Buffer.cpp - ClientConnection.cpp + ConnectionFromClient.cpp Loader.cpp WavLoader.cpp FlacLoader.cpp diff --git a/Userland/Libraries/LibAudio/ClientConnection.cpp b/Userland/Libraries/LibAudio/ConnectionFromClient.cpp index db3f5b0bce..74d0c907c7 100644 --- a/Userland/Libraries/LibAudio/ClientConnection.cpp +++ b/Userland/Libraries/LibAudio/ConnectionFromClient.cpp @@ -5,7 +5,7 @@ */ #include <LibAudio/Buffer.h> -#include <LibAudio/ClientConnection.h> +#include <LibAudio/ConnectionFromClient.h> #include <time.h> namespace Audio { @@ -14,12 +14,12 @@ namespace Audio { // Real-time audio may be improved with a lower value. static timespec g_enqueue_wait_time { 0, 10'000'000 }; -ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket) +ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket) : IPC::ServerConnection<AudioClientEndpoint, AudioServerEndpoint>(*this, move(socket)) { } -void ClientConnection::enqueue(Buffer const& buffer) +void ConnectionFromClient::enqueue(Buffer const& buffer) { for (;;) { auto success = enqueue_buffer(buffer.anonymous_buffer(), buffer.id(), buffer.sample_count()); @@ -29,35 +29,35 @@ void ClientConnection::enqueue(Buffer const& buffer) } } -void ClientConnection::async_enqueue(Buffer const& buffer) +void ConnectionFromClient::async_enqueue(Buffer const& buffer) { async_enqueue_buffer(buffer.anonymous_buffer(), buffer.id(), buffer.sample_count()); } -bool ClientConnection::try_enqueue(Buffer const& buffer) +bool ConnectionFromClient::try_enqueue(Buffer const& buffer) { return enqueue_buffer(buffer.anonymous_buffer(), buffer.id(), buffer.sample_count()); } -void ClientConnection::finished_playing_buffer(i32 buffer_id) +void ConnectionFromClient::finished_playing_buffer(i32 buffer_id) { if (on_finish_playing_buffer) on_finish_playing_buffer(buffer_id); } -void ClientConnection::main_mix_muted_state_changed(bool muted) +void ConnectionFromClient::main_mix_muted_state_changed(bool muted) { if (on_main_mix_muted_state_change) on_main_mix_muted_state_change(muted); } -void ClientConnection::main_mix_volume_changed(double volume) +void ConnectionFromClient::main_mix_volume_changed(double volume) { if (on_main_mix_volume_change) on_main_mix_volume_change(volume); } -void ClientConnection::client_volume_changed(double volume) +void ConnectionFromClient::client_volume_changed(double volume) { if (on_client_volume_change) on_client_volume_change(volume); diff --git a/Userland/Libraries/LibAudio/ClientConnection.h b/Userland/Libraries/LibAudio/ConnectionFromClient.h index 8602d59b7f..f84243cf6f 100644 --- a/Userland/Libraries/LibAudio/ClientConnection.h +++ b/Userland/Libraries/LibAudio/ConnectionFromClient.h @@ -14,10 +14,10 @@ namespace Audio { class Buffer; -class ClientConnection final +class ConnectionFromClient final : public IPC::ServerConnection<AudioClientEndpoint, AudioServerEndpoint> , public AudioClientEndpoint { - IPC_CLIENT_CONNECTION(ClientConnection, "/tmp/portal/audio") + IPC_CLIENT_CONNECTION(ConnectionFromClient, "/tmp/portal/audio") public: void enqueue(Buffer const&); bool try_enqueue(Buffer const&); @@ -29,7 +29,7 @@ public: Function<void(double volume)> on_client_volume_change; private: - ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>); + ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>); virtual void finished_playing_buffer(i32) override; virtual void main_mix_muted_state_changed(bool) override; diff --git a/Userland/Libraries/LibIPC/ClientConnection.h b/Userland/Libraries/LibIPC/ConnectionFromClient.h index 2fef3b83ef..a57b243c4b 100644 --- a/Userland/Libraries/LibIPC/ClientConnection.h +++ b/Userland/Libraries/LibIPC/ConnectionFromClient.h @@ -17,14 +17,14 @@ NonnullRefPtr<T> new_client_connection(Args&&... args) } template<typename ClientEndpoint, typename ServerEndpoint> -class ClientConnection : public Connection<ServerEndpoint, ClientEndpoint> +class ConnectionFromClient : public Connection<ServerEndpoint, ClientEndpoint> , public ServerEndpoint::Stub , public ClientEndpoint::template Proxy<ServerEndpoint> { public: using ServerStub = typename ServerEndpoint::Stub; using IPCProxy = typename ClientEndpoint::template Proxy<ServerEndpoint>; - ClientConnection(ServerStub& stub, NonnullOwnPtr<Core::Stream::LocalSocket> socket, int client_id) + ConnectionFromClient(ServerStub& stub, NonnullOwnPtr<Core::Stream::LocalSocket> socket, int client_id) : IPC::Connection<ServerEndpoint, ClientEndpoint>(stub, move(socket)) , ClientEndpoint::template Proxy<ServerEndpoint>(*this, {}) , m_client_id(client_id) @@ -36,7 +36,7 @@ public: }; } - virtual ~ClientConnection() override + virtual ~ConnectionFromClient() override { } @@ -69,5 +69,5 @@ private: } template<typename ClientEndpoint, typename ServerEndpoint> -struct AK::Formatter<IPC::ClientConnection<ClientEndpoint, ServerEndpoint>> : Formatter<Core::Object> { +struct AK::Formatter<IPC::ConnectionFromClient<ClientEndpoint, ServerEndpoint>> : Formatter<Core::Object> { }; diff --git a/Userland/Libraries/LibIPC/MultiServer.h b/Userland/Libraries/LibIPC/MultiServer.h index 3a3794fb28..b00e6da0fe 100644 --- a/Userland/Libraries/LibIPC/MultiServer.h +++ b/Userland/Libraries/LibIPC/MultiServer.h @@ -8,11 +8,11 @@ #include <AK/Error.h> #include <LibCore/LocalServer.h> -#include <LibIPC/ClientConnection.h> +#include <LibIPC/ConnectionFromClient.h> namespace IPC { -template<typename ClientConnectionType> +template<typename ConnectionFromClientType> class MultiServer { public: static ErrorOr<NonnullOwnPtr<MultiServer>> try_create(Optional<String> socket_path = {}) @@ -28,7 +28,7 @@ private: { m_server->on_accept = [&](auto client_socket) { auto client_id = ++m_next_client_id; - (void)IPC::new_client_connection<ClientConnectionType>(move(client_socket), client_id); + (void)IPC::new_client_connection<ConnectionFromClientType>(move(client_socket), client_id); }; } diff --git a/Userland/Libraries/LibIPC/SingleServer.h b/Userland/Libraries/LibIPC/SingleServer.h index 3a7da1a8fc..c6613f112c 100644 --- a/Userland/Libraries/LibIPC/SingleServer.h +++ b/Userland/Libraries/LibIPC/SingleServer.h @@ -8,15 +8,15 @@ #include <LibCore/System.h> #include <LibCore/SystemServerTakeover.h> -#include <LibIPC/ClientConnection.h> +#include <LibIPC/ConnectionFromClient.h> namespace IPC { -template<typename ClientConnectionType> -ErrorOr<NonnullRefPtr<ClientConnectionType>> take_over_accepted_client_from_system_server() +template<typename ConnectionFromClientType> +ErrorOr<NonnullRefPtr<ConnectionFromClientType>> take_over_accepted_client_from_system_server() { auto socket = TRY(Core::take_over_socket_from_system_server()); - return IPC::new_client_connection<ClientConnectionType>(move(socket)); + return IPC::new_client_connection<ConnectionFromClientType>(move(socket)); } } diff --git a/Userland/Services/AudioServer/CMakeLists.txt b/Userland/Services/AudioServer/CMakeLists.txt index e589ea2815..838cffc6be 100644 --- a/Userland/Services/AudioServer/CMakeLists.txt +++ b/Userland/Services/AudioServer/CMakeLists.txt @@ -8,7 +8,7 @@ compile_ipc(AudioServer.ipc AudioServerEndpoint.h) compile_ipc(AudioClient.ipc AudioClientEndpoint.h) set(SOURCES - ClientConnection.cpp + ConnectionFromClient.cpp Mixer.cpp main.cpp AudioServerEndpoint.h diff --git a/Userland/Services/AudioServer/ClientConnection.cpp b/Userland/Services/AudioServer/ClientConnection.cpp deleted file mode 100644 index 758ecde1b3..0000000000 --- a/Userland/Services/AudioServer/ClientConnection.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include "ClientConnection.h" -#include "Mixer.h" -#include <AudioServer/AudioClientEndpoint.h> -#include <LibAudio/Buffer.h> - -namespace AudioServer { - -static HashMap<int, RefPtr<ClientConnection>> s_connections; - -void ClientConnection::for_each(Function<void(ClientConnection&)> callback) -{ - NonnullRefPtrVector<ClientConnection> connections; - for (auto& it : s_connections) - connections.append(*it.value); - for (auto& connection : connections) - callback(connection); -} - -ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id, Mixer& mixer) - : IPC::ClientConnection<AudioClientEndpoint, AudioServerEndpoint>(*this, move(client_socket), client_id) - , m_mixer(mixer) -{ - s_connections.set(client_id, *this); -} - -ClientConnection::~ClientConnection() -{ -} - -void ClientConnection::die() -{ - s_connections.remove(client_id()); -} - -void ClientConnection::did_finish_playing_buffer(Badge<ClientAudioStream>, int buffer_id) -{ - async_finished_playing_buffer(buffer_id); -} - -void ClientConnection::did_change_main_mix_muted_state(Badge<Mixer>, bool muted) -{ - async_main_mix_muted_state_changed(muted); -} - -void ClientConnection::did_change_main_mix_volume(Badge<Mixer>, double volume) -{ - async_main_mix_volume_changed(volume); -} - -void ClientConnection::did_change_client_volume(Badge<ClientAudioStream>, double volume) -{ - async_client_volume_changed(volume); -} - -Messages::AudioServer::GetMainMixVolumeResponse ClientConnection::get_main_mix_volume() -{ - return m_mixer.main_volume(); -} - -void ClientConnection::set_main_mix_volume(double volume) -{ - m_mixer.set_main_volume(volume); -} - -Messages::AudioServer::GetSampleRateResponse ClientConnection::get_sample_rate() -{ - return { m_mixer.audiodevice_get_sample_rate() }; -} - -void ClientConnection::set_sample_rate(u32 sample_rate) -{ - m_mixer.audiodevice_set_sample_rate(sample_rate); -} - -Messages::AudioServer::GetSelfVolumeResponse ClientConnection::get_self_volume() -{ - return m_queue->volume().target(); -} - -void ClientConnection::set_self_volume(double volume) -{ - if (m_queue) - m_queue->set_volume(volume); -} - -Messages::AudioServer::EnqueueBufferResponse ClientConnection::enqueue_buffer(Core::AnonymousBuffer const& buffer, i32 buffer_id, int sample_count) -{ - if (!m_queue) - m_queue = m_mixer.create_queue(*this); - - if (m_queue->is_full()) - return false; - - // There's not a big allocation to worry about here. - m_queue->enqueue(MUST(Audio::Buffer::create_with_anonymous_buffer(buffer, buffer_id, sample_count))); - return true; -} - -Messages::AudioServer::GetRemainingSamplesResponse ClientConnection::get_remaining_samples() -{ - int remaining = 0; - if (m_queue) - remaining = m_queue->get_remaining_samples(); - - return remaining; -} - -Messages::AudioServer::GetPlayedSamplesResponse ClientConnection::get_played_samples() -{ - int played = 0; - if (m_queue) - played = m_queue->get_played_samples(); - - return played; -} - -void ClientConnection::set_paused(bool paused) -{ - if (m_queue) - m_queue->set_paused(paused); -} - -void ClientConnection::clear_buffer(bool paused) -{ - if (m_queue) - m_queue->clear(paused); -} - -Messages::AudioServer::GetPlayingBufferResponse ClientConnection::get_playing_buffer() -{ - int id = -1; - if (m_queue) - id = m_queue->get_playing_buffer(); - return id; -} - -Messages::AudioServer::IsMainMixMutedResponse ClientConnection::is_main_mix_muted() -{ - return m_mixer.is_muted(); -} - -void ClientConnection::set_main_mix_muted(bool muted) -{ - m_mixer.set_muted(muted); -} - -Messages::AudioServer::IsSelfMutedResponse ClientConnection::is_self_muted() -{ - if (m_queue) - return m_queue->is_muted(); - - return false; -} - -void ClientConnection::set_self_muted(bool muted) -{ - if (m_queue) - m_queue->set_muted(muted); -} -} diff --git a/Userland/Services/AudioServer/ConnectionFromClient.cpp b/Userland/Services/AudioServer/ConnectionFromClient.cpp new file mode 100644 index 0000000000..1433b09bdb --- /dev/null +++ b/Userland/Services/AudioServer/ConnectionFromClient.cpp @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include "ConnectionFromClient.h" +#include "Mixer.h" +#include <AudioServer/AudioClientEndpoint.h> +#include <LibAudio/Buffer.h> + +namespace AudioServer { + +static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; + +void ConnectionFromClient::for_each(Function<void(ConnectionFromClient&)> callback) +{ + NonnullRefPtrVector<ConnectionFromClient> connections; + for (auto& it : s_connections) + connections.append(*it.value); + for (auto& connection : connections) + callback(connection); +} + +ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id, Mixer& mixer) + : IPC::ConnectionFromClient<AudioClientEndpoint, AudioServerEndpoint>(*this, move(client_socket), client_id) + , m_mixer(mixer) +{ + s_connections.set(client_id, *this); +} + +ConnectionFromClient::~ConnectionFromClient() +{ +} + +void ConnectionFromClient::die() +{ + s_connections.remove(client_id()); +} + +void ConnectionFromClient::did_finish_playing_buffer(Badge<ClientAudioStream>, int buffer_id) +{ + async_finished_playing_buffer(buffer_id); +} + +void ConnectionFromClient::did_change_main_mix_muted_state(Badge<Mixer>, bool muted) +{ + async_main_mix_muted_state_changed(muted); +} + +void ConnectionFromClient::did_change_main_mix_volume(Badge<Mixer>, double volume) +{ + async_main_mix_volume_changed(volume); +} + +void ConnectionFromClient::did_change_client_volume(Badge<ClientAudioStream>, double volume) +{ + async_client_volume_changed(volume); +} + +Messages::AudioServer::GetMainMixVolumeResponse ConnectionFromClient::get_main_mix_volume() +{ + return m_mixer.main_volume(); +} + +void ConnectionFromClient::set_main_mix_volume(double volume) +{ + m_mixer.set_main_volume(volume); +} + +Messages::AudioServer::GetSampleRateResponse ConnectionFromClient::get_sample_rate() +{ + return { m_mixer.audiodevice_get_sample_rate() }; +} + +void ConnectionFromClient::set_sample_rate(u32 sample_rate) +{ + m_mixer.audiodevice_set_sample_rate(sample_rate); +} + +Messages::AudioServer::GetSelfVolumeResponse ConnectionFromClient::get_self_volume() +{ + return m_queue->volume().target(); +} + +void ConnectionFromClient::set_self_volume(double volume) +{ + if (m_queue) + m_queue->set_volume(volume); +} + +Messages::AudioServer::EnqueueBufferResponse ConnectionFromClient::enqueue_buffer(Core::AnonymousBuffer const& buffer, i32 buffer_id, int sample_count) +{ + if (!m_queue) + m_queue = m_mixer.create_queue(*this); + + if (m_queue->is_full()) + return false; + + // There's not a big allocation to worry about here. + m_queue->enqueue(MUST(Audio::Buffer::create_with_anonymous_buffer(buffer, buffer_id, sample_count))); + return true; +} + +Messages::AudioServer::GetRemainingSamplesResponse ConnectionFromClient::get_remaining_samples() +{ + int remaining = 0; + if (m_queue) + remaining = m_queue->get_remaining_samples(); + + return remaining; +} + +Messages::AudioServer::GetPlayedSamplesResponse ConnectionFromClient::get_played_samples() +{ + int played = 0; + if (m_queue) + played = m_queue->get_played_samples(); + + return played; +} + +void ConnectionFromClient::set_paused(bool paused) +{ + if (m_queue) + m_queue->set_paused(paused); +} + +void ConnectionFromClient::clear_buffer(bool paused) +{ + if (m_queue) + m_queue->clear(paused); +} + +Messages::AudioServer::GetPlayingBufferResponse ConnectionFromClient::get_playing_buffer() +{ + int id = -1; + if (m_queue) + id = m_queue->get_playing_buffer(); + return id; +} + +Messages::AudioServer::IsMainMixMutedResponse ConnectionFromClient::is_main_mix_muted() +{ + return m_mixer.is_muted(); +} + +void ConnectionFromClient::set_main_mix_muted(bool muted) +{ + m_mixer.set_muted(muted); +} + +Messages::AudioServer::IsSelfMutedResponse ConnectionFromClient::is_self_muted() +{ + if (m_queue) + return m_queue->is_muted(); + + return false; +} + +void ConnectionFromClient::set_self_muted(bool muted) +{ + if (m_queue) + m_queue->set_muted(muted); +} +} diff --git a/Userland/Services/AudioServer/ClientConnection.h b/Userland/Services/AudioServer/ConnectionFromClient.h index 58109dbab3..78647fec6c 100644 --- a/Userland/Services/AudioServer/ClientConnection.h +++ b/Userland/Services/AudioServer/ConnectionFromClient.h @@ -9,7 +9,7 @@ #include <AK/HashMap.h> #include <AudioServer/AudioClientEndpoint.h> #include <AudioServer/AudioServerEndpoint.h> -#include <LibIPC/ClientConnection.h> +#include <LibIPC/ConnectionFromClient.h> namespace Audio { class Buffer; @@ -20,10 +20,10 @@ namespace AudioServer { class ClientAudioStream; class Mixer; -class ClientConnection final : public IPC::ClientConnection<AudioClientEndpoint, AudioServerEndpoint> { - C_OBJECT(ClientConnection) +class ConnectionFromClient final : public IPC::ConnectionFromClient<AudioClientEndpoint, AudioServerEndpoint> { + C_OBJECT(ConnectionFromClient) public: - ~ClientConnection() override; + ~ConnectionFromClient() override; void did_finish_playing_buffer(Badge<ClientAudioStream>, int buffer_id); void did_change_client_volume(Badge<ClientAudioStream>, double volume); @@ -32,10 +32,10 @@ public: virtual void die() override; - static void for_each(Function<void(ClientConnection&)>); + static void for_each(Function<void(ConnectionFromClient&)>); private: - explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id, Mixer& mixer); + explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id, Mixer& mixer); virtual Messages::AudioServer::GetMainMixVolumeResponse get_main_mix_volume() override; virtual void set_main_mix_volume(double) override; diff --git a/Userland/Services/AudioServer/Mixer.cpp b/Userland/Services/AudioServer/Mixer.cpp index d38102b0b4..2f29317661 100644 --- a/Userland/Services/AudioServer/Mixer.cpp +++ b/Userland/Services/AudioServer/Mixer.cpp @@ -10,7 +10,7 @@ #include <AK/Array.h> #include <AK/MemoryStream.h> #include <AK/NumericLimits.h> -#include <AudioServer/ClientConnection.h> +#include <AudioServer/ConnectionFromClient.h> #include <AudioServer/Mixer.h> #include <LibCore/ConfigFile.h> #include <LibCore/Timer.h> @@ -48,7 +48,7 @@ Mixer::~Mixer() { } -NonnullRefPtr<ClientAudioStream> Mixer::create_queue(ClientConnection& client) +NonnullRefPtr<ClientAudioStream> Mixer::create_queue(ConnectionFromClient& client) { auto queue = adopt_ref(*new ClientAudioStream(client)); m_pending_mutex.lock(); @@ -149,7 +149,7 @@ void Mixer::set_main_volume(double volume) m_config->write_num_entry("Master", "Volume", static_cast<int>(volume * 100)); request_setting_sync(); - ClientConnection::for_each([&](ClientConnection& client) { + ConnectionFromClient::for_each([&](ConnectionFromClient& client) { client.did_change_main_mix_volume({}, main_volume()); }); } @@ -163,7 +163,7 @@ void Mixer::set_muted(bool muted) m_config->write_bool_entry("Master", "Mute", m_muted); request_setting_sync(); - ClientConnection::for_each([muted](ClientConnection& client) { + ConnectionFromClient::for_each([muted](ConnectionFromClient& client) { client.did_change_main_mix_muted_state({}, muted); }); } @@ -199,7 +199,7 @@ void Mixer::request_setting_sync() } } -ClientAudioStream::ClientAudioStream(ClientConnection& client) +ClientAudioStream::ClientAudioStream(ConnectionFromClient& client) : m_client(client) { } diff --git a/Userland/Services/AudioServer/Mixer.h b/Userland/Services/AudioServer/Mixer.h index 4ac370f217..ef4cbc4fe4 100644 --- a/Userland/Services/AudioServer/Mixer.h +++ b/Userland/Services/AudioServer/Mixer.h @@ -7,7 +7,7 @@ #pragma once -#include "ClientConnection.h" +#include "ConnectionFromClient.h" #include "FadingProperty.h" #include <AK/Atomic.h> #include <AK/Badge.h> @@ -30,11 +30,11 @@ namespace AudioServer { // This is to prevent clipping when two streams with low headroom (e.g. normalized & compressed) are playing. constexpr double SAMPLE_HEADROOM = 0.7; -class ClientConnection; +class ConnectionFromClient; class ClientAudioStream : public RefCounted<ClientAudioStream> { public: - explicit ClientAudioStream(ClientConnection&); + explicit ClientAudioStream(ConnectionFromClient&); ~ClientAudioStream() { } bool is_full() const { return m_queue.size() >= 3; } @@ -64,7 +64,7 @@ public: return true; } - ClientConnection* client() { return m_client.ptr(); } + ConnectionFromClient* client() { return m_client.ptr(); } void clear(bool paused = false) { @@ -105,7 +105,7 @@ private: bool m_paused { false }; bool m_muted { false }; - WeakPtr<ClientConnection> m_client; + WeakPtr<ConnectionFromClient> m_client; FadingProperty<double> m_volume { 1 }; }; @@ -114,7 +114,7 @@ class Mixer : public Core::Object { public: virtual ~Mixer() override; - NonnullRefPtr<ClientAudioStream> create_queue(ClientConnection&); + NonnullRefPtr<ClientAudioStream> create_queue(ConnectionFromClient&); // To the outside world, we pretend that the target volume is already reached, even though it may be still fading. double main_volume() const { return m_main_volume.target(); } diff --git a/Userland/Services/AudioServer/main.cpp b/Userland/Services/AudioServer/main.cpp index b659484659..fca1d8eb9a 100644 --- a/Userland/Services/AudioServer/main.cpp +++ b/Userland/Services/AudioServer/main.cpp @@ -28,7 +28,7 @@ ErrorOr<int> serenity_main(Main::Arguments) server->on_accept = [&](NonnullOwnPtr<Core::Stream::LocalSocket> client_socket) { static int s_next_client_id = 0; int client_id = ++s_next_client_id; - (void)IPC::new_client_connection<AudioServer::ClientConnection>(move(client_socket), client_id, *mixer); + (void)IPC::new_client_connection<AudioServer::ConnectionFromClient>(move(client_socket), client_id, *mixer); }; TRY(Core::System::pledge("stdio recvfd thread accept cpath rpath wpath")); diff --git a/Userland/Services/Clipboard/CMakeLists.txt b/Userland/Services/Clipboard/CMakeLists.txt index 05b31334ab..1bfb4b47b0 100644 --- a/Userland/Services/Clipboard/CMakeLists.txt +++ b/Userland/Services/Clipboard/CMakeLists.txt @@ -8,7 +8,7 @@ compile_ipc(ClipboardServer.ipc ClipboardServerEndpoint.h) compile_ipc(ClipboardClient.ipc ClipboardClientEndpoint.h) set(SOURCES - ClientConnection.cpp + ConnectionFromClient.cpp ClipboardClientEndpoint.h ClipboardServerEndpoint.h Storage.cpp diff --git a/Userland/Services/Clipboard/ClientConnection.cpp b/Userland/Services/Clipboard/ClientConnection.cpp deleted file mode 100644 index 830af96e97..0000000000 --- a/Userland/Services/Clipboard/ClientConnection.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2020, Andreas Kling <kling@serenityos.org> - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include <Clipboard/ClientConnection.h> -#include <Clipboard/ClipboardClientEndpoint.h> -#include <Clipboard/Storage.h> - -namespace Clipboard { - -static HashMap<int, RefPtr<ClientConnection>> s_connections; - -void ClientConnection::for_each_client(Function<void(ClientConnection&)> callback) -{ - for (auto& it : s_connections) { - callback(*it.value); - } -} - -ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket, int client_id) - : IPC::ClientConnection<ClipboardClientEndpoint, ClipboardServerEndpoint>(*this, move(socket), client_id) -{ - s_connections.set(client_id, *this); -} - -ClientConnection::~ClientConnection() -{ -} - -void ClientConnection::die() -{ - s_connections.remove(client_id()); -} - -void ClientConnection::set_clipboard_data(Core::AnonymousBuffer const& data, String const& mime_type, IPC::Dictionary const& metadata) -{ - Storage::the().set_data(data, mime_type, metadata.entries()); -} - -Messages::ClipboardServer::GetClipboardDataResponse ClientConnection::get_clipboard_data() -{ - auto& storage = Storage::the(); - return { storage.buffer(), storage.mime_type(), storage.metadata() }; -} - -void ClientConnection::notify_about_clipboard_change() -{ - async_clipboard_data_changed(Storage::the().mime_type()); -} - -} diff --git a/Userland/Services/Clipboard/ConnectionFromClient.cpp b/Userland/Services/Clipboard/ConnectionFromClient.cpp new file mode 100644 index 0000000000..9a26642357 --- /dev/null +++ b/Userland/Services/Clipboard/ConnectionFromClient.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2020, Andreas Kling <kling@serenityos.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include <Clipboard/ClipboardClientEndpoint.h> +#include <Clipboard/ConnectionFromClient.h> +#include <Clipboard/Storage.h> + +namespace Clipboard { + +static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; + +void ConnectionFromClient::for_each_client(Function<void(ConnectionFromClient&)> callback) +{ + for (auto& it : s_connections) { + callback(*it.value); + } +} + +ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket, int client_id) + : IPC::ConnectionFromClient<ClipboardClientEndpoint, ClipboardServerEndpoint>(*this, move(socket), client_id) +{ + s_connections.set(client_id, *this); +} + +ConnectionFromClient::~ConnectionFromClient() +{ +} + +void ConnectionFromClient::die() +{ + s_connections.remove(client_id()); +} + +void ConnectionFromClient::set_clipboard_data(Core::AnonymousBuffer const& data, String const& mime_type, IPC::Dictionary const& metadata) +{ + Storage::the().set_data(data, mime_type, metadata.entries()); +} + +Messages::ClipboardServer::GetClipboardDataResponse ConnectionFromClient::get_clipboard_data() +{ + auto& storage = Storage::the(); + return { storage.buffer(), storage.mime_type(), storage.metadata() }; +} + +void ConnectionFromClient::notify_about_clipboard_change() +{ + async_clipboard_data_changed(Storage::the().mime_type()); +} + +} diff --git a/Userland/Services/Clipboard/ClientConnection.h b/Userland/Services/Clipboard/ConnectionFromClient.h index 2ec5037f35..94f23a07f1 100644 --- a/Userland/Services/Clipboard/ClientConnection.h +++ b/Userland/Services/Clipboard/ConnectionFromClient.h @@ -9,25 +9,25 @@ #include <AK/HashMap.h> #include <Clipboard/ClipboardClientEndpoint.h> #include <Clipboard/ClipboardServerEndpoint.h> -#include <LibIPC/ClientConnection.h> +#include <LibIPC/ConnectionFromClient.h> namespace Clipboard { -class ClientConnection final - : public IPC::ClientConnection<ClipboardClientEndpoint, ClipboardServerEndpoint> { - C_OBJECT(ClientConnection); +class ConnectionFromClient final + : public IPC::ConnectionFromClient<ClipboardClientEndpoint, ClipboardServerEndpoint> { + C_OBJECT(ConnectionFromClient); public: - virtual ~ClientConnection() override; + virtual ~ConnectionFromClient() override; virtual void die() override; - static void for_each_client(Function<void(ClientConnection&)>); + static void for_each_client(Function<void(ConnectionFromClient&)>); void notify_about_clipboard_change(); private: - explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); + explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::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; diff --git a/Userland/Services/Clipboard/main.cpp b/Userland/Services/Clipboard/main.cpp index 3e087fcfd7..62f60aee92 100644 --- a/Userland/Services/Clipboard/main.cpp +++ b/Userland/Services/Clipboard/main.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include <Clipboard/ClientConnection.h> +#include <Clipboard/ConnectionFromClient.h> #include <Clipboard/Storage.h> #include <LibCore/EventLoop.h> #include <LibCore/System.h> @@ -17,10 +17,10 @@ ErrorOr<int> serenity_main(Main::Arguments) Core::EventLoop event_loop; TRY(Core::System::unveil(nullptr, nullptr)); - auto server = TRY(IPC::MultiServer<Clipboard::ClientConnection>::try_create()); + auto server = TRY(IPC::MultiServer<Clipboard::ConnectionFromClient>::try_create()); Clipboard::Storage::the().on_content_change = [&] { - Clipboard::ClientConnection::for_each_client([&](auto& client) { + Clipboard::ConnectionFromClient::for_each_client([&](auto& client) { client.notify_about_clipboard_change(); }); }; diff --git a/Userland/Services/ConfigServer/CMakeLists.txt b/Userland/Services/ConfigServer/CMakeLists.txt index 2cde832a98..a4d8776d08 100644 --- a/Userland/Services/ConfigServer/CMakeLists.txt +++ b/Userland/Services/ConfigServer/CMakeLists.txt @@ -8,7 +8,7 @@ compile_ipc(ConfigServer.ipc ConfigServerEndpoint.h) compile_ipc(ConfigClient.ipc ConfigClientEndpoint.h) set(SOURCES - ClientConnection.cpp + ConnectionFromClient.cpp main.cpp ConfigServerEndpoint.h ConfigClientEndpoint.h diff --git a/Userland/Services/ConfigServer/ClientConnection.cpp b/Userland/Services/ConfigServer/ConnectionFromClient.cpp index 135d1d18ca..ff5f29371b 100644 --- a/Userland/Services/ConfigServer/ClientConnection.cpp +++ b/Userland/Services/ConfigServer/ConnectionFromClient.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include "ClientConnection.h" +#include "ConnectionFromClient.h" #include <ConfigServer/ConfigClientEndpoint.h> #include <LibCore/ConfigFile.h> #include <LibCore/FileWatcher.h> @@ -12,7 +12,7 @@ namespace ConfigServer { -static HashMap<int, RefPtr<ClientConnection>> s_connections; +static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; struct CachedDomain { String domain; @@ -23,7 +23,7 @@ struct CachedDomain { static HashMap<String, NonnullOwnPtr<CachedDomain>> s_cache; static constexpr int s_disk_sync_delay_ms = 5'000; -static void for_each_monitoring_connection(String const& domain, ClientConnection* excluded_connection, Function<void(ClientConnection&)> callback) +static void for_each_monitoring_connection(String const& domain, ConnectionFromClient* excluded_connection, Function<void(ConnectionFromClient&)> callback) { for (auto& it : s_connections) { if (it.value->is_monitoring_domain(domain) && (!excluded_connection || it.value != excluded_connection)) @@ -48,7 +48,7 @@ static Core::ConfigFile& ensure_domain_config(String const& domain) for (auto& group : config->groups()) { for (auto& key : config->keys(group)) { if (!new_config->has_key(group, key)) { - for_each_monitoring_connection(domain, nullptr, [&domain, &group, &key](ClientConnection& connection) { + for_each_monitoring_connection(domain, nullptr, [&domain, &group, &key](ConnectionFromClient& connection) { connection.async_notify_removed_key(domain, group, key); }); } @@ -60,7 +60,7 @@ static Core::ConfigFile& ensure_domain_config(String const& domain) auto old_value = config->read_entry(group, key); auto new_value = new_config->read_entry(group, key); if (old_value != new_value) { - for_each_monitoring_connection(domain, nullptr, [&domain, &group, &key, &new_value](ClientConnection& connection) { + for_each_monitoring_connection(domain, nullptr, [&domain, &group, &key, &new_value](ConnectionFromClient& connection) { connection.async_notify_changed_string_value(domain, group, key, new_value); }); } @@ -74,25 +74,25 @@ static Core::ConfigFile& ensure_domain_config(String const& domain) return *config; } -ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id) - : IPC::ClientConnection<ConfigClientEndpoint, ConfigServerEndpoint>(*this, move(client_socket), client_id) +ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id) + : IPC::ConnectionFromClient<ConfigClientEndpoint, ConfigServerEndpoint>(*this, move(client_socket), client_id) , m_sync_timer(Core::Timer::create_single_shot(s_disk_sync_delay_ms, [this]() { sync_dirty_domains_to_disk(); })) { s_connections.set(client_id, *this); } -ClientConnection::~ClientConnection() +ConnectionFromClient::~ConnectionFromClient() { } -void ClientConnection::die() +void ConnectionFromClient::die() { s_connections.remove(client_id()); m_sync_timer->stop(); sync_dirty_domains_to_disk(); } -void ClientConnection::pledge_domains(Vector<String> const& domains) +void ConnectionFromClient::pledge_domains(Vector<String> const& domains) { if (m_has_pledged) { did_misbehave("Tried to pledge domains twice."); @@ -103,7 +103,7 @@ void ClientConnection::pledge_domains(Vector<String> const& domains) m_pledged_domains.set(domain); } -void ClientConnection::monitor_domain(String const& domain) +void ConnectionFromClient::monitor_domain(String const& domain) { if (m_has_pledged && !m_pledged_domains.contains(domain)) { did_misbehave("Attempt to monitor non-pledged domain"); @@ -113,7 +113,7 @@ void ClientConnection::monitor_domain(String const& domain) m_monitored_domains.set(domain); } -bool ClientConnection::validate_access(String const& domain, String const& group, String const& key) +bool ConnectionFromClient::validate_access(String const& domain, String const& group, String const& key) { if (!m_has_pledged) return true; @@ -123,7 +123,7 @@ bool ClientConnection::validate_access(String const& domain, String const& group return false; } -void ClientConnection::sync_dirty_domains_to_disk() +void ConnectionFromClient::sync_dirty_domains_to_disk() { if (m_dirty_domains.is_empty()) return; @@ -139,7 +139,7 @@ void ClientConnection::sync_dirty_domains_to_disk() } } -Messages::ConfigServer::ListConfigKeysResponse ClientConnection::list_config_keys(String const& domain, String const& group) +Messages::ConfigServer::ListConfigKeysResponse ConnectionFromClient::list_config_keys(String const& domain, String const& group) { if (!validate_access(domain, group, "")) return Vector<String> {}; @@ -147,7 +147,7 @@ Messages::ConfigServer::ListConfigKeysResponse ClientConnection::list_config_key return { config.keys(group) }; } -Messages::ConfigServer::ListConfigGroupsResponse ClientConnection::list_config_groups(String const& domain) +Messages::ConfigServer::ListConfigGroupsResponse ConnectionFromClient::list_config_groups(String const& domain) { if (!validate_access(domain, "", "")) return Vector<String> {}; @@ -155,7 +155,7 @@ Messages::ConfigServer::ListConfigGroupsResponse ClientConnection::list_config_g return { config.groups() }; } -Messages::ConfigServer::ReadStringValueResponse ClientConnection::read_string_value(String const& domain, String const& group, String const& key) +Messages::ConfigServer::ReadStringValueResponse ConnectionFromClient::read_string_value(String const& domain, String const& group, String const& key) { if (!validate_access(domain, group, key)) return nullptr; @@ -166,7 +166,7 @@ Messages::ConfigServer::ReadStringValueResponse ClientConnection::read_string_va return Optional<String> { config.read_entry(group, key) }; } -Messages::ConfigServer::ReadI32ValueResponse ClientConnection::read_i32_value(String const& domain, String const& group, String const& key) +Messages::ConfigServer::ReadI32ValueResponse ConnectionFromClient::read_i32_value(String const& domain, String const& group, String const& key) { if (!validate_access(domain, group, key)) return nullptr; @@ -177,7 +177,7 @@ Messages::ConfigServer::ReadI32ValueResponse ClientConnection::read_i32_value(St return Optional<i32> { config.read_num_entry(group, key) }; } -Messages::ConfigServer::ReadBoolValueResponse ClientConnection::read_bool_value(String const& domain, String const& group, String const& key) +Messages::ConfigServer::ReadBoolValueResponse ConnectionFromClient::read_bool_value(String const& domain, String const& group, String const& key) { if (!validate_access(domain, group, key)) return nullptr; @@ -188,7 +188,7 @@ Messages::ConfigServer::ReadBoolValueResponse ClientConnection::read_bool_value( return Optional<bool> { config.read_bool_entry(group, key) }; } -void ClientConnection::start_or_restart_sync_timer() +void ConnectionFromClient::start_or_restart_sync_timer() { if (m_sync_timer->is_active()) m_sync_timer->restart(); @@ -196,7 +196,7 @@ void ClientConnection::start_or_restart_sync_timer() m_sync_timer->start(); } -void ClientConnection::write_string_value(String const& domain, String const& group, String const& key, String const& value) +void ConnectionFromClient::write_string_value(String const& domain, String const& group, String const& key, String const& value) { if (!validate_access(domain, group, key)) return; @@ -210,12 +210,12 @@ void ClientConnection::write_string_value(String const& domain, String const& gr m_dirty_domains.set(domain); start_or_restart_sync_timer(); - for_each_monitoring_connection(domain, this, [&domain, &group, &key, &value](ClientConnection& connection) { + for_each_monitoring_connection(domain, this, [&domain, &group, &key, &value](ConnectionFromClient& connection) { connection.async_notify_changed_string_value(domain, group, key, value); }); } -void ClientConnection::write_i32_value(String const& domain, String const& group, String const& key, i32 value) +void ConnectionFromClient::write_i32_value(String const& domain, String const& group, String const& key, i32 value) { if (!validate_access(domain, group, key)) return; @@ -229,12 +229,12 @@ void ClientConnection::write_i32_value(String const& domain, String const& group m_dirty_domains.set(domain); start_or_restart_sync_timer(); - for_each_monitoring_connection(domain, this, [&domain, &group, &key, &value](ClientConnection& connection) { + for_each_monitoring_connection(domain, this, [&domain, &group, &key, &value](ConnectionFromClient& connection) { connection.async_notify_changed_i32_value(domain, group, key, value); }); } -void ClientConnection::write_bool_value(String const& domain, String const& group, String const& key, bool value) +void ConnectionFromClient::write_bool_value(String const& domain, String const& group, String const& key, bool value) { if (!validate_access(domain, group, key)) return; @@ -248,12 +248,12 @@ void ClientConnection::write_bool_value(String const& domain, String const& grou m_dirty_domains.set(domain); start_or_restart_sync_timer(); - for_each_monitoring_connection(domain, this, [&domain, &group, &key, &value](ClientConnection& connection) { + for_each_monitoring_connection(domain, this, [&domain, &group, &key, &value](ConnectionFromClient& connection) { connection.async_notify_changed_bool_value(domain, group, key, value); }); } -void ClientConnection::remove_key(String const& domain, String const& group, String const& key) +void ConnectionFromClient::remove_key(String const& domain, String const& group, String const& key) { if (!validate_access(domain, group, key)) return; @@ -266,7 +266,7 @@ void ClientConnection::remove_key(String const& domain, String const& group, Str m_dirty_domains.set(domain); start_or_restart_sync_timer(); - for_each_monitoring_connection(domain, this, [&domain, &group, &key](ClientConnection& connection) { + for_each_monitoring_connection(domain, this, [&domain, &group, &key](ConnectionFromClient& connection) { connection.async_notify_removed_key(domain, group, key); }); } diff --git a/Userland/Services/ConfigServer/ClientConnection.h b/Userland/Services/ConfigServer/ConnectionFromClient.h index 5ef35bf102..251d1ef567 100644 --- a/Userland/Services/ConfigServer/ClientConnection.h +++ b/Userland/Services/ConfigServer/ConnectionFromClient.h @@ -6,24 +6,24 @@ #pragma once -#include <LibIPC/ClientConnection.h> +#include <LibIPC/ConnectionFromClient.h> #include <ConfigServer/ConfigClientEndpoint.h> #include <ConfigServer/ConfigServerEndpoint.h> namespace ConfigServer { -class ClientConnection final : public IPC::ClientConnection<ConfigClientEndpoint, ConfigServerEndpoint> { - C_OBJECT(ClientConnection) +class ConnectionFromClient final : public IPC::ConnectionFromClient<ConfigClientEndpoint, ConfigServerEndpoint> { + C_OBJECT(ConnectionFromClient) public: - ~ClientConnection() override; + ~ConnectionFromClient() override; virtual void die() override; bool is_monitoring_domain(String const& domain) const { return m_monitored_domains.contains(domain); } private: - explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); + explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); virtual void pledge_domains(Vector<String> const&) override; virtual void monitor_domain(String const&) override; diff --git a/Userland/Services/ConfigServer/main.cpp b/Userland/Services/ConfigServer/main.cpp index 344e940a94..da08477e1c 100644 --- a/Userland/Services/ConfigServer/main.cpp +++ b/Userland/Services/ConfigServer/main.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include "ClientConnection.h" +#include "ConnectionFromClient.h" #include <LibCore/StandardPaths.h> #include <LibCore/System.h> #include <LibIPC/MultiServer.h> @@ -18,6 +18,6 @@ ErrorOr<int> serenity_main(Main::Arguments) Core::EventLoop event_loop; - auto server = TRY(IPC::MultiServer<ConfigServer::ClientConnection>::try_create()); + auto server = TRY(IPC::MultiServer<ConfigServer::ConnectionFromClient>::try_create()); return event_loop.exec(); } diff --git a/Userland/Services/FileSystemAccessServer/CMakeLists.txt b/Userland/Services/FileSystemAccessServer/CMakeLists.txt index e07afbe0d1..1b7a69ac11 100644 --- a/Userland/Services/FileSystemAccessServer/CMakeLists.txt +++ b/Userland/Services/FileSystemAccessServer/CMakeLists.txt @@ -8,7 +8,7 @@ compile_ipc(FileSystemAccessServer.ipc FileSystemAccessServerEndpoint.h) compile_ipc(FileSystemAccessClient.ipc FileSystemAccessClientEndpoint.h) set(SOURCES - ClientConnection.cpp + ConnectionFromClient.cpp main.cpp FileSystemAccessServerEndpoint.h FileSystemAccessClientEndpoint.h diff --git a/Userland/Services/FileSystemAccessServer/ClientConnection.cpp b/Userland/Services/FileSystemAccessServer/ConnectionFromClient.cpp index 6ce0800d04..48bbb2a548 100644 --- a/Userland/Services/FileSystemAccessServer/ClientConnection.cpp +++ b/Userland/Services/FileSystemAccessServer/ConnectionFromClient.cpp @@ -9,7 +9,7 @@ #include <LibGUI/WindowServerConnection.h> // clang-format on #include <AK/Debug.h> -#include <FileSystemAccessServer/ClientConnection.h> +#include <FileSystemAccessServer/ConnectionFromClient.h> #include <LibCore/File.h> #include <LibCore/IODevice.h> #include <LibGUI/Application.h> @@ -18,25 +18,25 @@ namespace FileSystemAccessServer { -static HashMap<int, NonnullRefPtr<ClientConnection>> s_connections; +static HashMap<int, NonnullRefPtr<ConnectionFromClient>> s_connections; -ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket) - : IPC::ClientConnection<FileSystemAccessClientEndpoint, FileSystemAccessServerEndpoint>(*this, move(socket), 1) +ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket) + : IPC::ConnectionFromClient<FileSystemAccessClientEndpoint, FileSystemAccessServerEndpoint>(*this, move(socket), 1) { s_connections.set(1, *this); } -ClientConnection::~ClientConnection() +ConnectionFromClient::~ConnectionFromClient() { } -void ClientConnection::die() +void ConnectionFromClient::die() { s_connections.remove(client_id()); GUI::Application::the()->quit(); } -RefPtr<GUI::Window> ClientConnection::create_dummy_child_window(i32 window_server_client_id, i32 parent_window_id) +RefPtr<GUI::Window> ConnectionFromClient::create_dummy_child_window(i32 window_server_client_id, i32 parent_window_id) { auto window = GUI::Window::construct(); window->set_opacity(0); @@ -49,7 +49,7 @@ RefPtr<GUI::Window> ClientConnection::create_dummy_child_window(i32 window_serve return window; } -void ClientConnection::request_file_handler(i32 window_server_client_id, i32 parent_window_id, String const& path, Core::OpenMode const& requested_access, ShouldPrompt prompt) +void ConnectionFromClient::request_file_handler(i32 window_server_client_id, i32 parent_window_id, String const& path, Core::OpenMode const& requested_access, ShouldPrompt prompt) { VERIFY(path.starts_with("/"sv)); @@ -110,17 +110,17 @@ void ClientConnection::request_file_handler(i32 window_server_client_id, i32 par } } -void ClientConnection::request_file_read_only_approved(i32 window_server_client_id, i32 parent_window_id, String const& path) +void ConnectionFromClient::request_file_read_only_approved(i32 window_server_client_id, i32 parent_window_id, String const& path) { request_file_handler(window_server_client_id, parent_window_id, path, Core::OpenMode::ReadOnly, ShouldPrompt::No); } -void ClientConnection::request_file(i32 window_server_client_id, i32 parent_window_id, String const& path, Core::OpenMode const& requested_access) +void ConnectionFromClient::request_file(i32 window_server_client_id, i32 parent_window_id, String const& path, Core::OpenMode const& requested_access) { request_file_handler(window_server_client_id, parent_window_id, path, requested_access, ShouldPrompt::Yes); } -void ClientConnection::prompt_open_file(i32 window_server_client_id, i32 parent_window_id, String const& window_title, String const& path_to_view, Core::OpenMode const& requested_access) +void ConnectionFromClient::prompt_open_file(i32 window_server_client_id, i32 parent_window_id, String const& window_title, String const& path_to_view, Core::OpenMode const& requested_access) { auto relevant_permissions = requested_access & (Core::OpenMode::ReadOnly | Core::OpenMode::WriteOnly); VERIFY(relevant_permissions != Core::OpenMode::NotOpen); @@ -132,7 +132,7 @@ void ClientConnection::prompt_open_file(i32 window_server_client_id, i32 parent_ prompt_helper(user_picked_file, requested_access); } -void ClientConnection::prompt_save_file(i32 window_server_client_id, i32 parent_window_id, String const& name, String const& ext, String const& path_to_view, Core::OpenMode const& requested_access) +void ConnectionFromClient::prompt_save_file(i32 window_server_client_id, i32 parent_window_id, String const& name, String const& ext, String const& path_to_view, Core::OpenMode const& requested_access) { auto relevant_permissions = requested_access & (Core::OpenMode::ReadOnly | Core::OpenMode::WriteOnly); VERIFY(relevant_permissions != Core::OpenMode::NotOpen); @@ -144,7 +144,7 @@ void ClientConnection::prompt_save_file(i32 window_server_client_id, i32 parent_ prompt_helper(user_picked_file, requested_access); } -void ClientConnection::prompt_helper(Optional<String> const& user_picked_file, Core::OpenMode const& requested_access) +void ConnectionFromClient::prompt_helper(Optional<String> const& user_picked_file, Core::OpenMode const& requested_access) { if (user_picked_file.has_value()) { VERIFY(user_picked_file->starts_with("/"sv)); @@ -169,7 +169,7 @@ void ClientConnection::prompt_helper(Optional<String> const& user_picked_file, C } } -Messages::FileSystemAccessServer::ExposeWindowServerClientIdResponse ClientConnection::expose_window_server_client_id() +Messages::FileSystemAccessServer::ExposeWindowServerClientIdResponse ConnectionFromClient::expose_window_server_client_id() { return GUI::WindowServerConnection::the().expose_client_id(); } diff --git a/Userland/Services/FileSystemAccessServer/ClientConnection.h b/Userland/Services/FileSystemAccessServer/ConnectionFromClient.h index 00c1d2ef6e..59c0abae26 100644 --- a/Userland/Services/FileSystemAccessServer/ClientConnection.h +++ b/Userland/Services/FileSystemAccessServer/ConnectionFromClient.h @@ -11,21 +11,21 @@ #include <FileSystemAccessServer/FileSystemAccessServerEndpoint.h> #include <LibCore/Forward.h> #include <LibGUI/Forward.h> -#include <LibIPC/ClientConnection.h> +#include <LibIPC/ConnectionFromClient.h> namespace FileSystemAccessServer { -class ClientConnection final - : public IPC::ClientConnection<FileSystemAccessClientEndpoint, FileSystemAccessServerEndpoint> { - C_OBJECT(ClientConnection); +class ConnectionFromClient final + : public IPC::ConnectionFromClient<FileSystemAccessClientEndpoint, FileSystemAccessServerEndpoint> { + C_OBJECT(ConnectionFromClient); public: - ~ClientConnection() override; + ~ConnectionFromClient() override; virtual void die() override; private: - explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>); + explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>); virtual void request_file_read_only_approved(i32, i32, String const&) override; virtual void request_file(i32, i32, String const&, Core::OpenMode const&) override; diff --git a/Userland/Services/FileSystemAccessServer/main.cpp b/Userland/Services/FileSystemAccessServer/main.cpp index ecdcc984ba..8a1476d688 100644 --- a/Userland/Services/FileSystemAccessServer/main.cpp +++ b/Userland/Services/FileSystemAccessServer/main.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include <FileSystemAccessServer/ClientConnection.h> +#include <FileSystemAccessServer/ConnectionFromClient.h> #include <LibCore/System.h> #include <LibGUI/Application.h> #include <LibIPC/SingleServer.h> @@ -17,6 +17,6 @@ ErrorOr<int> serenity_main(Main::Arguments) auto app = GUI::Application::construct(0, nullptr); app->set_quit_when_last_window_deleted(false); - auto client = TRY(IPC::take_over_accepted_client_from_system_server<FileSystemAccessServer::ClientConnection>()); + auto client = TRY(IPC::take_over_accepted_client_from_system_server<FileSystemAccessServer::ConnectionFromClient>()); return app->exec(); } diff --git a/Userland/Services/ImageDecoder/CMakeLists.txt b/Userland/Services/ImageDecoder/CMakeLists.txt index 16f6609ab6..ac26ae37c6 100644 --- a/Userland/Services/ImageDecoder/CMakeLists.txt +++ b/Userland/Services/ImageDecoder/CMakeLists.txt @@ -7,7 +7,7 @@ compile_ipc(ImageDecoderServer.ipc ImageDecoderServerEndpoint.h) compile_ipc(ImageDecoderClient.ipc ImageDecoderClientEndpoint.h) set(SOURCES - ClientConnection.cpp + ConnectionFromClient.cpp main.cpp ImageDecoderServerEndpoint.h ImageDecoderClientEndpoint.h diff --git a/Userland/Services/ImageDecoder/ClientConnection.cpp b/Userland/Services/ImageDecoder/ConnectionFromClient.cpp index b9199aa9d5..6911b3c0a7 100644 --- a/Userland/Services/ImageDecoder/ClientConnection.cpp +++ b/Userland/Services/ImageDecoder/ConnectionFromClient.cpp @@ -5,28 +5,28 @@ */ #include <AK/Debug.h> -#include <ImageDecoder/ClientConnection.h> +#include <ImageDecoder/ConnectionFromClient.h> #include <ImageDecoder/ImageDecoderClientEndpoint.h> #include <LibGfx/Bitmap.h> #include <LibGfx/ImageDecoder.h> namespace ImageDecoder { -ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket) - : IPC::ClientConnection<ImageDecoderClientEndpoint, ImageDecoderServerEndpoint>(*this, move(socket), 1) +ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket) + : IPC::ConnectionFromClient<ImageDecoderClientEndpoint, ImageDecoderServerEndpoint>(*this, move(socket), 1) { } -ClientConnection::~ClientConnection() +ConnectionFromClient::~ConnectionFromClient() { } -void ClientConnection::die() +void ConnectionFromClient::die() { Core::EventLoop::current().quit(0); } -Messages::ImageDecoderServer::DecodeImageResponse ClientConnection::decode_image(Core::AnonymousBuffer const& encoded_buffer) +Messages::ImageDecoderServer::DecodeImageResponse ConnectionFromClient::decode_image(Core::AnonymousBuffer const& encoded_buffer) { if (!encoded_buffer.is_valid()) { dbgln_if(IMAGE_DECODER_DEBUG, "Encoded data is invalid"); diff --git a/Userland/Services/ImageDecoder/ClientConnection.h b/Userland/Services/ImageDecoder/ConnectionFromClient.h index 960627c8b4..7365dfe702 100644 --- a/Userland/Services/ImageDecoder/ClientConnection.h +++ b/Userland/Services/ImageDecoder/ConnectionFromClient.h @@ -10,22 +10,22 @@ #include <ImageDecoder/Forward.h> #include <ImageDecoder/ImageDecoderClientEndpoint.h> #include <ImageDecoder/ImageDecoderServerEndpoint.h> -#include <LibIPC/ClientConnection.h> +#include <LibIPC/ConnectionFromClient.h> #include <LibWeb/Forward.h> namespace ImageDecoder { -class ClientConnection final - : public IPC::ClientConnection<ImageDecoderClientEndpoint, ImageDecoderServerEndpoint> { - C_OBJECT(ClientConnection); +class ConnectionFromClient final + : public IPC::ConnectionFromClient<ImageDecoderClientEndpoint, ImageDecoderServerEndpoint> { + C_OBJECT(ConnectionFromClient); public: - ~ClientConnection() override; + ~ConnectionFromClient() override; virtual void die() override; private: - explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>); + explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>); virtual Messages::ImageDecoderServer::DecodeImageResponse decode_image(Core::AnonymousBuffer const&) override; }; diff --git a/Userland/Services/ImageDecoder/Forward.h b/Userland/Services/ImageDecoder/Forward.h index c687713ec8..8490d20a3e 100644 --- a/Userland/Services/ImageDecoder/Forward.h +++ b/Userland/Services/ImageDecoder/Forward.h @@ -8,7 +8,7 @@ namespace WebContent { -class ClientConnection; +class ConnectionFromClient; class PageHost; } diff --git a/Userland/Services/ImageDecoder/main.cpp b/Userland/Services/ImageDecoder/main.cpp index d43f16f650..8a41cf7946 100644 --- a/Userland/Services/ImageDecoder/main.cpp +++ b/Userland/Services/ImageDecoder/main.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include <ImageDecoder/ClientConnection.h> +#include <ImageDecoder/ConnectionFromClient.h> #include <LibCore/EventLoop.h> #include <LibCore/System.h> #include <LibIPC/SingleServer.h> @@ -16,7 +16,7 @@ ErrorOr<int> serenity_main(Main::Arguments) TRY(Core::System::pledge("stdio recvfd sendfd unix")); TRY(Core::System::unveil(nullptr, nullptr)); - auto client = TRY(IPC::take_over_accepted_client_from_system_server<ImageDecoder::ClientConnection>()); + auto client = TRY(IPC::take_over_accepted_client_from_system_server<ImageDecoder::ConnectionFromClient>()); TRY(Core::System::pledge("stdio recvfd sendfd")); return event_loop.exec(); diff --git a/Userland/Services/InspectorServer/CMakeLists.txt b/Userland/Services/InspectorServer/CMakeLists.txt index c3a87b266b..2459a6360b 100644 --- a/Userland/Services/InspectorServer/CMakeLists.txt +++ b/Userland/Services/InspectorServer/CMakeLists.txt @@ -8,7 +8,7 @@ compile_ipc(InspectorServer.ipc InspectorServerEndpoint.h) compile_ipc(InspectorClient.ipc InspectorClientEndpoint.h) set(SOURCES - ClientConnection.cpp + ConnectionFromClient.cpp main.cpp InspectableProcess.cpp InspectorServerEndpoint.h diff --git a/Userland/Services/InspectorServer/ClientConnection.cpp b/Userland/Services/InspectorServer/ConnectionFromClient.cpp index ee5346b951..db51a87729 100644 --- a/Userland/Services/InspectorServer/ClientConnection.cpp +++ b/Userland/Services/InspectorServer/ConnectionFromClient.cpp @@ -6,28 +6,28 @@ #include "InspectableProcess.h" #include <AK/JsonObject.h> -#include <InspectorServer/ClientConnection.h> +#include <InspectorServer/ConnectionFromClient.h> namespace InspectorServer { -static HashMap<int, RefPtr<ClientConnection>> s_connections; +static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; -ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket, int client_id) - : IPC::ClientConnection<InspectorClientEndpoint, InspectorServerEndpoint>(*this, move(socket), client_id) +ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket, int client_id) + : IPC::ConnectionFromClient<InspectorClientEndpoint, InspectorServerEndpoint>(*this, move(socket), client_id) { s_connections.set(client_id, *this); } -ClientConnection::~ClientConnection() +ConnectionFromClient::~ConnectionFromClient() { } -void ClientConnection::die() +void ConnectionFromClient::die() { s_connections.remove(client_id()); } -Messages::InspectorServer::GetAllObjectsResponse ClientConnection::get_all_objects(pid_t pid) +Messages::InspectorServer::GetAllObjectsResponse ConnectionFromClient::get_all_objects(pid_t pid) { auto process = InspectableProcess::from_pid(pid); if (!process) @@ -40,7 +40,7 @@ Messages::InspectorServer::GetAllObjectsResponse ClientConnection::get_all_objec return response; } -Messages::InspectorServer::SetInspectedObjectResponse ClientConnection::set_inspected_object(pid_t pid, u64 object_id) +Messages::InspectorServer::SetInspectedObjectResponse ConnectionFromClient::set_inspected_object(pid_t pid, u64 object_id) { auto process = InspectableProcess::from_pid(pid); if (!process) @@ -53,7 +53,7 @@ Messages::InspectorServer::SetInspectedObjectResponse ClientConnection::set_insp return true; } -Messages::InspectorServer::SetObjectPropertyResponse ClientConnection::set_object_property(pid_t pid, u64 object_id, String const& name, String const& value) +Messages::InspectorServer::SetObjectPropertyResponse ConnectionFromClient::set_object_property(pid_t pid, u64 object_id, String const& name, String const& value) { auto process = InspectableProcess::from_pid(pid); if (!process) @@ -68,7 +68,7 @@ Messages::InspectorServer::SetObjectPropertyResponse ClientConnection::set_objec return true; } -Messages::InspectorServer::IdentifyResponse ClientConnection::identify(pid_t pid) +Messages::InspectorServer::IdentifyResponse ConnectionFromClient::identify(pid_t pid) { auto process = InspectableProcess::from_pid(pid); if (!process) @@ -81,7 +81,7 @@ Messages::InspectorServer::IdentifyResponse ClientConnection::identify(pid_t pid return response; } -Messages::InspectorServer::IsInspectableResponse ClientConnection::is_inspectable(pid_t pid) +Messages::InspectorServer::IsInspectableResponse ConnectionFromClient::is_inspectable(pid_t pid) { auto process = InspectableProcess::from_pid(pid); if (!process) diff --git a/Userland/Services/InspectorServer/ClientConnection.h b/Userland/Services/InspectorServer/ConnectionFromClient.h index e90086683e..c279dcd311 100644 --- a/Userland/Services/InspectorServer/ClientConnection.h +++ b/Userland/Services/InspectorServer/ConnectionFromClient.h @@ -9,21 +9,21 @@ #include <AK/HashMap.h> #include <InspectorServer/InspectorClientEndpoint.h> #include <InspectorServer/InspectorServerEndpoint.h> -#include <LibIPC/ClientConnection.h> +#include <LibIPC/ConnectionFromClient.h> namespace InspectorServer { -class ClientConnection final - : public IPC::ClientConnection<InspectorClientEndpoint, InspectorServerEndpoint> { - C_OBJECT(ClientConnection); +class ConnectionFromClient final + : public IPC::ConnectionFromClient<InspectorClientEndpoint, InspectorServerEndpoint> { + C_OBJECT(ConnectionFromClient); public: - ~ClientConnection() override; + ~ConnectionFromClient() override; virtual void die() override; private: - explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); + explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::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; diff --git a/Userland/Services/InspectorServer/Forward.h b/Userland/Services/InspectorServer/Forward.h index 97cdfba43c..d9afd43ae2 100644 --- a/Userland/Services/InspectorServer/Forward.h +++ b/Userland/Services/InspectorServer/Forward.h @@ -8,6 +8,6 @@ namespace SymbolServer { -class ClientConnection; +class ConnectionFromClient; } diff --git a/Userland/Services/InspectorServer/main.cpp b/Userland/Services/InspectorServer/main.cpp index 316238ef4c..e5055777a0 100644 --- a/Userland/Services/InspectorServer/main.cpp +++ b/Userland/Services/InspectorServer/main.cpp @@ -5,11 +5,11 @@ */ #include "InspectableProcess.h" -#include <InspectorServer/ClientConnection.h> +#include <InspectorServer/ConnectionFromClient.h> #include <LibCore/EventLoop.h> #include <LibCore/LocalServer.h> #include <LibCore/System.h> -#include <LibIPC/ClientConnection.h> +#include <LibIPC/ConnectionFromClient.h> #include <LibIPC/MultiServer.h> #include <LibMain/Main.h> @@ -19,7 +19,7 @@ ErrorOr<int> serenity_main(Main::Arguments) TRY(Core::System::pledge("stdio unix accept")); - auto server = TRY(IPC::MultiServer<InspectorServer::ClientConnection>::try_create("/tmp/portal/inspector")); + auto server = TRY(IPC::MultiServer<InspectorServer::ConnectionFromClient>::try_create("/tmp/portal/inspector")); auto inspectables_server = TRY(Core::LocalServer::try_create()); TRY(inspectables_server->take_over_from_system_server("/tmp/portal/inspectables")); diff --git a/Userland/Services/LaunchServer/CMakeLists.txt b/Userland/Services/LaunchServer/CMakeLists.txt index 02c05dfaa4..89727d9bf7 100644 --- a/Userland/Services/LaunchServer/CMakeLists.txt +++ b/Userland/Services/LaunchServer/CMakeLists.txt @@ -8,7 +8,7 @@ compile_ipc(LaunchServer.ipc LaunchServerEndpoint.h) compile_ipc(LaunchClient.ipc LaunchClientEndpoint.h) set(SOURCES - ClientConnection.cpp + ConnectionFromClient.cpp Launcher.cpp main.cpp LaunchClientEndpoint.h diff --git a/Userland/Services/LaunchServer/ClientConnection.cpp b/Userland/Services/LaunchServer/ConnectionFromClient.cpp index 5cd7dc2f9a..1d515b0dbf 100644 --- a/Userland/Services/LaunchServer/ClientConnection.cpp +++ b/Userland/Services/LaunchServer/ConnectionFromClient.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include "ClientConnection.h" +#include "ConnectionFromClient.h" #include "Launcher.h" #include <AK/HashMap.h> #include <AK/URL.h> @@ -12,23 +12,23 @@ namespace LaunchServer { -static HashMap<int, RefPtr<ClientConnection>> s_connections; -ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id) - : IPC::ClientConnection<LaunchClientEndpoint, LaunchServerEndpoint>(*this, move(client_socket), client_id) +static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; +ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id) + : IPC::ConnectionFromClient<LaunchClientEndpoint, LaunchServerEndpoint>(*this, move(client_socket), client_id) { s_connections.set(client_id, *this); } -ClientConnection::~ClientConnection() +ConnectionFromClient::~ConnectionFromClient() { } -void ClientConnection::die() +void ConnectionFromClient::die() { s_connections.remove(client_id()); } -Messages::LaunchServer::OpenUrlResponse ClientConnection::open_url(URL const& url, String const& handler_name) +Messages::LaunchServer::OpenUrlResponse ConnectionFromClient::open_url(URL const& url, String const& handler_name) { if (!m_allowlist.is_empty()) { bool allowed = false; @@ -51,17 +51,17 @@ Messages::LaunchServer::OpenUrlResponse ClientConnection::open_url(URL const& ur return Launcher::the().open_url(url, handler_name); } -Messages::LaunchServer::GetHandlersForUrlResponse ClientConnection::get_handlers_for_url(URL const& url) +Messages::LaunchServer::GetHandlersForUrlResponse ConnectionFromClient::get_handlers_for_url(URL const& url) { return Launcher::the().handlers_for_url(url); } -Messages::LaunchServer::GetHandlersWithDetailsForUrlResponse ClientConnection::get_handlers_with_details_for_url(URL const& url) +Messages::LaunchServer::GetHandlersWithDetailsForUrlResponse ConnectionFromClient::get_handlers_with_details_for_url(URL const& url) { return Launcher::the().handlers_with_details_for_url(url); } -void ClientConnection::add_allowed_url(URL const& url) +void ConnectionFromClient::add_allowed_url(URL const& url) { if (m_allowlist_is_sealed) { did_misbehave("Got request to add more allowed handlers after list was sealed"); @@ -76,7 +76,7 @@ void ClientConnection::add_allowed_url(URL const& url) m_allowlist.empend(String(), false, Vector<URL> { url }); } -void ClientConnection::add_allowed_handler_with_any_url(String const& handler_name) +void ConnectionFromClient::add_allowed_handler_with_any_url(String const& handler_name) { if (m_allowlist_is_sealed) { did_misbehave("Got request to add more allowed handlers after list was sealed"); @@ -91,7 +91,7 @@ void ClientConnection::add_allowed_handler_with_any_url(String const& handler_na m_allowlist.empend(handler_name, true, Vector<URL>()); } -void ClientConnection::add_allowed_handler_with_only_specific_urls(String const& handler_name, Vector<URL> const& urls) +void ConnectionFromClient::add_allowed_handler_with_only_specific_urls(String const& handler_name, Vector<URL> const& urls) { if (m_allowlist_is_sealed) { did_misbehave("Got request to add more allowed handlers after list was sealed"); @@ -111,7 +111,7 @@ void ClientConnection::add_allowed_handler_with_only_specific_urls(String const& m_allowlist.empend(handler_name, false, urls); } -void ClientConnection::seal_allowlist() +void ConnectionFromClient::seal_allowlist() { if (m_allowlist_is_sealed) { did_misbehave("Got more than one request to seal the allowed handlers list"); diff --git a/Userland/Services/LaunchServer/ClientConnection.h b/Userland/Services/LaunchServer/ConnectionFromClient.h index cdee50f58c..3e50997802 100644 --- a/Userland/Services/LaunchServer/ClientConnection.h +++ b/Userland/Services/LaunchServer/ConnectionFromClient.h @@ -8,19 +8,19 @@ #include <LaunchServer/LaunchClientEndpoint.h> #include <LaunchServer/LaunchServerEndpoint.h> -#include <LibIPC/ClientConnection.h> +#include <LibIPC/ConnectionFromClient.h> namespace LaunchServer { -class ClientConnection final : public IPC::ClientConnection<LaunchClientEndpoint, LaunchServerEndpoint> { - C_OBJECT(ClientConnection) +class ConnectionFromClient final : public IPC::ConnectionFromClient<LaunchClientEndpoint, LaunchServerEndpoint> { + C_OBJECT(ConnectionFromClient) public: - ~ClientConnection() override; + ~ConnectionFromClient() override; virtual void die() override; private: - explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); + explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); virtual Messages::LaunchServer::OpenUrlResponse open_url(URL const&, String const&) override; virtual Messages::LaunchServer::GetHandlersForUrlResponse get_handlers_for_url(URL const&) override; diff --git a/Userland/Services/LaunchServer/main.cpp b/Userland/Services/LaunchServer/main.cpp index a9c08060d6..d23e27c2be 100644 --- a/Userland/Services/LaunchServer/main.cpp +++ b/Userland/Services/LaunchServer/main.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include "ClientConnection.h" +#include "ConnectionFromClient.h" #include "Launcher.h" #include <LibCore/ConfigFile.h> #include <LibCore/EventLoop.h> @@ -15,7 +15,7 @@ ErrorOr<int> serenity_main(Main::Arguments) { Core::EventLoop event_loop; - auto server = TRY(IPC::MultiServer<LaunchServer::ClientConnection>::try_create()); + auto server = TRY(IPC::MultiServer<LaunchServer::ConnectionFromClient>::try_create()); auto launcher = LaunchServer::Launcher(); launcher.load_handlers(); diff --git a/Userland/Services/LookupServer/CMakeLists.txt b/Userland/Services/LookupServer/CMakeLists.txt index 8e2a4f42bd..05187fb073 100644 --- a/Userland/Services/LookupServer/CMakeLists.txt +++ b/Userland/Services/LookupServer/CMakeLists.txt @@ -15,7 +15,7 @@ set(SOURCES LookupServer.cpp LookupServerEndpoint.h LookupClientEndpoint.h - ClientConnection.cpp + ConnectionFromClient.cpp MulticastDNS.cpp main.cpp ) diff --git a/Userland/Services/LookupServer/ClientConnection.cpp b/Userland/Services/LookupServer/ConnectionFromClient.cpp index 273ca96873..4617f8b1f7 100644 --- a/Userland/Services/LookupServer/ClientConnection.cpp +++ b/Userland/Services/LookupServer/ConnectionFromClient.cpp @@ -4,31 +4,31 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include "ClientConnection.h" +#include "ConnectionFromClient.h" #include "DNSPacket.h" #include "LookupServer.h" #include <AK/IPv4Address.h> namespace LookupServer { -static HashMap<int, RefPtr<ClientConnection>> s_connections; +static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; -ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket, int client_id) - : IPC::ClientConnection<LookupClientEndpoint, LookupServerEndpoint>(*this, move(socket), client_id) +ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket, int client_id) + : IPC::ConnectionFromClient<LookupClientEndpoint, LookupServerEndpoint>(*this, move(socket), client_id) { s_connections.set(client_id, *this); } -ClientConnection::~ClientConnection() +ConnectionFromClient::~ConnectionFromClient() { } -void ClientConnection::die() +void ConnectionFromClient::die() { s_connections.remove(client_id()); } -Messages::LookupServer::LookupNameResponse ClientConnection::lookup_name(String const& name) +Messages::LookupServer::LookupNameResponse ConnectionFromClient::lookup_name(String const& name) { auto maybe_answers = LookupServer::the().lookup(name, DNSRecordType::A); if (maybe_answers.is_error()) { @@ -43,7 +43,7 @@ Messages::LookupServer::LookupNameResponse ClientConnection::lookup_name(String return { 0, move(addresses) }; } -Messages::LookupServer::LookupAddressResponse ClientConnection::lookup_address(String const& address) +Messages::LookupServer::LookupAddressResponse ConnectionFromClient::lookup_address(String const& address) { if (address.length() != 4) return { 1, String() }; diff --git a/Userland/Services/LookupServer/ClientConnection.h b/Userland/Services/LookupServer/ConnectionFromClient.h index a9299e2889..72ded551b2 100644 --- a/Userland/Services/LookupServer/ClientConnection.h +++ b/Userland/Services/LookupServer/ConnectionFromClient.h @@ -7,23 +7,23 @@ #pragma once #include <AK/HashMap.h> -#include <LibIPC/ClientConnection.h> +#include <LibIPC/ConnectionFromClient.h> #include <LookupServer/LookupClientEndpoint.h> #include <LookupServer/LookupServerEndpoint.h> namespace LookupServer { -class ClientConnection final - : public IPC::ClientConnection<LookupClientEndpoint, LookupServerEndpoint> { - C_OBJECT(ClientConnection); +class ConnectionFromClient final + : public IPC::ConnectionFromClient<LookupClientEndpoint, LookupServerEndpoint> { + C_OBJECT(ConnectionFromClient); public: - virtual ~ClientConnection() override; + virtual ~ConnectionFromClient() override; virtual void die() override; private: - explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); + explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); virtual Messages::LookupServer::LookupNameResponse lookup_name(String const&) override; virtual Messages::LookupServer::LookupAddressResponse lookup_address(String const&) override; diff --git a/Userland/Services/LookupServer/LookupServer.cpp b/Userland/Services/LookupServer/LookupServer.cpp index 0edaeb6d54..5d9335c938 100644 --- a/Userland/Services/LookupServer/LookupServer.cpp +++ b/Userland/Services/LookupServer/LookupServer.cpp @@ -5,7 +5,7 @@ */ #include "LookupServer.h" -#include "ClientConnection.h" +#include "ConnectionFromClient.h" #include "DNSPacket.h" #include <AK/Debug.h> #include <AK/HashMap.h> @@ -72,7 +72,7 @@ LookupServer::LookupServer() } m_mdns = MulticastDNS::construct(this); - m_server = MUST(IPC::MultiServer<ClientConnection>::try_create()); + m_server = MUST(IPC::MultiServer<ConnectionFromClient>::try_create()); } void LookupServer::load_etc_hosts() diff --git a/Userland/Services/LookupServer/LookupServer.h b/Userland/Services/LookupServer/LookupServer.h index 829d0e5c95..88c7fcc740 100644 --- a/Userland/Services/LookupServer/LookupServer.h +++ b/Userland/Services/LookupServer/LookupServer.h @@ -6,7 +6,7 @@ #pragma once -#include "ClientConnection.h" +#include "ConnectionFromClient.h" #include "DNSName.h" #include "DNSPacket.h" #include "DNSServer.h" @@ -34,7 +34,7 @@ private: ErrorOr<Vector<DNSAnswer>> lookup(const DNSName& hostname, const String& nameserver, bool& did_get_response, DNSRecordType record_type, ShouldRandomizeCase = ShouldRandomizeCase::Yes); - OwnPtr<IPC::MultiServer<ClientConnection>> m_server; + OwnPtr<IPC::MultiServer<ConnectionFromClient>> m_server; RefPtr<DNSServer> m_dns_server; RefPtr<MulticastDNS> m_mdns; Vector<String> m_nameservers; diff --git a/Userland/Services/NotificationServer/CMakeLists.txt b/Userland/Services/NotificationServer/CMakeLists.txt index e76c52dcb7..de61a0f3b9 100644 --- a/Userland/Services/NotificationServer/CMakeLists.txt +++ b/Userland/Services/NotificationServer/CMakeLists.txt @@ -8,7 +8,7 @@ compile_ipc(NotificationServer.ipc NotificationServerEndpoint.h) compile_ipc(NotificationClient.ipc NotificationClientEndpoint.h) set(SOURCES - ClientConnection.cpp + ConnectionFromClient.cpp main.cpp NotificationWindow.cpp NotificationServerEndpoint.h diff --git a/Userland/Services/NotificationServer/ClientConnection.cpp b/Userland/Services/NotificationServer/ConnectionFromClient.cpp index 394284a5b4..5b779b4463 100644 --- a/Userland/Services/NotificationServer/ClientConnection.cpp +++ b/Userland/Services/NotificationServer/ConnectionFromClient.cpp @@ -4,37 +4,37 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include "ClientConnection.h" +#include "ConnectionFromClient.h" #include "NotificationWindow.h" #include <AK/HashMap.h> #include <NotificationServer/NotificationClientEndpoint.h> namespace NotificationServer { -static HashMap<int, RefPtr<ClientConnection>> s_connections; +static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; -ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id) - : IPC::ClientConnection<NotificationClientEndpoint, NotificationServerEndpoint>(*this, move(client_socket), client_id) +ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id) + : IPC::ConnectionFromClient<NotificationClientEndpoint, NotificationServerEndpoint>(*this, move(client_socket), client_id) { s_connections.set(client_id, *this); } -ClientConnection::~ClientConnection() +ConnectionFromClient::~ConnectionFromClient() { } -void ClientConnection::die() +void ConnectionFromClient::die() { s_connections.remove(client_id()); } -void ClientConnection::show_notification(String const& text, String const& title, Gfx::ShareableBitmap const& icon) +void ConnectionFromClient::show_notification(String const& text, String const& title, Gfx::ShareableBitmap const& icon) { auto window = NotificationWindow::construct(client_id(), text, title, icon); window->show(); } -void ClientConnection::close_notification() +void ConnectionFromClient::close_notification() { auto window = NotificationWindow::get_window_by_id(client_id()); if (window) { @@ -42,7 +42,7 @@ void ClientConnection::close_notification() } } -Messages::NotificationServer::UpdateNotificationIconResponse ClientConnection::update_notification_icon(Gfx::ShareableBitmap const& icon) +Messages::NotificationServer::UpdateNotificationIconResponse ConnectionFromClient::update_notification_icon(Gfx::ShareableBitmap const& icon) { auto window = NotificationWindow::get_window_by_id(client_id()); if (window) { @@ -51,7 +51,7 @@ Messages::NotificationServer::UpdateNotificationIconResponse ClientConnection::u return !!window; } -Messages::NotificationServer::UpdateNotificationTextResponse ClientConnection::update_notification_text(String const& text, String const& title) +Messages::NotificationServer::UpdateNotificationTextResponse ConnectionFromClient::update_notification_text(String const& text, String const& title) { auto window = NotificationWindow::get_window_by_id(client_id()); if (window) { @@ -61,7 +61,7 @@ Messages::NotificationServer::UpdateNotificationTextResponse ClientConnection::u return !!window; } -Messages::NotificationServer::IsShowingResponse ClientConnection::is_showing() +Messages::NotificationServer::IsShowingResponse ConnectionFromClient::is_showing() { auto window = NotificationWindow::get_window_by_id(client_id()); return !!window; diff --git a/Userland/Services/NotificationServer/ClientConnection.h b/Userland/Services/NotificationServer/ConnectionFromClient.h index b01706d8ef..ed1c4af83d 100644 --- a/Userland/Services/NotificationServer/ClientConnection.h +++ b/Userland/Services/NotificationServer/ConnectionFromClient.h @@ -6,7 +6,7 @@ #pragma once -#include <LibIPC/ClientConnection.h> +#include <LibIPC/ConnectionFromClient.h> #include <WindowServer/ScreenLayout.h> // Must be included after WindowServer/ScreenLayout.h @@ -15,15 +15,15 @@ namespace NotificationServer { -class ClientConnection final : public IPC::ClientConnection<NotificationClientEndpoint, NotificationServerEndpoint> { - C_OBJECT(ClientConnection) +class ConnectionFromClient final : public IPC::ConnectionFromClient<NotificationClientEndpoint, NotificationServerEndpoint> { + C_OBJECT(ConnectionFromClient) public: - ~ClientConnection() override; + ~ConnectionFromClient() override; virtual void die() override; private: - explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); + explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); virtual void show_notification(String const&, String const&, Gfx::ShareableBitmap const&) override; virtual void close_notification() override; diff --git a/Userland/Services/NotificationServer/main.cpp b/Userland/Services/NotificationServer/main.cpp index d7e69122f5..1a210e6cb3 100644 --- a/Userland/Services/NotificationServer/main.cpp +++ b/Userland/Services/NotificationServer/main.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include "ClientConnection.h" +#include "ConnectionFromClient.h" #include <LibCore/System.h> #include <LibGUI/Application.h> #include <LibIPC/MultiServer.h> @@ -15,7 +15,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio recvfd sendfd accept rpath unix")); auto app = TRY(GUI::Application::try_create(arguments)); - auto server = TRY(IPC::MultiServer<NotificationServer::ClientConnection>::try_create()); + auto server = TRY(IPC::MultiServer<NotificationServer::ConnectionFromClient>::try_create()); TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil(nullptr, nullptr)); diff --git a/Userland/Services/RequestServer/CMakeLists.txt b/Userland/Services/RequestServer/CMakeLists.txt index 6ccf0a2997..627fbef756 100644 --- a/Userland/Services/RequestServer/CMakeLists.txt +++ b/Userland/Services/RequestServer/CMakeLists.txt @@ -7,7 +7,7 @@ compile_ipc(RequestServer.ipc RequestServerEndpoint.h) compile_ipc(RequestClient.ipc RequestClientEndpoint.h) set(SOURCES - ClientConnection.cpp + ConnectionFromClient.cpp ConnectionCache.cpp Request.cpp RequestClientEndpoint.h diff --git a/Userland/Services/RequestServer/ClientConnection.cpp b/Userland/Services/RequestServer/ConnectionFromClient.cpp index 80726e9b3b..9641e3f4a0 100644 --- a/Userland/Services/RequestServer/ClientConnection.cpp +++ b/Userland/Services/RequestServer/ConnectionFromClient.cpp @@ -5,7 +5,7 @@ */ #include <AK/Badge.h> -#include <RequestServer/ClientConnection.h> +#include <RequestServer/ConnectionFromClient.h> #include <RequestServer/Protocol.h> #include <RequestServer/Request.h> #include <RequestServer/RequestClientEndpoint.h> @@ -13,32 +13,32 @@ namespace RequestServer { -static HashMap<int, RefPtr<ClientConnection>> s_connections; +static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; -ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket) - : IPC::ClientConnection<RequestClientEndpoint, RequestServerEndpoint>(*this, move(socket), 1) +ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket) + : IPC::ConnectionFromClient<RequestClientEndpoint, RequestServerEndpoint>(*this, move(socket), 1) { s_connections.set(1, *this); } -ClientConnection::~ClientConnection() +ConnectionFromClient::~ConnectionFromClient() { } -void ClientConnection::die() +void ConnectionFromClient::die() { s_connections.remove(client_id()); if (s_connections.is_empty()) Core::EventLoop::current().quit(0); } -Messages::RequestServer::IsSupportedProtocolResponse ClientConnection::is_supported_protocol(String const& protocol) +Messages::RequestServer::IsSupportedProtocolResponse ConnectionFromClient::is_supported_protocol(String const& protocol) { bool supported = Protocol::find_by_name(protocol.to_lowercase()); return supported; } -Messages::RequestServer::StartRequestResponse ClientConnection::start_request(String const& method, URL const& url, IPC::Dictionary const& request_headers, ByteBuffer const& request_body) +Messages::RequestServer::StartRequestResponse ConnectionFromClient::start_request(String const& method, URL const& url, IPC::Dictionary const& request_headers, ByteBuffer const& request_body) { if (!url.is_valid()) { dbgln("StartRequest: Invalid URL requested: '{}'", url); @@ -60,7 +60,7 @@ Messages::RequestServer::StartRequestResponse ClientConnection::start_request(St return { id, IPC::File(fd, IPC::File::CloseAfterSending) }; } -Messages::RequestServer::StopRequestResponse ClientConnection::stop_request(i32 request_id) +Messages::RequestServer::StopRequestResponse ConnectionFromClient::stop_request(i32 request_id) { auto* request = const_cast<Request*>(m_requests.get(request_id).value_or(nullptr)); bool success = false; @@ -72,7 +72,7 @@ Messages::RequestServer::StopRequestResponse ClientConnection::stop_request(i32 return success; } -void ClientConnection::did_receive_headers(Badge<Request>, Request& request) +void ConnectionFromClient::did_receive_headers(Badge<Request>, Request& request) { IPC::Dictionary response_headers; for (auto& it : request.response_headers()) @@ -81,7 +81,7 @@ void ClientConnection::did_receive_headers(Badge<Request>, Request& request) async_headers_became_available(request.id(), move(response_headers), request.status_code()); } -void ClientConnection::did_finish_request(Badge<Request>, Request& request, bool success) +void ConnectionFromClient::did_finish_request(Badge<Request>, Request& request, bool success) { VERIFY(request.total_size().has_value()); @@ -90,17 +90,17 @@ void ClientConnection::did_finish_request(Badge<Request>, Request& request, bool m_requests.remove(request.id()); } -void ClientConnection::did_progress_request(Badge<Request>, Request& request) +void ConnectionFromClient::did_progress_request(Badge<Request>, Request& request) { async_request_progress(request.id(), request.total_size(), request.downloaded_size()); } -void ClientConnection::did_request_certificates(Badge<Request>, Request& request) +void ConnectionFromClient::did_request_certificates(Badge<Request>, Request& request) { async_certificate_requested(request.id()); } -Messages::RequestServer::SetCertificateResponse ClientConnection::set_certificate(i32 request_id, String const& certificate, String const& key) +Messages::RequestServer::SetCertificateResponse ConnectionFromClient::set_certificate(i32 request_id, String const& certificate, String const& key) { auto* request = const_cast<Request*>(m_requests.get(request_id).value_or(nullptr)); bool success = false; @@ -111,7 +111,7 @@ Messages::RequestServer::SetCertificateResponse ClientConnection::set_certificat return success; } -void ClientConnection::ensure_connection(URL const& url, ::RequestServer::CacheLevel const& cache_level) +void ConnectionFromClient::ensure_connection(URL const& url, ::RequestServer::CacheLevel const& cache_level) { if (!url.is_valid()) { dbgln("EnsureConnection: Invalid URL requested: '{}'", url); diff --git a/Userland/Services/RequestServer/ClientConnection.h b/Userland/Services/RequestServer/ConnectionFromClient.h index 47cc38533d..45bcd8fcc6 100644 --- a/Userland/Services/RequestServer/ClientConnection.h +++ b/Userland/Services/RequestServer/ConnectionFromClient.h @@ -7,19 +7,19 @@ #pragma once #include <AK/HashMap.h> -#include <LibIPC/ClientConnection.h> +#include <LibIPC/ConnectionFromClient.h> #include <RequestServer/Forward.h> #include <RequestServer/RequestClientEndpoint.h> #include <RequestServer/RequestServerEndpoint.h> namespace RequestServer { -class ClientConnection final - : public IPC::ClientConnection<RequestClientEndpoint, RequestServerEndpoint> { - C_OBJECT(ClientConnection); +class ConnectionFromClient final + : public IPC::ConnectionFromClient<RequestClientEndpoint, RequestServerEndpoint> { + C_OBJECT(ConnectionFromClient); public: - ~ClientConnection() override; + ~ConnectionFromClient() override; virtual void die() override; @@ -29,7 +29,7 @@ public: void did_request_certificates(Badge<Request>, Request&); private: - explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>); + explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>); 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; diff --git a/Userland/Services/RequestServer/Forward.h b/Userland/Services/RequestServer/Forward.h index 436c7bf4f8..0c357180bc 100644 --- a/Userland/Services/RequestServer/Forward.h +++ b/Userland/Services/RequestServer/Forward.h @@ -8,7 +8,7 @@ namespace RequestServer { -class ClientConnection; +class ConnectionFromClient; class Request; class GeminiProtocol; class HttpRequest; diff --git a/Userland/Services/RequestServer/GeminiProtocol.cpp b/Userland/Services/RequestServer/GeminiProtocol.cpp index 9958a3b720..0aca26cc5f 100644 --- a/Userland/Services/RequestServer/GeminiProtocol.cpp +++ b/Userland/Services/RequestServer/GeminiProtocol.cpp @@ -21,7 +21,7 @@ GeminiProtocol::~GeminiProtocol() { } -OwnPtr<Request> GeminiProtocol::start_request(ClientConnection& client, const String&, const URL& url, const HashMap<String, String>&, ReadonlyBytes) +OwnPtr<Request> GeminiProtocol::start_request(ConnectionFromClient& client, const String&, const URL& url, const HashMap<String, String>&, ReadonlyBytes) { Gemini::GeminiRequest request; request.set_url(url); diff --git a/Userland/Services/RequestServer/GeminiProtocol.h b/Userland/Services/RequestServer/GeminiProtocol.h index 4301fc2a70..7577bf1c6f 100644 --- a/Userland/Services/RequestServer/GeminiProtocol.h +++ b/Userland/Services/RequestServer/GeminiProtocol.h @@ -15,7 +15,7 @@ public: GeminiProtocol(); virtual ~GeminiProtocol() override; - virtual OwnPtr<Request> start_request(ClientConnection&, const String& method, const URL&, const HashMap<String, String>&, ReadonlyBytes body) override; + virtual OwnPtr<Request> start_request(ConnectionFromClient&, const String& method, const URL&, const HashMap<String, String>&, ReadonlyBytes body) override; }; } diff --git a/Userland/Services/RequestServer/GeminiRequest.cpp b/Userland/Services/RequestServer/GeminiRequest.cpp index 52cb3bbe2c..0e65f19418 100644 --- a/Userland/Services/RequestServer/GeminiRequest.cpp +++ b/Userland/Services/RequestServer/GeminiRequest.cpp @@ -12,7 +12,7 @@ namespace RequestServer { -GeminiRequest::GeminiRequest(ClientConnection& client, NonnullRefPtr<Gemini::Job> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) +GeminiRequest::GeminiRequest(ConnectionFromClient& client, NonnullRefPtr<Gemini::Job> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) : Request(client, move(output_stream)) , m_job(move(job)) { @@ -57,7 +57,7 @@ GeminiRequest::~GeminiRequest() m_job->cancel(); } -NonnullOwnPtr<GeminiRequest> GeminiRequest::create_with_job(Badge<GeminiProtocol>, ClientConnection& client, NonnullRefPtr<Gemini::Job> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) +NonnullOwnPtr<GeminiRequest> GeminiRequest::create_with_job(Badge<GeminiProtocol>, ConnectionFromClient& client, NonnullRefPtr<Gemini::Job> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) { return adopt_own(*new GeminiRequest(client, move(job), move(output_stream))); } diff --git a/Userland/Services/RequestServer/GeminiRequest.h b/Userland/Services/RequestServer/GeminiRequest.h index 87c8fc6663..c324b4d1e0 100644 --- a/Userland/Services/RequestServer/GeminiRequest.h +++ b/Userland/Services/RequestServer/GeminiRequest.h @@ -16,14 +16,14 @@ namespace RequestServer { class GeminiRequest final : public Request { public: virtual ~GeminiRequest() override; - static NonnullOwnPtr<GeminiRequest> create_with_job(Badge<GeminiProtocol>, ClientConnection&, NonnullRefPtr<Gemini::Job>, NonnullOwnPtr<Core::Stream::File>&&); + static NonnullOwnPtr<GeminiRequest> create_with_job(Badge<GeminiProtocol>, ConnectionFromClient&, NonnullRefPtr<Gemini::Job>, NonnullOwnPtr<Core::Stream::File>&&); Gemini::Job const& job() const { return *m_job; } virtual URL url() const override { return m_job->url(); } private: - explicit GeminiRequest(ClientConnection&, NonnullRefPtr<Gemini::Job>, NonnullOwnPtr<Core::Stream::File>&&); + explicit GeminiRequest(ConnectionFromClient&, NonnullRefPtr<Gemini::Job>, NonnullOwnPtr<Core::Stream::File>&&); virtual void set_certificate(String certificate, String key) override; diff --git a/Userland/Services/RequestServer/HttpCommon.h b/Userland/Services/RequestServer/HttpCommon.h index 797ddab245..f7bd86b9d5 100644 --- a/Userland/Services/RequestServer/HttpCommon.h +++ b/Userland/Services/RequestServer/HttpCommon.h @@ -14,8 +14,8 @@ #include <AK/String.h> #include <AK/Types.h> #include <LibHTTP/HttpRequest.h> -#include <RequestServer/ClientConnection.h> #include <RequestServer/ConnectionCache.h> +#include <RequestServer/ConnectionFromClient.h> #include <RequestServer/Request.h> namespace RequestServer::Detail { @@ -61,7 +61,7 @@ void init(TSelf* self, TJob job) } template<typename TBadgedProtocol, typename TPipeResult> -OwnPtr<Request> start_request(TBadgedProtocol&& protocol, ClientConnection& client, const String& method, const URL& url, const HashMap<String, String>& headers, ReadonlyBytes body, TPipeResult&& pipe_result) +OwnPtr<Request> start_request(TBadgedProtocol&& protocol, ConnectionFromClient& client, const String& method, const URL& url, const HashMap<String, String>& headers, ReadonlyBytes body, TPipeResult&& pipe_result) { using TJob = typename TBadgedProtocol::Type::JobType; using TRequest = typename TBadgedProtocol::Type::RequestType; diff --git a/Userland/Services/RequestServer/HttpProtocol.cpp b/Userland/Services/RequestServer/HttpProtocol.cpp index 846a6f871b..4778547a97 100644 --- a/Userland/Services/RequestServer/HttpProtocol.cpp +++ b/Userland/Services/RequestServer/HttpProtocol.cpp @@ -10,7 +10,7 @@ #include <AK/OwnPtr.h> #include <AK/String.h> #include <AK/URL.h> -#include <RequestServer/ClientConnection.h> +#include <RequestServer/ConnectionFromClient.h> #include <RequestServer/HttpCommon.h> #include <RequestServer/HttpProtocol.h> #include <RequestServer/Request.h> @@ -22,7 +22,7 @@ HttpProtocol::HttpProtocol() { } -OwnPtr<Request> HttpProtocol::start_request(ClientConnection& client, const String& method, const URL& url, const HashMap<String, String>& headers, ReadonlyBytes body) +OwnPtr<Request> HttpProtocol::start_request(ConnectionFromClient& client, const String& method, const URL& url, const HashMap<String, String>& headers, ReadonlyBytes body) { return Detail::start_request(Badge<HttpProtocol> {}, client, method, url, headers, body, get_pipe_for_request()); } diff --git a/Userland/Services/RequestServer/HttpProtocol.h b/Userland/Services/RequestServer/HttpProtocol.h index 23f8680cab..cfedf92cfe 100644 --- a/Userland/Services/RequestServer/HttpProtocol.h +++ b/Userland/Services/RequestServer/HttpProtocol.h @@ -12,7 +12,7 @@ #include <AK/String.h> #include <AK/URL.h> #include <LibHTTP/Job.h> -#include <RequestServer/ClientConnection.h> +#include <RequestServer/ConnectionFromClient.h> #include <RequestServer/HttpRequest.h> #include <RequestServer/Protocol.h> #include <RequestServer/Request.h> @@ -27,7 +27,7 @@ public: HttpProtocol(); ~HttpProtocol() override = default; - virtual OwnPtr<Request> start_request(ClientConnection&, const String& method, const URL&, const HashMap<String, String>& headers, ReadonlyBytes body) override; + virtual OwnPtr<Request> start_request(ConnectionFromClient&, const String& method, const URL&, const HashMap<String, String>& headers, ReadonlyBytes body) override; }; } diff --git a/Userland/Services/RequestServer/HttpRequest.cpp b/Userland/Services/RequestServer/HttpRequest.cpp index 2fc4f7fc73..861c7a93b3 100644 --- a/Userland/Services/RequestServer/HttpRequest.cpp +++ b/Userland/Services/RequestServer/HttpRequest.cpp @@ -11,7 +11,7 @@ namespace RequestServer { -HttpRequest::HttpRequest(ClientConnection& client, NonnullRefPtr<HTTP::Job> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) +HttpRequest::HttpRequest(ConnectionFromClient& client, NonnullRefPtr<HTTP::Job> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) : Request(client, move(output_stream)) , m_job(job) { @@ -25,7 +25,7 @@ HttpRequest::~HttpRequest() m_job->cancel(); } -NonnullOwnPtr<HttpRequest> HttpRequest::create_with_job(Badge<HttpProtocol>&&, ClientConnection& client, NonnullRefPtr<HTTP::Job> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) +NonnullOwnPtr<HttpRequest> HttpRequest::create_with_job(Badge<HttpProtocol>&&, ConnectionFromClient& client, NonnullRefPtr<HTTP::Job> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) { return adopt_own(*new HttpRequest(client, move(job), move(output_stream))); } diff --git a/Userland/Services/RequestServer/HttpRequest.h b/Userland/Services/RequestServer/HttpRequest.h index 36f5fe1045..624cccf4dc 100644 --- a/Userland/Services/RequestServer/HttpRequest.h +++ b/Userland/Services/RequestServer/HttpRequest.h @@ -17,7 +17,7 @@ namespace RequestServer { class HttpRequest final : public Request { public: virtual ~HttpRequest() override; - static NonnullOwnPtr<HttpRequest> create_with_job(Badge<HttpProtocol>&&, ClientConnection&, NonnullRefPtr<HTTP::Job>, NonnullOwnPtr<Core::Stream::File>&&); + static NonnullOwnPtr<HttpRequest> create_with_job(Badge<HttpProtocol>&&, ConnectionFromClient&, NonnullRefPtr<HTTP::Job>, NonnullOwnPtr<Core::Stream::File>&&); HTTP::Job& job() { return m_job; } HTTP::Job const& job() const { return m_job; } @@ -25,7 +25,7 @@ public: virtual URL url() const override { return m_job->url(); } private: - explicit HttpRequest(ClientConnection&, NonnullRefPtr<HTTP::Job>, NonnullOwnPtr<Core::Stream::File>&&); + explicit HttpRequest(ConnectionFromClient&, NonnullRefPtr<HTTP::Job>, NonnullOwnPtr<Core::Stream::File>&&); NonnullRefPtr<HTTP::Job> m_job; }; diff --git a/Userland/Services/RequestServer/HttpsProtocol.cpp b/Userland/Services/RequestServer/HttpsProtocol.cpp index 7366c98d50..5cd18ca74a 100644 --- a/Userland/Services/RequestServer/HttpsProtocol.cpp +++ b/Userland/Services/RequestServer/HttpsProtocol.cpp @@ -10,7 +10,7 @@ #include <AK/OwnPtr.h> #include <AK/String.h> #include <AK/URL.h> -#include <RequestServer/ClientConnection.h> +#include <RequestServer/ConnectionFromClient.h> #include <RequestServer/HttpCommon.h> #include <RequestServer/HttpsProtocol.h> #include <RequestServer/Request.h> @@ -22,7 +22,7 @@ HttpsProtocol::HttpsProtocol() { } -OwnPtr<Request> HttpsProtocol::start_request(ClientConnection& client, const String& method, const URL& url, const HashMap<String, String>& headers, ReadonlyBytes body) +OwnPtr<Request> HttpsProtocol::start_request(ConnectionFromClient& client, const String& method, const URL& url, const HashMap<String, String>& headers, ReadonlyBytes body) { return Detail::start_request(Badge<HttpsProtocol> {}, client, method, url, headers, body, get_pipe_for_request()); } diff --git a/Userland/Services/RequestServer/HttpsProtocol.h b/Userland/Services/RequestServer/HttpsProtocol.h index 3728bf13af..6c13cd76f2 100644 --- a/Userland/Services/RequestServer/HttpsProtocol.h +++ b/Userland/Services/RequestServer/HttpsProtocol.h @@ -12,7 +12,7 @@ #include <AK/String.h> #include <AK/URL.h> #include <LibHTTP/HttpsJob.h> -#include <RequestServer/ClientConnection.h> +#include <RequestServer/ConnectionFromClient.h> #include <RequestServer/HttpsRequest.h> #include <RequestServer/Protocol.h> #include <RequestServer/Request.h> @@ -27,7 +27,7 @@ public: HttpsProtocol(); ~HttpsProtocol() override = default; - virtual OwnPtr<Request> start_request(ClientConnection&, const String& method, const URL&, const HashMap<String, String>& headers, ReadonlyBytes body) override; + virtual OwnPtr<Request> start_request(ConnectionFromClient&, const String& method, const URL&, const HashMap<String, String>& headers, ReadonlyBytes body) override; }; } diff --git a/Userland/Services/RequestServer/HttpsRequest.cpp b/Userland/Services/RequestServer/HttpsRequest.cpp index 6f0af9ba8b..5e68dd84cb 100644 --- a/Userland/Services/RequestServer/HttpsRequest.cpp +++ b/Userland/Services/RequestServer/HttpsRequest.cpp @@ -11,7 +11,7 @@ namespace RequestServer { -HttpsRequest::HttpsRequest(ClientConnection& client, NonnullRefPtr<HTTP::HttpsJob> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) +HttpsRequest::HttpsRequest(ConnectionFromClient& client, NonnullRefPtr<HTTP::HttpsJob> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) : Request(client, move(output_stream)) , m_job(job) { @@ -30,7 +30,7 @@ HttpsRequest::~HttpsRequest() m_job->cancel(); } -NonnullOwnPtr<HttpsRequest> HttpsRequest::create_with_job(Badge<HttpsProtocol>&&, ClientConnection& client, NonnullRefPtr<HTTP::HttpsJob> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) +NonnullOwnPtr<HttpsRequest> HttpsRequest::create_with_job(Badge<HttpsProtocol>&&, ConnectionFromClient& client, NonnullRefPtr<HTTP::HttpsJob> job, NonnullOwnPtr<Core::Stream::File>&& output_stream) { return adopt_own(*new HttpsRequest(client, move(job), move(output_stream))); } diff --git a/Userland/Services/RequestServer/HttpsRequest.h b/Userland/Services/RequestServer/HttpsRequest.h index 5020be1e9b..12b61570a4 100644 --- a/Userland/Services/RequestServer/HttpsRequest.h +++ b/Userland/Services/RequestServer/HttpsRequest.h @@ -16,7 +16,7 @@ namespace RequestServer { class HttpsRequest final : public Request { public: virtual ~HttpsRequest() override; - static NonnullOwnPtr<HttpsRequest> create_with_job(Badge<HttpsProtocol>&&, ClientConnection&, NonnullRefPtr<HTTP::HttpsJob>, NonnullOwnPtr<Core::Stream::File>&&); + static NonnullOwnPtr<HttpsRequest> create_with_job(Badge<HttpsProtocol>&&, ConnectionFromClient&, NonnullRefPtr<HTTP::HttpsJob>, NonnullOwnPtr<Core::Stream::File>&&); HTTP::HttpsJob& job() { return m_job; } HTTP::HttpsJob const& job() const { return m_job; } @@ -24,7 +24,7 @@ public: virtual URL url() const override { return m_job->url(); } private: - explicit HttpsRequest(ClientConnection&, NonnullRefPtr<HTTP::HttpsJob>, NonnullOwnPtr<Core::Stream::File>&&); + explicit HttpsRequest(ConnectionFromClient&, NonnullRefPtr<HTTP::HttpsJob>, NonnullOwnPtr<Core::Stream::File>&&); virtual void set_certificate(String certificate, String key) override; diff --git a/Userland/Services/RequestServer/Protocol.h b/Userland/Services/RequestServer/Protocol.h index 98f4a87da1..cd8a969c32 100644 --- a/Userland/Services/RequestServer/Protocol.h +++ b/Userland/Services/RequestServer/Protocol.h @@ -17,7 +17,7 @@ public: virtual ~Protocol(); const String& name() const { return m_name; } - virtual OwnPtr<Request> start_request(ClientConnection&, const String& method, const URL&, const HashMap<String, String>& headers, ReadonlyBytes body) = 0; + virtual OwnPtr<Request> start_request(ConnectionFromClient&, const String& method, const URL&, const HashMap<String, String>& headers, ReadonlyBytes body) = 0; static Protocol* find_by_name(const String&); diff --git a/Userland/Services/RequestServer/Request.cpp b/Userland/Services/RequestServer/Request.cpp index 012da64525..06c6e2f593 100644 --- a/Userland/Services/RequestServer/Request.cpp +++ b/Userland/Services/RequestServer/Request.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include <RequestServer/ClientConnection.h> +#include <RequestServer/ConnectionFromClient.h> #include <RequestServer/Request.h> namespace RequestServer { @@ -12,7 +12,7 @@ namespace RequestServer { // FIXME: What about rollover? static i32 s_next_id = 1; -Request::Request(ClientConnection& client, NonnullOwnPtr<Core::Stream::File>&& output_stream) +Request::Request(ConnectionFromClient& client, NonnullOwnPtr<Core::Stream::File>&& output_stream) : m_client(client) , m_id(s_next_id++) , m_output_stream(move(output_stream)) diff --git a/Userland/Services/RequestServer/Request.h b/Userland/Services/RequestServer/Request.h index 969039d167..9956a7f9c3 100644 --- a/Userland/Services/RequestServer/Request.h +++ b/Userland/Services/RequestServer/Request.h @@ -44,10 +44,10 @@ public: const Core::Stream::File& output_stream() const { return *m_output_stream; } protected: - explicit Request(ClientConnection&, NonnullOwnPtr<Core::Stream::File>&&); + explicit Request(ConnectionFromClient&, NonnullOwnPtr<Core::Stream::File>&&); private: - ClientConnection& m_client; + ConnectionFromClient& m_client; i32 m_id { 0 }; int m_request_fd { -1 }; // Passed to client. Optional<u32> m_status_code; diff --git a/Userland/Services/RequestServer/main.cpp b/Userland/Services/RequestServer/main.cpp index cc1f0dabff..7586688917 100644 --- a/Userland/Services/RequestServer/main.cpp +++ b/Userland/Services/RequestServer/main.cpp @@ -11,7 +11,7 @@ #include <LibIPC/SingleServer.h> #include <LibMain/Main.h> #include <LibTLS/Certificate.h> -#include <RequestServer/ClientConnection.h> +#include <RequestServer/ConnectionFromClient.h> #include <RequestServer/GeminiProtocol.h> #include <RequestServer/HttpProtocol.h> #include <RequestServer/HttpsProtocol.h> @@ -46,7 +46,7 @@ ErrorOr<int> serenity_main(Main::Arguments) [[maybe_unused]] auto http = make<RequestServer::HttpProtocol>(); [[maybe_unused]] auto https = make<RequestServer::HttpsProtocol>(); - auto client = TRY(IPC::take_over_accepted_client_from_system_server<RequestServer::ClientConnection>()); + auto client = TRY(IPC::take_over_accepted_client_from_system_server<RequestServer::ConnectionFromClient>()); auto result = event_loop.exec(); diff --git a/Userland/Services/SQLServer/CMakeLists.txt b/Userland/Services/SQLServer/CMakeLists.txt index 87e3d0fcd7..0f6a680029 100644 --- a/Userland/Services/SQLServer/CMakeLists.txt +++ b/Userland/Services/SQLServer/CMakeLists.txt @@ -8,7 +8,7 @@ compile_ipc(SQLServer.ipc SQLServerEndpoint.h) compile_ipc(SQLClient.ipc SQLClientEndpoint.h) set(SOURCES - ClientConnection.cpp + ConnectionFromClient.cpp DatabaseConnection.cpp main.cpp SQLClientEndpoint.h diff --git a/Userland/Services/SQLServer/ClientConnection.cpp b/Userland/Services/SQLServer/ConnectionFromClient.cpp index 2e7ff9e1af..b6f0cece84 100644 --- a/Userland/Services/SQLServer/ClientConnection.cpp +++ b/Userland/Services/SQLServer/ConnectionFromClient.cpp @@ -7,15 +7,15 @@ #include <AK/String.h> #include <AK/Vector.h> #include <LibSQL/Result.h> -#include <SQLServer/ClientConnection.h> +#include <SQLServer/ConnectionFromClient.h> #include <SQLServer/DatabaseConnection.h> #include <SQLServer/SQLStatement.h> namespace SQLServer { -static HashMap<int, RefPtr<ClientConnection>> s_connections; +static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; -RefPtr<ClientConnection> ClientConnection::client_connection_for(int client_id) +RefPtr<ConnectionFromClient> ConnectionFromClient::client_connection_for(int client_id) { if (s_connections.contains(client_id)) return *s_connections.get(client_id).value(); @@ -23,31 +23,31 @@ RefPtr<ClientConnection> ClientConnection::client_connection_for(int client_id) return nullptr; } -ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket, int client_id) - : IPC::ClientConnection<SQLClientEndpoint, SQLServerEndpoint>(*this, move(socket), client_id) +ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket, int client_id) + : IPC::ConnectionFromClient<SQLClientEndpoint, SQLServerEndpoint>(*this, move(socket), client_id) { s_connections.set(client_id, *this); } -ClientConnection::~ClientConnection() +ConnectionFromClient::~ConnectionFromClient() { } -void ClientConnection::die() +void ConnectionFromClient::die() { s_connections.remove(client_id()); } -Messages::SQLServer::ConnectResponse ClientConnection::connect(String const& database_name) +Messages::SQLServer::ConnectResponse ConnectionFromClient::connect(String const& database_name) { - dbgln_if(SQLSERVER_DEBUG, "ClientConnection::connect(database_name: {})", database_name); + dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::connect(database_name: {})", database_name); auto database_connection = DatabaseConnection::construct(database_name, client_id()); return { database_connection->connection_id() }; } -void ClientConnection::disconnect(int connection_id) +void ConnectionFromClient::disconnect(int connection_id) { - dbgln_if(SQLSERVER_DEBUG, "ClientConnection::disconnect(connection_id: {})", connection_id); + dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::disconnect(connection_id: {})", connection_id); auto database_connection = DatabaseConnection::connection_for(connection_id); if (database_connection) database_connection->disconnect(); @@ -55,13 +55,13 @@ void ClientConnection::disconnect(int connection_id) dbgln("Database connection has disappeared"); } -Messages::SQLServer::SqlStatementResponse ClientConnection::sql_statement(int connection_id, String const& sql) +Messages::SQLServer::SqlStatementResponse ConnectionFromClient::sql_statement(int connection_id, String const& sql) { - dbgln_if(SQLSERVER_DEBUG, "ClientConnection::sql_statement(connection_id: {}, sql: '{}')", connection_id, sql); + dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::sql_statement(connection_id: {}, sql: '{}')", connection_id, sql); auto database_connection = DatabaseConnection::connection_for(connection_id); if (database_connection) { auto statement_id = database_connection->sql_statement(sql); - dbgln_if(SQLSERVER_DEBUG, "ClientConnection::sql_statement -> statement_id = {}", statement_id); + dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::sql_statement -> statement_id = {}", statement_id); return { statement_id }; } else { dbgln("Database connection has disappeared"); @@ -69,9 +69,9 @@ Messages::SQLServer::SqlStatementResponse ClientConnection::sql_statement(int co } } -void ClientConnection::statement_execute(int statement_id) +void ConnectionFromClient::statement_execute(int statement_id) { - dbgln_if(SQLSERVER_DEBUG, "ClientConnection::statement_execute_query(statement_id: {})", statement_id); + dbgln_if(SQLSERVER_DEBUG, "ConnectionFromClient::statement_execute_query(statement_id: {})", statement_id); auto statement = SQLStatement::statement_for(statement_id); if (statement && statement->connection()->client_id() == client_id()) { statement->execute(); diff --git a/Userland/Services/SQLServer/ClientConnection.h b/Userland/Services/SQLServer/ConnectionFromClient.h index 125b70e2c8..ae7ab80b3f 100644 --- a/Userland/Services/SQLServer/ClientConnection.h +++ b/Userland/Services/SQLServer/ConnectionFromClient.h @@ -7,25 +7,25 @@ #pragma once #include <AK/HashMap.h> -#include <LibIPC/ClientConnection.h> +#include <LibIPC/ConnectionFromClient.h> #include <SQLServer/SQLClientEndpoint.h> #include <SQLServer/SQLServerEndpoint.h> namespace SQLServer { -class ClientConnection final - : public IPC::ClientConnection<SQLClientEndpoint, SQLServerEndpoint> { - C_OBJECT(ClientConnection); +class ConnectionFromClient final + : public IPC::ConnectionFromClient<SQLClientEndpoint, SQLServerEndpoint> { + C_OBJECT(ConnectionFromClient); public: - virtual ~ClientConnection() override; + virtual ~ConnectionFromClient() override; virtual void die() override; - static RefPtr<ClientConnection> client_connection_for(int client_id); + static RefPtr<ConnectionFromClient> client_connection_for(int client_id); private: - explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); + explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); virtual Messages::SQLServer::ConnectResponse connect(String const&) override; virtual Messages::SQLServer::SqlStatementResponse sql_statement(int, String const&) override; diff --git a/Userland/Services/SQLServer/DatabaseConnection.cpp b/Userland/Services/SQLServer/DatabaseConnection.cpp index f02d2cd415..1127848cf5 100644 --- a/Userland/Services/SQLServer/DatabaseConnection.cpp +++ b/Userland/Services/SQLServer/DatabaseConnection.cpp @@ -5,7 +5,7 @@ */ #include <AK/LexicalPath.h> -#include <SQLServer/ClientConnection.h> +#include <SQLServer/ConnectionFromClient.h> #include <SQLServer/DatabaseConnection.h> #include <SQLServer/SQLStatement.h> @@ -30,7 +30,7 @@ DatabaseConnection::DatabaseConnection(String database_name, int client_id) , m_client_id(client_id) { if (LexicalPath path(m_database_name); (path.title() != m_database_name) || (path.dirname() != ".")) { - auto client_connection = ClientConnection::client_connection_for(m_client_id); + auto client_connection = ConnectionFromClient::client_connection_for(m_client_id); client_connection->async_connection_error(m_connection_id, (int)SQL::SQLErrorCode::InvalidDatabaseName, m_database_name); return; } @@ -39,7 +39,7 @@ DatabaseConnection::DatabaseConnection(String database_name, int client_id) s_connections.set(m_connection_id, *this); deferred_invoke([this]() { m_database = SQL::Database::construct(String::formatted("/home/anon/sql/{}.db", m_database_name)); - auto client_connection = ClientConnection::client_connection_for(m_client_id); + auto client_connection = ConnectionFromClient::client_connection_for(m_client_id); if (auto maybe_error = m_database->open(); maybe_error.is_error()) { client_connection->async_connection_error(m_connection_id, (int)SQL::SQLErrorCode::InternalError, maybe_error.error().string_literal()); return; @@ -59,7 +59,7 @@ void DatabaseConnection::disconnect() deferred_invoke([this]() { m_database = nullptr; s_connections.remove(m_connection_id); - auto client_connection = ClientConnection::client_connection_for(client_id()); + auto client_connection = ConnectionFromClient::client_connection_for(client_id()); if (client_connection) client_connection->async_disconnected(m_connection_id); else @@ -70,7 +70,7 @@ void DatabaseConnection::disconnect() int DatabaseConnection::sql_statement(String const& sql) { dbgln_if(SQLSERVER_DEBUG, "DatabaseConnection::sql_statement(connection_id {}, database '{}', sql '{}'", connection_id(), m_database_name, sql); - auto client_connection = ClientConnection::client_connection_for(client_id()); + auto client_connection = ConnectionFromClient::client_connection_for(client_id()); if (!client_connection) { warnln("Cannot notify client of database disconnection. Client disconnected"); return -1; diff --git a/Userland/Services/SQLServer/Forward.h b/Userland/Services/SQLServer/Forward.h index 06ffa54c4b..9b6e33f939 100644 --- a/Userland/Services/SQLServer/Forward.h +++ b/Userland/Services/SQLServer/Forward.h @@ -7,7 +7,7 @@ #pragma once namespace SQLServer { -class ClientConnection; +class ConnectionFromClient; class DatabaseConnection; class SQLStatement; } diff --git a/Userland/Services/SQLServer/SQLStatement.cpp b/Userland/Services/SQLServer/SQLStatement.cpp index 3c196c4f2f..11b3068356 100644 --- a/Userland/Services/SQLServer/SQLStatement.cpp +++ b/Userland/Services/SQLServer/SQLStatement.cpp @@ -6,7 +6,7 @@ #include <LibCore/Object.h> #include <LibSQL/AST/Parser.h> -#include <SQLServer/ClientConnection.h> +#include <SQLServer/ConnectionFromClient.h> #include <SQLServer/DatabaseConnection.h> #include <SQLServer/SQLStatement.h> @@ -37,7 +37,7 @@ void SQLStatement::report_error(SQL::Result result) { dbgln_if(SQLSERVER_DEBUG, "SQLStatement::report_error(statement_id {}, error {}", statement_id(), result.error_string()); - auto client_connection = ClientConnection::client_connection_for(connection()->client_id()); + auto client_connection = ConnectionFromClient::client_connection_for(connection()->client_id()); s_statements.remove(statement_id()); remove_from_parent(); @@ -54,7 +54,7 @@ void SQLStatement::report_error(SQL::Result result) void SQLStatement::execute() { dbgln_if(SQLSERVER_DEBUG, "SQLStatement::execute(statement_id {}", statement_id()); - auto client_connection = ClientConnection::client_connection_for(connection()->client_id()); + auto client_connection = ConnectionFromClient::client_connection_for(connection()->client_id()); if (!client_connection) { warnln("Cannot yield next result. Client disconnected"); return; @@ -75,7 +75,7 @@ void SQLStatement::execute() return; } - auto client_connection = ClientConnection::client_connection_for(connection()->client_id()); + auto client_connection = ConnectionFromClient::client_connection_for(connection()->client_id()); if (!client_connection) { warnln("Cannot return statement execution results. Client disconnected"); return; @@ -122,7 +122,7 @@ bool SQLStatement::should_send_result_rows() const void SQLStatement::next() { VERIFY(!m_result->is_empty()); - auto client_connection = ClientConnection::client_connection_for(connection()->client_id()); + auto client_connection = ConnectionFromClient::client_connection_for(connection()->client_id()); if (!client_connection) { warnln("Cannot yield next result. Client disconnected"); return; diff --git a/Userland/Services/SQLServer/main.cpp b/Userland/Services/SQLServer/main.cpp index 98ccc1099b..3727fdd81d 100644 --- a/Userland/Services/SQLServer/main.cpp +++ b/Userland/Services/SQLServer/main.cpp @@ -8,7 +8,7 @@ #include <LibCore/System.h> #include <LibIPC/MultiServer.h> #include <LibMain/Main.h> -#include <SQLServer/ClientConnection.h> +#include <SQLServer/ConnectionFromClient.h> #include <stdio.h> #include <sys/stat.h> @@ -26,6 +26,6 @@ ErrorOr<int> serenity_main(Main::Arguments) Core::EventLoop event_loop; - auto server = TRY(IPC::MultiServer<SQLServer::ClientConnection>::try_create()); + auto server = TRY(IPC::MultiServer<SQLServer::ConnectionFromClient>::try_create()); return event_loop.exec(); } diff --git a/Userland/Services/WebContent/CMakeLists.txt b/Userland/Services/WebContent/CMakeLists.txt index 5a660ef194..0c10d7671f 100644 --- a/Userland/Services/WebContent/CMakeLists.txt +++ b/Userland/Services/WebContent/CMakeLists.txt @@ -7,7 +7,7 @@ compile_ipc(WebContentServer.ipc WebContentServerEndpoint.h) compile_ipc(WebContentClient.ipc WebContentClientEndpoint.h) set(SOURCES - ClientConnection.cpp + ConnectionFromClient.cpp ConsoleGlobalObject.cpp main.cpp PageHost.cpp diff --git a/Userland/Services/WebContent/ClientConnection.cpp b/Userland/Services/WebContent/ConnectionFromClient.cpp index 101e0c2ce4..6e01c5e0a7 100644 --- a/Userland/Services/WebContent/ClientConnection.cpp +++ b/Userland/Services/WebContent/ConnectionFromClient.cpp @@ -25,58 +25,58 @@ #include <LibWeb/Layout/InitialContainingBlock.h> #include <LibWeb/Loader/ContentFilter.h> #include <LibWeb/Loader/ResourceLoader.h> -#include <WebContent/ClientConnection.h> +#include <WebContent/ConnectionFromClient.h> #include <WebContent/PageHost.h> #include <WebContent/WebContentClientEndpoint.h> #include <pthread.h> namespace WebContent { -ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket) - : IPC::ClientConnection<WebContentClientEndpoint, WebContentServerEndpoint>(*this, move(socket), 1) +ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket) + : IPC::ConnectionFromClient<WebContentClientEndpoint, WebContentServerEndpoint>(*this, move(socket), 1) , m_page_host(PageHost::create(*this)) { m_paint_flush_timer = Core::Timer::create_single_shot(0, [this] { flush_pending_paint_requests(); }); } -ClientConnection::~ClientConnection() +ConnectionFromClient::~ConnectionFromClient() { } -void ClientConnection::die() +void ConnectionFromClient::die() { Core::EventLoop::current().quit(0); } -Web::Page& ClientConnection::page() +Web::Page& ConnectionFromClient::page() { return m_page_host->page(); } -const Web::Page& ClientConnection::page() const +const Web::Page& ConnectionFromClient::page() const { return m_page_host->page(); } -void ClientConnection::update_system_theme(const Core::AnonymousBuffer& theme_buffer) +void ConnectionFromClient::update_system_theme(const Core::AnonymousBuffer& theme_buffer) { Gfx::set_system_theme(theme_buffer); auto impl = Gfx::PaletteImpl::create_with_anonymous_buffer(theme_buffer); m_page_host->set_palette_impl(*impl); } -void ClientConnection::update_system_fonts(String const& default_font_query, String const& fixed_width_font_query) +void ConnectionFromClient::update_system_fonts(String const& default_font_query, String const& fixed_width_font_query) { Gfx::FontDatabase::set_default_font_query(default_font_query); Gfx::FontDatabase::set_fixed_width_font_query(fixed_width_font_query); } -void ClientConnection::update_screen_rects(const Vector<Gfx::IntRect>& rects, u32 main_screen) +void ConnectionFromClient::update_screen_rects(const Vector<Gfx::IntRect>& rects, u32 main_screen) { m_page_host->set_screen_rects(rects, main_screen); } -void ClientConnection::load_url(const URL& url) +void ConnectionFromClient::load_url(const URL& url) { dbgln_if(SPAM_DEBUG, "handle: WebContentServer::LoadURL: url={}", url); @@ -91,29 +91,29 @@ void ClientConnection::load_url(const URL& url) page().load(url); } -void ClientConnection::load_html(const String& html, const URL& url) +void ConnectionFromClient::load_html(const String& html, const URL& url) { dbgln_if(SPAM_DEBUG, "handle: WebContentServer::LoadHTML: html={}, url={}", html, url); page().load_html(html, url); } -void ClientConnection::set_viewport_rect(const Gfx::IntRect& rect) +void ConnectionFromClient::set_viewport_rect(const Gfx::IntRect& rect) { dbgln_if(SPAM_DEBUG, "handle: WebContentServer::SetViewportRect: rect={}", rect); m_page_host->set_viewport_rect(rect); } -void ClientConnection::add_backing_store(i32 backing_store_id, const Gfx::ShareableBitmap& bitmap) +void ConnectionFromClient::add_backing_store(i32 backing_store_id, const Gfx::ShareableBitmap& bitmap) { m_backing_stores.set(backing_store_id, *bitmap.bitmap()); } -void ClientConnection::remove_backing_store(i32 backing_store_id) +void ConnectionFromClient::remove_backing_store(i32 backing_store_id) { m_backing_stores.remove(backing_store_id); } -void ClientConnection::paint(const Gfx::IntRect& content_rect, i32 backing_store_id) +void ConnectionFromClient::paint(const Gfx::IntRect& content_rect, i32 backing_store_id) { for (auto& pending_paint : m_pending_paint_requests) { if (pending_paint.bitmap_id == backing_store_id) { @@ -133,7 +133,7 @@ void ClientConnection::paint(const Gfx::IntRect& content_rect, i32 backing_store m_paint_flush_timer->start(); } -void ClientConnection::flush_pending_paint_requests() +void ConnectionFromClient::flush_pending_paint_requests() { for (auto& pending_paint : m_pending_paint_requests) { m_page_host->paint(pending_paint.content_rect, *pending_paint.bitmap); @@ -142,37 +142,37 @@ void ClientConnection::flush_pending_paint_requests() m_pending_paint_requests.clear(); } -void ClientConnection::mouse_down(const Gfx::IntPoint& position, unsigned int button, [[maybe_unused]] unsigned int buttons, unsigned int modifiers) +void ConnectionFromClient::mouse_down(const Gfx::IntPoint& position, unsigned int button, [[maybe_unused]] unsigned int buttons, unsigned int modifiers) { page().handle_mousedown(position, button, modifiers); } -void ClientConnection::mouse_move(const Gfx::IntPoint& position, [[maybe_unused]] unsigned int button, unsigned int buttons, unsigned int modifiers) +void ConnectionFromClient::mouse_move(const Gfx::IntPoint& position, [[maybe_unused]] unsigned int button, unsigned int buttons, unsigned int modifiers) { page().handle_mousemove(position, buttons, modifiers); } -void ClientConnection::mouse_up(const Gfx::IntPoint& position, unsigned int button, [[maybe_unused]] unsigned int buttons, unsigned int modifiers) +void ConnectionFromClient::mouse_up(const Gfx::IntPoint& position, unsigned int button, [[maybe_unused]] unsigned int buttons, unsigned int modifiers) { page().handle_mouseup(position, button, modifiers); } -void ClientConnection::mouse_wheel(const Gfx::IntPoint& position, unsigned int button, [[maybe_unused]] unsigned int buttons, unsigned int modifiers, i32 wheel_delta_x, i32 wheel_delta_y) +void ConnectionFromClient::mouse_wheel(const Gfx::IntPoint& position, unsigned int button, [[maybe_unused]] unsigned int buttons, unsigned int modifiers, i32 wheel_delta_x, i32 wheel_delta_y) { page().handle_mousewheel(position, button, modifiers, wheel_delta_x, wheel_delta_y); } -void ClientConnection::key_down(i32 key, unsigned int modifiers, u32 code_point) +void ConnectionFromClient::key_down(i32 key, unsigned int modifiers, u32 code_point) { page().handle_keydown((KeyCode)key, modifiers, code_point); } -void ClientConnection::key_up(i32 key, unsigned int modifiers, u32 code_point) +void ConnectionFromClient::key_up(i32 key, unsigned int modifiers, u32 code_point) { page().handle_keyup((KeyCode)key, modifiers, code_point); } -void ClientConnection::debug_request(const String& request, const String& argument) +void ConnectionFromClient::debug_request(const String& request, const String& argument) { if (request == "dump-dom-tree") { if (auto* doc = page().top_level_browsing_context().active_document()) @@ -231,21 +231,21 @@ void ClientConnection::debug_request(const String& request, const String& argume } } -void ClientConnection::get_source() +void ConnectionFromClient::get_source() { if (auto* doc = page().top_level_browsing_context().active_document()) { async_did_get_source(doc->url(), doc->source()); } } -void ClientConnection::inspect_dom_tree() +void ConnectionFromClient::inspect_dom_tree() { if (auto* doc = page().top_level_browsing_context().active_document()) { async_did_get_dom_tree(doc->dump_dom_tree_as_json()); } } -Messages::WebContentServer::InspectDomNodeResponse ClientConnection::inspect_dom_node(i32 node_id) +Messages::WebContentServer::InspectDomNodeResponse ConnectionFromClient::inspect_dom_node(i32 node_id) { auto& top_context = page().top_level_browsing_context(); @@ -311,7 +311,7 @@ Messages::WebContentServer::InspectDomNodeResponse ClientConnection::inspect_dom return { false, "", "", "" }; } -Messages::WebContentServer::GetHoveredNodeIdResponse ClientConnection::get_hovered_node_id() +Messages::WebContentServer::GetHoveredNodeIdResponse ConnectionFromClient::get_hovered_node_id() { if (auto* document = page().top_level_browsing_context().active_document()) { auto hovered_node = document->hovered_node(); @@ -321,7 +321,7 @@ Messages::WebContentServer::GetHoveredNodeIdResponse ClientConnection::get_hover return (i32)0; } -void ClientConnection::initialize_js_console(Badge<PageHost>) +void ConnectionFromClient::initialize_js_console(Badge<PageHost>) { auto* document = page().top_level_browsing_context().active_document(); auto interpreter = document->interpreter().make_weak_ptr(); @@ -333,13 +333,13 @@ void ClientConnection::initialize_js_console(Badge<PageHost>) interpreter->global_object().console().set_client(*m_console_client.ptr()); } -void ClientConnection::js_console_input(const String& js_source) +void ConnectionFromClient::js_console_input(const String& js_source) { if (m_console_client) m_console_client->handle_input(js_source); } -void ClientConnection::run_javascript(String const& js_source) +void ConnectionFromClient::run_javascript(String const& js_source) { auto* active_document = page().top_level_browsing_context().active_document(); @@ -366,24 +366,24 @@ void ClientConnection::run_javascript(String const& js_source) dbgln("Exception :("); } -void ClientConnection::js_console_request_messages(i32 start_index) +void ConnectionFromClient::js_console_request_messages(i32 start_index) { if (m_console_client) m_console_client->send_messages(start_index); } -Messages::WebContentServer::GetSelectedTextResponse ClientConnection::get_selected_text() +Messages::WebContentServer::GetSelectedTextResponse ConnectionFromClient::get_selected_text() { return page().focused_context().selected_text(); } -void ClientConnection::select_all() +void ConnectionFromClient::select_all() { page().focused_context().select_all(); page().client().page_did_change_selection(); } -Messages::WebContentServer::DumpLayoutTreeResponse ClientConnection::dump_layout_tree() +Messages::WebContentServer::DumpLayoutTreeResponse ConnectionFromClient::dump_layout_tree() { auto* document = page().top_level_browsing_context().active_document(); if (!document) @@ -396,18 +396,18 @@ Messages::WebContentServer::DumpLayoutTreeResponse ClientConnection::dump_layout return builder.to_string(); } -void ClientConnection::set_content_filters(Vector<String> const& filters) +void ConnectionFromClient::set_content_filters(Vector<String> const& filters) { for (auto& filter : filters) Web::ContentFilter::the().add_pattern(filter); } -void ClientConnection::set_preferred_color_scheme(Web::CSS::PreferredColorScheme const& color_scheme) +void ConnectionFromClient::set_preferred_color_scheme(Web::CSS::PreferredColorScheme const& color_scheme) { m_page_host->set_preferred_color_scheme(color_scheme); } -void ClientConnection::set_has_focus(bool has_focus) +void ConnectionFromClient::set_has_focus(bool has_focus) { m_page_host->set_has_focus(has_focus); } diff --git a/Userland/Services/WebContent/ClientConnection.h b/Userland/Services/WebContent/ConnectionFromClient.h index af2d79df27..ba2bbaa072 100644 --- a/Userland/Services/WebContent/ClientConnection.h +++ b/Userland/Services/WebContent/ConnectionFromClient.h @@ -7,7 +7,7 @@ #pragma once #include <AK/HashMap.h> -#include <LibIPC/ClientConnection.h> +#include <LibIPC/ConnectionFromClient.h> #include <LibJS/Forward.h> #include <LibJS/Heap/Handle.h> #include <LibWeb/CSS/PreferredColorScheme.h> @@ -20,19 +20,19 @@ namespace WebContent { -class ClientConnection final - : public IPC::ClientConnection<WebContentClientEndpoint, WebContentServerEndpoint> { - C_OBJECT(ClientConnection); +class ConnectionFromClient final + : public IPC::ConnectionFromClient<WebContentClientEndpoint, WebContentServerEndpoint> { + C_OBJECT(ConnectionFromClient); public: - ~ClientConnection() override; + ~ConnectionFromClient() override; virtual void die() override; void initialize_js_console(Badge<PageHost>); private: - explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>); + explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>); Web::Page& page(); const Web::Page& page() const; diff --git a/Userland/Services/WebContent/Documentation.txt b/Userland/Services/WebContent/Documentation.txt index 7df054985a..6d3c4ae9a8 100644 --- a/Userland/Services/WebContent/Documentation.txt +++ b/Userland/Services/WebContent/Documentation.txt @@ -7,7 +7,7 @@ Server Client WebContent GUI process (OutOfProcessWebView embedder) OutOfProcessWebView (this is a GUI::Widget) -WebContent::ClientConnection <---> WebContentClient +WebContent::ConnectionFromClient <---> WebContentClient WebContent::PageHost (Web::PageClient) Web::Page Web::Frame diff --git a/Userland/Services/WebContent/Forward.h b/Userland/Services/WebContent/Forward.h index ed9cc8aab1..05f02df860 100644 --- a/Userland/Services/WebContent/Forward.h +++ b/Userland/Services/WebContent/Forward.h @@ -8,7 +8,7 @@ namespace WebContent { -class ClientConnection; +class ConnectionFromClient; class ConsoleGlobalObject; class PageHost; class WebContentConsoleClient; diff --git a/Userland/Services/WebContent/PageHost.cpp b/Userland/Services/WebContent/PageHost.cpp index 426dceb2e1..dd8695743c 100644 --- a/Userland/Services/WebContent/PageHost.cpp +++ b/Userland/Services/WebContent/PageHost.cpp @@ -5,7 +5,7 @@ */ #include "PageHost.h" -#include "ClientConnection.h" +#include "ConnectionFromClient.h" #include <LibGfx/Painter.h> #include <LibGfx/ShareableBitmap.h> #include <LibGfx/SystemTheme.h> @@ -16,7 +16,7 @@ namespace WebContent { -PageHost::PageHost(ClientConnection& client) +PageHost::PageHost(ConnectionFromClient& client) : m_client(client) , m_page(make<Web::Page>(*this)) { diff --git a/Userland/Services/WebContent/PageHost.h b/Userland/Services/WebContent/PageHost.h index 3e8e75f4d8..cdb93dd168 100644 --- a/Userland/Services/WebContent/PageHost.h +++ b/Userland/Services/WebContent/PageHost.h @@ -11,14 +11,14 @@ namespace WebContent { -class ClientConnection; +class ConnectionFromClient; class PageHost final : public Web::PageClient { AK_MAKE_NONCOPYABLE(PageHost); AK_MAKE_NONMOVABLE(PageHost); public: - static NonnullOwnPtr<PageHost> create(ClientConnection& client) { return adopt_own(*new PageHost(client)); } + static NonnullOwnPtr<PageHost> create(ConnectionFromClient& client) { return adopt_own(*new PageHost(client)); } virtual ~PageHost(); Web::Page& page() { return *m_page; } @@ -65,12 +65,12 @@ private: virtual String page_did_request_cookie(const URL&, Web::Cookie::Source) override; virtual void page_did_set_cookie(const URL&, const Web::Cookie::ParsedCookie&, Web::Cookie::Source) override; - explicit PageHost(ClientConnection&); + explicit PageHost(ConnectionFromClient&); Web::Layout::InitialContainingBlock* layout_root(); void setup_palette(); - ClientConnection& m_client; + ConnectionFromClient& m_client; NonnullOwnPtr<Web::Page> m_page; RefPtr<Gfx::PaletteImpl> m_palette_impl; Gfx::IntRect m_screen_rect; diff --git a/Userland/Services/WebContent/WebContentConsoleClient.cpp b/Userland/Services/WebContent/WebContentConsoleClient.cpp index f33ba5143b..5075837707 100644 --- a/Userland/Services/WebContent/WebContentConsoleClient.cpp +++ b/Userland/Services/WebContent/WebContentConsoleClient.cpp @@ -16,7 +16,7 @@ namespace WebContent { -WebContentConsoleClient::WebContentConsoleClient(JS::Console& console, WeakPtr<JS::Interpreter> interpreter, ClientConnection& client) +WebContentConsoleClient::WebContentConsoleClient(JS::Console& console, WeakPtr<JS::Interpreter> interpreter, ConnectionFromClient& client) : ConsoleClient(console) , m_client(client) , m_interpreter(interpreter) diff --git a/Userland/Services/WebContent/WebContentConsoleClient.h b/Userland/Services/WebContent/WebContentConsoleClient.h index d9e0167202..9456750d55 100644 --- a/Userland/Services/WebContent/WebContentConsoleClient.h +++ b/Userland/Services/WebContent/WebContentConsoleClient.h @@ -8,7 +8,7 @@ #pragma once -#include "ClientConnection.h" +#include "ConnectionFromClient.h" #include <LibJS/Console.h> #include <LibJS/Forward.h> #include <LibWeb/Forward.h> @@ -18,7 +18,7 @@ namespace WebContent { class WebContentConsoleClient final : public JS::ConsoleClient { public: - WebContentConsoleClient(JS::Console&, WeakPtr<JS::Interpreter>, ClientConnection&); + WebContentConsoleClient(JS::Console&, WeakPtr<JS::Interpreter>, ConnectionFromClient&); void handle_input(String const& js_source); void send_messages(i32 start_index); @@ -27,7 +27,7 @@ private: virtual void clear() override; virtual JS::ThrowCompletionOr<JS::Value> printer(JS::Console::LogLevel log_level, PrinterArguments) override; - ClientConnection& m_client; + ConnectionFromClient& m_client; WeakPtr<JS::Interpreter> m_interpreter; JS::Handle<ConsoleGlobalObject> m_console_global_object; diff --git a/Userland/Services/WebContent/main.cpp b/Userland/Services/WebContent/main.cpp index 2c51f2f761..351fd4b159 100644 --- a/Userland/Services/WebContent/main.cpp +++ b/Userland/Services/WebContent/main.cpp @@ -9,7 +9,7 @@ #include <LibCore/System.h> #include <LibIPC/SingleServer.h> #include <LibMain/Main.h> -#include <WebContent/ClientConnection.h> +#include <WebContent/ConnectionFromClient.h> ErrorOr<int> serenity_main(Main::Arguments) { @@ -22,6 +22,6 @@ ErrorOr<int> serenity_main(Main::Arguments) TRY(Core::System::unveil("/tmp/portal/websocket", "rw")); TRY(Core::System::unveil(nullptr, nullptr)); - auto client = TRY(IPC::take_over_accepted_client_from_system_server<WebContent::ClientConnection>()); + auto client = TRY(IPC::take_over_accepted_client_from_system_server<WebContent::ConnectionFromClient>()); return event_loop.exec(); } diff --git a/Userland/Services/WebSocket/CMakeLists.txt b/Userland/Services/WebSocket/CMakeLists.txt index 798b01e8f8..21e7039bf0 100644 --- a/Userland/Services/WebSocket/CMakeLists.txt +++ b/Userland/Services/WebSocket/CMakeLists.txt @@ -7,7 +7,7 @@ compile_ipc(WebSocketServer.ipc WebSocketServerEndpoint.h) compile_ipc(WebSocketClient.ipc WebSocketClientEndpoint.h) set(SOURCES - ClientConnection.cpp + ConnectionFromClient.cpp main.cpp WebSocketClientEndpoint.h WebSocketServerEndpoint.h diff --git a/Userland/Services/WebSocket/ClientConnection.cpp b/Userland/Services/WebSocket/ConnectionFromClient.cpp index ba07ff5ff1..52ee645895 100644 --- a/Userland/Services/WebSocket/ClientConnection.cpp +++ b/Userland/Services/WebSocket/ConnectionFromClient.cpp @@ -6,31 +6,31 @@ #include <LibWebSocket/ConnectionInfo.h> #include <LibWebSocket/Message.h> -#include <WebSocket/ClientConnection.h> +#include <WebSocket/ConnectionFromClient.h> #include <WebSocket/WebSocketClientEndpoint.h> namespace WebSocket { -static HashMap<int, RefPtr<ClientConnection>> s_connections; +static HashMap<int, RefPtr<ConnectionFromClient>> s_connections; -ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket) - : IPC::ClientConnection<WebSocketClientEndpoint, WebSocketServerEndpoint>(*this, move(socket), 1) +ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket) + : IPC::ConnectionFromClient<WebSocketClientEndpoint, WebSocketServerEndpoint>(*this, move(socket), 1) { s_connections.set(1, *this); } -ClientConnection::~ClientConnection() +ConnectionFromClient::~ConnectionFromClient() { } -void ClientConnection::die() +void ConnectionFromClient::die() { s_connections.remove(client_id()); if (s_connections.is_empty()) Core::EventLoop::current().quit(0); } -Messages::WebSocketServer::ConnectResponse ClientConnection::connect(URL const& url, String const& origin, +Messages::WebSocketServer::ConnectResponse ConnectionFromClient::connect(URL const& url, String const& origin, Vector<String> const& protocols, Vector<String> const& extensions, IPC::Dictionary const& additional_request_headers) { if (!url.is_valid()) { @@ -70,7 +70,7 @@ Messages::WebSocketServer::ConnectResponse ClientConnection::connect(URL const& return id; } -Messages::WebSocketServer::ReadyStateResponse ClientConnection::ready_state(i32 connection_id) +Messages::WebSocketServer::ReadyStateResponse ConnectionFromClient::ready_state(i32 connection_id) { RefPtr<WebSocket> connection = m_connections.get(connection_id).value_or({}); if (connection) { @@ -79,7 +79,7 @@ Messages::WebSocketServer::ReadyStateResponse ClientConnection::ready_state(i32 return (u32)ReadyState::Closed; } -void ClientConnection::send(i32 connection_id, bool is_text, ByteBuffer const& data) +void ConnectionFromClient::send(i32 connection_id, bool is_text, ByteBuffer const& data) { RefPtr<WebSocket> connection = m_connections.get(connection_id).value_or({}); if (connection && connection->ready_state() == ReadyState::Open) { @@ -88,14 +88,14 @@ void ClientConnection::send(i32 connection_id, bool is_text, ByteBuffer const& d } } -void ClientConnection::close(i32 connection_id, u16 code, String const& reason) +void ConnectionFromClient::close(i32 connection_id, u16 code, String const& reason) { RefPtr<WebSocket> connection = m_connections.get(connection_id).value_or({}); if (connection && connection->ready_state() == ReadyState::Open) connection->close(code, reason); } -Messages::WebSocketServer::SetCertificateResponse ClientConnection::set_certificate(i32 connection_id, +Messages::WebSocketServer::SetCertificateResponse ConnectionFromClient::set_certificate(i32 connection_id, [[maybe_unused]] String const& certificate, [[maybe_unused]] String const& key) { RefPtr<WebSocket> connection = m_connections.get(connection_id).value_or({}); @@ -108,22 +108,22 @@ Messages::WebSocketServer::SetCertificateResponse ClientConnection::set_certific return success; } -void ClientConnection::did_connect(i32 connection_id) +void ConnectionFromClient::did_connect(i32 connection_id) { async_connected(connection_id); } -void ClientConnection::did_receive_message(i32 connection_id, Message message) +void ConnectionFromClient::did_receive_message(i32 connection_id, Message message) { async_received(connection_id, message.is_text(), message.data()); } -void ClientConnection::did_error(i32 connection_id, i32 message) +void ConnectionFromClient::did_error(i32 connection_id, i32 message) { async_errored(connection_id, message); } -void ClientConnection::did_close(i32 connection_id, u16 code, String reason, bool was_clean) +void ConnectionFromClient::did_close(i32 connection_id, u16 code, String reason, bool was_clean) { async_closed(connection_id, code, reason, was_clean); deferred_invoke([this, connection_id] { @@ -131,7 +131,7 @@ void ClientConnection::did_close(i32 connection_id, u16 code, String reason, boo }); } -void ClientConnection::did_request_certificates(i32 connection_id) +void ConnectionFromClient::did_request_certificates(i32 connection_id) { async_certificate_requested(connection_id); } diff --git a/Userland/Services/WebSocket/ClientConnection.h b/Userland/Services/WebSocket/ConnectionFromClient.h index 105fd07239..4ac2499ec6 100644 --- a/Userland/Services/WebSocket/ClientConnection.h +++ b/Userland/Services/WebSocket/ConnectionFromClient.h @@ -7,24 +7,24 @@ #pragma once #include <AK/HashMap.h> -#include <LibIPC/ClientConnection.h> +#include <LibIPC/ConnectionFromClient.h> #include <LibWebSocket/WebSocket.h> #include <WebSocket/WebSocketClientEndpoint.h> #include <WebSocket/WebSocketServerEndpoint.h> namespace WebSocket { -class ClientConnection final - : public IPC::ClientConnection<WebSocketClientEndpoint, WebSocketServerEndpoint> { - C_OBJECT(ClientConnection); +class ConnectionFromClient final + : public IPC::ConnectionFromClient<WebSocketClientEndpoint, WebSocketServerEndpoint> { + C_OBJECT(ConnectionFromClient); public: - ~ClientConnection() override; + ~ConnectionFromClient() override; virtual void die() override; private: - explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>); + explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>); 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; diff --git a/Userland/Services/WebSocket/main.cpp b/Userland/Services/WebSocket/main.cpp index 60cc4ce3af..054bb7e681 100644 --- a/Userland/Services/WebSocket/main.cpp +++ b/Userland/Services/WebSocket/main.cpp @@ -10,7 +10,7 @@ #include <LibIPC/SingleServer.h> #include <LibMain/Main.h> #include <LibTLS/Certificate.h> -#include <WebSocket/ClientConnection.h> +#include <WebSocket/ConnectionFromClient.h> ErrorOr<int> serenity_main(Main::Arguments) { @@ -25,7 +25,7 @@ ErrorOr<int> serenity_main(Main::Arguments) TRY(Core::System::unveil("/etc/timezone", "r")); TRY(Core::System::unveil(nullptr, nullptr)); - auto client = TRY(IPC::take_over_accepted_client_from_system_server<WebSocket::ClientConnection>()); + auto client = TRY(IPC::take_over_accepted_client_from_system_server<WebSocket::ConnectionFromClient>()); return event_loop.exec(); } diff --git a/Userland/Services/WindowServer/CMakeLists.txt b/Userland/Services/WindowServer/CMakeLists.txt index f412145ea4..96d7cde7ef 100644 --- a/Userland/Services/WindowServer/CMakeLists.txt +++ b/Userland/Services/WindowServer/CMakeLists.txt @@ -13,7 +13,7 @@ set(SOURCES Animation.cpp AppletManager.cpp Button.cpp - ClientConnection.cpp + ConnectionFromClient.cpp Compositor.cpp Cursor.cpp EventLoop.cpp @@ -35,7 +35,7 @@ set(SOURCES WindowClientEndpoint.h WindowManagerServerEndpoint.h WindowManagerClientEndpoint.h - WMClientConnection.cpp + WMConnectionFromClient.cpp KeymapSwitcher.cpp ) diff --git a/Userland/Services/WindowServer/Compositor.cpp b/Userland/Services/WindowServer/Compositor.cpp index 41a278d651..af9a16e3f8 100644 --- a/Userland/Services/WindowServer/Compositor.cpp +++ b/Userland/Services/WindowServer/Compositor.cpp @@ -6,7 +6,7 @@ #include "Compositor.h" #include "Animation.h" -#include "ClientConnection.h" +#include "ConnectionFromClient.h" #include "Event.h" #include "EventLoop.h" #include "MultiScaleBitmaps.h" @@ -66,19 +66,19 @@ Compositor::Compositor() init_bitmaps(); } -const Gfx::Bitmap* Compositor::cursor_bitmap_for_screenshot(Badge<ClientConnection>, Screen& screen) const +const Gfx::Bitmap* Compositor::cursor_bitmap_for_screenshot(Badge<ConnectionFromClient>, Screen& screen) const { if (!m_current_cursor) return nullptr; return &m_current_cursor->bitmap(screen.scale_factor()); } -const Gfx::Bitmap& Compositor::front_bitmap_for_screenshot(Badge<ClientConnection>, Screen& screen) const +const Gfx::Bitmap& Compositor::front_bitmap_for_screenshot(Badge<ConnectionFromClient>, Screen& screen) const { return *screen.compositor_screen_data().m_front_bitmap; } -Gfx::Color Compositor::color_at_position(Badge<ClientConnection>, Screen& screen, Gfx::IntPoint const& position) const +Gfx::Color Compositor::color_at_position(Badge<ConnectionFromClient>, Screen& screen, Gfx::IntPoint const& position) const { return screen.compositor_screen_data().m_front_bitmap->get_pixel(position); } @@ -977,19 +977,19 @@ void Compositor::update_fonts() void Compositor::notify_display_links() { - ClientConnection::for_each_client([](auto& client) { + ConnectionFromClient::for_each_client([](auto& client) { client.notify_display_link({}); }); } -void Compositor::increment_display_link_count(Badge<ClientConnection>) +void Compositor::increment_display_link_count(Badge<ConnectionFromClient>) { ++m_display_link_count; if (m_display_link_count == 1) m_display_link_notify_timer->start(); } -void Compositor::decrement_display_link_count(Badge<ClientConnection>) +void Compositor::decrement_display_link_count(Badge<ConnectionFromClient>) { VERIFY(m_display_link_count); --m_display_link_count; @@ -1007,7 +1007,7 @@ void Compositor::invalidate_current_screen_number_rects() }); } -void Compositor::increment_show_screen_number(Badge<ClientConnection>) +void Compositor::increment_show_screen_number(Badge<ConnectionFromClient>) { if (m_show_screen_number_count++ == 0) { Screen::for_each([&](auto& screen) { @@ -1019,7 +1019,7 @@ void Compositor::increment_show_screen_number(Badge<ClientConnection>) }); } } -void Compositor::decrement_show_screen_number(Badge<ClientConnection>) +void Compositor::decrement_show_screen_number(Badge<ConnectionFromClient>) { if (--m_show_screen_number_count == 0) { invalidate_current_screen_number_rects(); diff --git a/Userland/Services/WindowServer/Compositor.h b/Userland/Services/WindowServer/Compositor.h index 13e4c7b83d..187e9ab272 100644 --- a/Userland/Services/WindowServer/Compositor.h +++ b/Userland/Services/WindowServer/Compositor.h @@ -17,7 +17,7 @@ namespace WindowServer { class Animation; -class ClientConnection; +class ConnectionFromClient; class Compositor; class Cursor; class MultiScaleBitmaps; @@ -113,11 +113,11 @@ public: const Cursor* current_cursor() const { return m_current_cursor; } void current_cursor_was_reloaded(const Cursor* new_cursor) { m_current_cursor = new_cursor; } - void increment_display_link_count(Badge<ClientConnection>); - void decrement_display_link_count(Badge<ClientConnection>); + void increment_display_link_count(Badge<ConnectionFromClient>); + void decrement_display_link_count(Badge<ConnectionFromClient>); - void increment_show_screen_number(Badge<ClientConnection>); - void decrement_show_screen_number(Badge<ClientConnection>); + void increment_show_screen_number(Badge<ConnectionFromClient>); + void decrement_show_screen_number(Badge<ConnectionFromClient>); bool showing_screen_numbers() const { return m_show_screen_number_count > 0; } void invalidate_after_theme_or_font_change() @@ -174,9 +174,9 @@ public: void did_construct_window_manager(Badge<WindowManager>); - const Gfx::Bitmap* cursor_bitmap_for_screenshot(Badge<ClientConnection>, Screen&) const; - const Gfx::Bitmap& front_bitmap_for_screenshot(Badge<ClientConnection>, Screen&) const; - Gfx::Color color_at_position(Badge<ClientConnection>, Screen&, Gfx::IntPoint const&) const; + const Gfx::Bitmap* cursor_bitmap_for_screenshot(Badge<ConnectionFromClient>, Screen&) const; + const Gfx::Bitmap& front_bitmap_for_screenshot(Badge<ConnectionFromClient>, Screen&) const; + Gfx::Color color_at_position(Badge<ConnectionFromClient>, Screen&, Gfx::IntPoint const&) const; void register_animation(Badge<Animation>, Animation&); void unregister_animation(Badge<Animation>, Animation&); diff --git a/Userland/Services/WindowServer/ClientConnection.cpp b/Userland/Services/WindowServer/ConnectionFromClient.cpp index 44dbdf3696..aebd1f3e72 100644 --- a/Userland/Services/WindowServer/ClientConnection.cpp +++ b/Userland/Services/WindowServer/ConnectionFromClient.cpp @@ -9,8 +9,8 @@ #include <LibGfx/StandardCursor.h> #include <LibGfx/SystemTheme.h> #include <WindowServer/AppletManager.h> -#include <WindowServer/ClientConnection.h> #include <WindowServer/Compositor.h> +#include <WindowServer/ConnectionFromClient.h> #include <WindowServer/Menu.h> #include <WindowServer/MenuItem.h> #include <WindowServer/Screen.h> @@ -24,9 +24,9 @@ namespace WindowServer { -HashMap<int, NonnullRefPtr<ClientConnection>>* s_connections; +HashMap<int, NonnullRefPtr<ConnectionFromClient>>* s_connections; -void ClientConnection::for_each_client(Function<void(ClientConnection&)> callback) +void ConnectionFromClient::for_each_client(Function<void(ConnectionFromClient&)> callback) { if (!s_connections) return; @@ -35,7 +35,7 @@ void ClientConnection::for_each_client(Function<void(ClientConnection&)> callbac } } -ClientConnection* ClientConnection::from_client_id(int client_id) +ConnectionFromClient* ConnectionFromClient::from_client_id(int client_id) { if (!s_connections) return nullptr; @@ -45,18 +45,18 @@ ClientConnection* ClientConnection::from_client_id(int client_id) return (*it).value.ptr(); } -ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id) - : IPC::ClientConnection<WindowClientEndpoint, WindowServerEndpoint>(*this, move(client_socket), client_id) +ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id) + : IPC::ConnectionFromClient<WindowClientEndpoint, WindowServerEndpoint>(*this, move(client_socket), client_id) { if (!s_connections) - s_connections = new HashMap<int, NonnullRefPtr<ClientConnection>>; + s_connections = new HashMap<int, NonnullRefPtr<ConnectionFromClient>>; s_connections->set(client_id, *this); auto& wm = WindowManager::the(); async_fast_greet(Screen::rects(), Screen::main().index(), wm.window_stack_rows(), wm.window_stack_columns(), Gfx::current_system_theme_buffer(), Gfx::FontDatabase::default_font_query(), Gfx::FontDatabase::fixed_width_font_query(), client_id); } -ClientConnection::~ClientConnection() +ConnectionFromClient::~ConnectionFromClient() { auto& wm = WindowManager::the(); if (wm.dnd_client() == this) @@ -77,26 +77,26 @@ ClientConnection::~ClientConnection() Compositor::the().decrement_show_screen_number({}); } -void ClientConnection::die() +void ConnectionFromClient::die() { deferred_invoke([this] { s_connections->remove(client_id()); }); } -void ClientConnection::notify_about_new_screen_rects() +void ConnectionFromClient::notify_about_new_screen_rects() { auto& wm = WindowManager::the(); async_screen_rects_changed(Screen::rects(), Screen::main().index(), wm.window_stack_rows(), wm.window_stack_columns()); } -void ClientConnection::create_menu(i32 menu_id, String const& menu_title) +void ConnectionFromClient::create_menu(i32 menu_id, String const& menu_title) { auto menu = Menu::construct(this, menu_id, menu_title); m_menus.set(menu_id, move(menu)); } -void ClientConnection::destroy_menu(i32 menu_id) +void ConnectionFromClient::destroy_menu(i32 menu_id) { auto it = m_menus.find(menu_id); if (it == m_menus.end()) { @@ -109,7 +109,7 @@ void ClientConnection::destroy_menu(i32 menu_id) remove_child(menu); } -void ClientConnection::add_menu(i32 window_id, i32 menu_id) +void ConnectionFromClient::add_menu(i32 window_id, i32 menu_id) { auto it = m_windows.find(window_id); auto jt = m_menus.find(menu_id); @@ -126,7 +126,7 @@ void ClientConnection::add_menu(i32 window_id, i32 menu_id) window.add_menu(menu); } -void ClientConnection::add_menu_item(i32 menu_id, i32 identifier, i32 submenu_id, +void ConnectionFromClient::add_menu_item(i32 menu_id, i32 identifier, i32 submenu_id, String const& text, bool enabled, bool checkable, bool checked, bool is_default, String const& shortcut, Gfx::ShareableBitmap const& icon, bool exclusive) { @@ -145,7 +145,7 @@ void ClientConnection::add_menu_item(i32 menu_id, i32 identifier, i32 submenu_id menu.add_item(move(menu_item)); } -void ClientConnection::popup_menu(i32 menu_id, Gfx::IntPoint const& screen_position) +void ConnectionFromClient::popup_menu(i32 menu_id, Gfx::IntPoint const& screen_position) { auto position = screen_position; auto it = m_menus.find(menu_id); @@ -157,7 +157,7 @@ void ClientConnection::popup_menu(i32 menu_id, Gfx::IntPoint const& screen_posit menu.popup(position); } -void ClientConnection::dismiss_menu(i32 menu_id) +void ConnectionFromClient::dismiss_menu(i32 menu_id) { auto it = m_menus.find(menu_id); if (it == m_menus.end()) { @@ -168,7 +168,7 @@ void ClientConnection::dismiss_menu(i32 menu_id) menu.close(); } -void ClientConnection::update_menu_item(i32 menu_id, i32 identifier, [[maybe_unused]] i32 submenu_id, +void ConnectionFromClient::update_menu_item(i32 menu_id, i32 identifier, [[maybe_unused]] i32 submenu_id, String const& text, bool enabled, bool checkable, bool checked, bool is_default, String const& shortcut) { @@ -192,7 +192,7 @@ void ClientConnection::update_menu_item(i32 menu_id, i32 identifier, [[maybe_unu menu_item->set_checked(checked); } -void ClientConnection::remove_menu_item(i32 menu_id, i32 identifier) +void ConnectionFromClient::remove_menu_item(i32 menu_id, i32 identifier) { auto it = m_menus.find(menu_id); if (it == m_menus.end()) { @@ -204,7 +204,7 @@ void ClientConnection::remove_menu_item(i32 menu_id, i32 identifier) did_misbehave("RemoveMenuItem: Bad menu item identifier"); } -void ClientConnection::flash_menubar_menu(i32 window_id, i32 menu_id) +void ConnectionFromClient::flash_menubar_menu(i32 window_id, i32 menu_id) { auto itw = m_windows.find(window_id); if (itw == m_windows.end()) { @@ -240,7 +240,7 @@ void ClientConnection::flash_menubar_menu(i32 window_id, i32 menu_id) } } -void ClientConnection::add_menu_separator(i32 menu_id) +void ConnectionFromClient::add_menu_separator(i32 menu_id) { auto it = m_menus.find(menu_id); if (it == m_menus.end()) { @@ -251,7 +251,7 @@ void ClientConnection::add_menu_separator(i32 menu_id) menu.add_item(make<MenuItem>(menu, MenuItem::Separator)); } -void ClientConnection::move_window_to_front(i32 window_id) +void ConnectionFromClient::move_window_to_front(i32 window_id) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -261,7 +261,7 @@ void ClientConnection::move_window_to_front(i32 window_id) WindowManager::the().move_to_front_and_make_active(*(*it).value); } -void ClientConnection::set_fullscreen(i32 window_id, bool fullscreen) +void ConnectionFromClient::set_fullscreen(i32 window_id, bool fullscreen) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -271,7 +271,7 @@ void ClientConnection::set_fullscreen(i32 window_id, bool fullscreen) it->value->set_fullscreen(fullscreen); } -void ClientConnection::set_frameless(i32 window_id, bool frameless) +void ConnectionFromClient::set_frameless(i32 window_id, bool frameless) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -282,7 +282,7 @@ void ClientConnection::set_frameless(i32 window_id, bool frameless) WindowManager::the().tell_wms_window_state_changed(*it->value); } -void ClientConnection::set_forced_shadow(i32 window_id, bool shadow) +void ConnectionFromClient::set_forced_shadow(i32 window_id, bool shadow) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -294,7 +294,7 @@ void ClientConnection::set_forced_shadow(i32 window_id, bool shadow) Compositor::the().invalidate_occlusions(); } -void ClientConnection::set_window_opacity(i32 window_id, float opacity) +void ConnectionFromClient::set_window_opacity(i32 window_id, float opacity) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -304,47 +304,47 @@ void ClientConnection::set_window_opacity(i32 window_id, float opacity) it->value->set_opacity(opacity); } -void ClientConnection::set_wallpaper(Gfx::ShareableBitmap const& bitmap) +void ConnectionFromClient::set_wallpaper(Gfx::ShareableBitmap const& bitmap) { Compositor::the().set_wallpaper(bitmap.bitmap()); async_set_wallpaper_finished(true); } -void ClientConnection::set_background_color(String const& background_color) +void ConnectionFromClient::set_background_color(String const& background_color) { Compositor::the().set_background_color(background_color); } -void ClientConnection::set_wallpaper_mode(String const& mode) +void ConnectionFromClient::set_wallpaper_mode(String const& mode) { Compositor::the().set_wallpaper_mode(mode); } -Messages::WindowServer::GetWallpaperResponse ClientConnection::get_wallpaper() +Messages::WindowServer::GetWallpaperResponse ConnectionFromClient::get_wallpaper() { return Compositor::the().wallpaper_bitmap()->to_shareable_bitmap(); } -Messages::WindowServer::SetScreenLayoutResponse ClientConnection::set_screen_layout(ScreenLayout const& screen_layout, bool save) +Messages::WindowServer::SetScreenLayoutResponse ConnectionFromClient::set_screen_layout(ScreenLayout const& screen_layout, bool save) { String error_msg; bool success = WindowManager::the().set_screen_layout(ScreenLayout(screen_layout), save, error_msg); return { success, move(error_msg) }; } -Messages::WindowServer::GetScreenLayoutResponse ClientConnection::get_screen_layout() +Messages::WindowServer::GetScreenLayoutResponse ConnectionFromClient::get_screen_layout() { return { WindowManager::the().get_screen_layout() }; } -Messages::WindowServer::SaveScreenLayoutResponse ClientConnection::save_screen_layout() +Messages::WindowServer::SaveScreenLayoutResponse ConnectionFromClient::save_screen_layout() { String error_msg; bool success = WindowManager::the().save_screen_layout(error_msg); return { success, move(error_msg) }; } -Messages::WindowServer::ApplyWorkspaceSettingsResponse ClientConnection::apply_workspace_settings(u32 rows, u32 columns, bool save) +Messages::WindowServer::ApplyWorkspaceSettingsResponse ConnectionFromClient::apply_workspace_settings(u32 rows, u32 columns, bool save) { if (rows == 0 || columns == 0 || rows > WindowManager::max_window_stack_rows || columns > WindowManager::max_window_stack_columns) return { false }; @@ -352,13 +352,13 @@ Messages::WindowServer::ApplyWorkspaceSettingsResponse ClientConnection::apply_w return { WindowManager::the().apply_workspace_settings(rows, columns, save) }; } -Messages::WindowServer::GetWorkspaceSettingsResponse ClientConnection::get_workspace_settings() +Messages::WindowServer::GetWorkspaceSettingsResponse ConnectionFromClient::get_workspace_settings() { auto& wm = WindowManager::the(); return { (unsigned)wm.window_stack_rows(), (unsigned)wm.window_stack_columns(), WindowManager::max_window_stack_rows, WindowManager::max_window_stack_columns }; } -void ClientConnection::show_screen_numbers(bool show) +void ConnectionFromClient::show_screen_numbers(bool show) { if (m_show_screen_number == show) return; @@ -369,7 +369,7 @@ void ClientConnection::show_screen_numbers(bool show) Compositor::the().decrement_show_screen_number({}); } -void ClientConnection::set_window_title(i32 window_id, String const& title) +void ConnectionFromClient::set_window_title(i32 window_id, String const& title) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -379,7 +379,7 @@ void ClientConnection::set_window_title(i32 window_id, String const& title) it->value->set_title(title); } -Messages::WindowServer::GetWindowTitleResponse ClientConnection::get_window_title(i32 window_id) +Messages::WindowServer::GetWindowTitleResponse ConnectionFromClient::get_window_title(i32 window_id) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -389,7 +389,7 @@ Messages::WindowServer::GetWindowTitleResponse ClientConnection::get_window_titl return it->value->title(); } -Messages::WindowServer::IsMaximizedResponse ClientConnection::is_maximized(i32 window_id) +Messages::WindowServer::IsMaximizedResponse ConnectionFromClient::is_maximized(i32 window_id) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -399,7 +399,7 @@ Messages::WindowServer::IsMaximizedResponse ClientConnection::is_maximized(i32 w return it->value->is_maximized(); } -void ClientConnection::set_maximized(i32 window_id, bool maximized) +void ConnectionFromClient::set_maximized(i32 window_id, bool maximized) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -409,7 +409,7 @@ void ClientConnection::set_maximized(i32 window_id, bool maximized) it->value->set_maximized(maximized); } -void ClientConnection::set_window_icon_bitmap(i32 window_id, Gfx::ShareableBitmap const& icon) +void ConnectionFromClient::set_window_icon_bitmap(i32 window_id, Gfx::ShareableBitmap const& icon) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -428,7 +428,7 @@ void ClientConnection::set_window_icon_bitmap(i32 window_id, Gfx::ShareableBitma WindowManager::the().tell_wms_window_icon_changed(window); } -Messages::WindowServer::SetWindowRectResponse ClientConnection::set_window_rect(i32 window_id, Gfx::IntRect const& rect) +Messages::WindowServer::SetWindowRectResponse ConnectionFromClient::set_window_rect(i32 window_id, Gfx::IntRect const& rect) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -437,7 +437,7 @@ Messages::WindowServer::SetWindowRectResponse ClientConnection::set_window_rect( } auto& window = *(*it).value; if (window.is_fullscreen()) { - dbgln("ClientConnection: Ignoring SetWindowRect request for fullscreen window"); + dbgln("ConnectionFromClient: Ignoring SetWindowRect request for fullscreen window"); return nullptr; } if (rect.width() > INT16_MAX || rect.height() > INT16_MAX) { @@ -456,7 +456,7 @@ Messages::WindowServer::SetWindowRectResponse ClientConnection::set_window_rect( return window.rect(); } -Messages::WindowServer::GetWindowRectResponse ClientConnection::get_window_rect(i32 window_id) +Messages::WindowServer::GetWindowRectResponse ConnectionFromClient::get_window_rect(i32 window_id) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -466,7 +466,7 @@ Messages::WindowServer::GetWindowRectResponse ClientConnection::get_window_rect( return it->value->rect(); } -void ClientConnection::set_window_minimum_size(i32 window_id, Gfx::IntSize const& size) +void ConnectionFromClient::set_window_minimum_size(i32 window_id, Gfx::IntSize const& size) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -475,7 +475,7 @@ void ClientConnection::set_window_minimum_size(i32 window_id, Gfx::IntSize const } auto& window = *(*it).value; if (window.is_fullscreen()) { - dbgln("ClientConnection: Ignoring SetWindowMinimumSize request for fullscreen window"); + dbgln("ConnectionFromClient: Ignoring SetWindowMinimumSize request for fullscreen window"); return; } @@ -494,7 +494,7 @@ void ClientConnection::set_window_minimum_size(i32 window_id, Gfx::IntSize const } } -Messages::WindowServer::GetWindowMinimumSizeResponse ClientConnection::get_window_minimum_size(i32 window_id) +Messages::WindowServer::GetWindowMinimumSizeResponse ConnectionFromClient::get_window_minimum_size(i32 window_id) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -504,7 +504,7 @@ Messages::WindowServer::GetWindowMinimumSizeResponse ClientConnection::get_windo return it->value->minimum_size(); } -Messages::WindowServer::GetAppletRectOnScreenResponse ClientConnection::get_applet_rect_on_screen(i32 window_id) +Messages::WindowServer::GetAppletRectOnScreenResponse ConnectionFromClient::get_applet_rect_on_screen(i32 window_id) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -519,7 +519,7 @@ Messages::WindowServer::GetAppletRectOnScreenResponse ClientConnection::get_appl return it->value->rect_in_applet_area().translated(applet_area_rect.location()); } -Window* ClientConnection::window_from_id(i32 window_id) +Window* ConnectionFromClient::window_from_id(i32 window_id) { auto it = m_windows.find(window_id); if (it == m_windows.end()) @@ -527,7 +527,7 @@ Window* ClientConnection::window_from_id(i32 window_id) return it->value.ptr(); } -void ClientConnection::create_window(i32 window_id, Gfx::IntRect const& rect, +void ConnectionFromClient::create_window(i32 window_id, Gfx::IntRect const& rect, bool auto_position, bool has_alpha_channel, bool modal, bool minimizable, bool closeable, bool resizable, bool fullscreen, bool frameless, bool forced_shadow, bool accessory, float opacity, float alpha_hit_threshold, Gfx::IntSize const& base_size, Gfx::IntSize const& size_increment, @@ -592,7 +592,7 @@ void ClientConnection::create_window(i32 window_id, Gfx::IntRect const& rect, m_windows.set(window_id, move(window)); } -void ClientConnection::destroy_window(Window& window, Vector<i32>& destroyed_window_ids) +void ConnectionFromClient::destroy_window(Window& window, Vector<i32>& destroyed_window_ids) { for (auto& child_window : window.child_windows()) { if (!child_window) @@ -618,7 +618,7 @@ void ClientConnection::destroy_window(Window& window, Vector<i32>& destroyed_win m_windows.remove(window.window_id()); } -Messages::WindowServer::DestroyWindowResponse ClientConnection::destroy_window(i32 window_id) +Messages::WindowServer::DestroyWindowResponse ConnectionFromClient::destroy_window(i32 window_id) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -631,7 +631,7 @@ Messages::WindowServer::DestroyWindowResponse ClientConnection::destroy_window(i return destroyed_window_ids; } -void ClientConnection::post_paint_message(Window& window, bool ignore_occlusion) +void ConnectionFromClient::post_paint_message(Window& window, bool ignore_occlusion) { auto rect_set = window.take_pending_paint_rects(); if (window.is_minimized() || (!ignore_occlusion && window.is_occluded())) @@ -640,7 +640,7 @@ void ClientConnection::post_paint_message(Window& window, bool ignore_occlusion) async_paint(window.window_id(), window.size(), rect_set.rects()); } -void ClientConnection::invalidate_rect(i32 window_id, Vector<Gfx::IntRect> const& rects, bool ignore_occlusion) +void ConnectionFromClient::invalidate_rect(i32 window_id, Vector<Gfx::IntRect> const& rects, bool ignore_occlusion) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -652,7 +652,7 @@ void ClientConnection::invalidate_rect(i32 window_id, Vector<Gfx::IntRect> const window.request_update(rects[i].intersected({ {}, window.size() }), ignore_occlusion); } -void ClientConnection::did_finish_painting(i32 window_id, Vector<Gfx::IntRect> const& rects) +void ConnectionFromClient::did_finish_painting(i32 window_id, Vector<Gfx::IntRect> const& rects) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -668,7 +668,7 @@ void ClientConnection::did_finish_painting(i32 window_id, Vector<Gfx::IntRect> c WindowSwitcher::the().refresh_if_needed(); } -void ClientConnection::set_window_backing_store(i32 window_id, [[maybe_unused]] i32 bpp, +void ConnectionFromClient::set_window_backing_store(i32 window_id, [[maybe_unused]] i32 bpp, [[maybe_unused]] i32 pitch, IPC::File const& anon_file, i32 serial, bool has_alpha_channel, Gfx::IntSize const& size, bool flush_immediately) { @@ -703,12 +703,12 @@ void ClientConnection::set_window_backing_store(i32 window_id, [[maybe_unused]] window.invalidate(false); } -void ClientConnection::set_global_mouse_tracking(bool enabled) +void ConnectionFromClient::set_global_mouse_tracking(bool enabled) { m_does_global_mouse_tracking = enabled; } -void ClientConnection::set_window_cursor(i32 window_id, i32 cursor_type) +void ConnectionFromClient::set_window_cursor(i32 window_id, i32 cursor_type) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -725,7 +725,7 @@ void ClientConnection::set_window_cursor(i32 window_id, i32 cursor_type) Compositor::the().invalidate_cursor(); } -void ClientConnection::set_window_custom_cursor(i32 window_id, Gfx::ShareableBitmap const& cursor) +void ConnectionFromClient::set_window_custom_cursor(i32 window_id, Gfx::ShareableBitmap const& cursor) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -743,7 +743,7 @@ void ClientConnection::set_window_custom_cursor(i32 window_id, Gfx::ShareableBit Compositor::the().invalidate_cursor(); } -void ClientConnection::set_window_has_alpha_channel(i32 window_id, bool has_alpha_channel) +void ConnectionFromClient::set_window_has_alpha_channel(i32 window_id, bool has_alpha_channel) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -753,7 +753,7 @@ void ClientConnection::set_window_has_alpha_channel(i32 window_id, bool has_alph it->value->set_has_alpha_channel(has_alpha_channel); } -void ClientConnection::set_window_alpha_hit_threshold(i32 window_id, float threshold) +void ConnectionFromClient::set_window_alpha_hit_threshold(i32 window_id, float threshold) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -763,7 +763,7 @@ void ClientConnection::set_window_alpha_hit_threshold(i32 window_id, float thres it->value->set_alpha_hit_threshold(threshold); } -void ClientConnection::start_window_resize(i32 window_id) +void ConnectionFromClient::start_window_resize(i32 window_id) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -780,7 +780,7 @@ void ClientConnection::start_window_resize(i32 window_id) WindowManager::the().start_window_resize(window, ScreenInput::the().cursor_location(), MouseButton::Primary); } -Messages::WindowServer::StartDragResponse ClientConnection::start_drag(String const& text, HashMap<String, ByteBuffer> const& mime_data, Gfx::ShareableBitmap const& drag_bitmap) +Messages::WindowServer::StartDragResponse ConnectionFromClient::start_drag(String const& text, HashMap<String, ByteBuffer> const& mime_data, Gfx::ShareableBitmap const& drag_bitmap) { auto& wm = WindowManager::the(); if (wm.dnd_client()) @@ -790,32 +790,32 @@ Messages::WindowServer::StartDragResponse ClientConnection::start_drag(String co return true; } -Messages::WindowServer::SetSystemThemeResponse ClientConnection::set_system_theme(String const& theme_path, String const& theme_name) +Messages::WindowServer::SetSystemThemeResponse ConnectionFromClient::set_system_theme(String const& theme_path, String const& theme_name) { bool success = WindowManager::the().update_theme(theme_path, theme_name); return success; } -Messages::WindowServer::GetSystemThemeResponse ClientConnection::get_system_theme() +Messages::WindowServer::GetSystemThemeResponse ConnectionFromClient::get_system_theme() { auto wm_config = Core::ConfigFile::open("/etc/WindowServer.ini").release_value_but_fixme_should_propagate_errors(); auto name = wm_config->read_entry("Theme", "Name"); return name; } -void ClientConnection::apply_cursor_theme(String const& name) +void ConnectionFromClient::apply_cursor_theme(String const& name) { WindowManager::the().apply_cursor_theme(name); } -Messages::WindowServer::GetCursorThemeResponse ClientConnection::get_cursor_theme() +Messages::WindowServer::GetCursorThemeResponse ConnectionFromClient::get_cursor_theme() { auto config = Core::ConfigFile::open("/etc/WindowServer.ini").release_value_but_fixme_should_propagate_errors(); auto name = config->read_entry("Mouse", "CursorTheme"); return name; } -Messages::WindowServer::SetSystemFontsResponse ClientConnection::set_system_fonts(String const& default_font_query, String const& fixed_width_font_query) +Messages::WindowServer::SetSystemFontsResponse ConnectionFromClient::set_system_fonts(String const& default_font_query, String const& fixed_width_font_query) { if (!Gfx::FontDatabase::the().get_by_name(default_font_query) || !Gfx::FontDatabase::the().get_by_name(fixed_width_font_query)) { @@ -828,7 +828,7 @@ Messages::WindowServer::SetSystemFontsResponse ClientConnection::set_system_font Gfx::FontDatabase::set_default_font_query(default_font_query); Gfx::FontDatabase::set_fixed_width_font_query(fixed_width_font_query); - ClientConnection::for_each_client([&](auto& client) { + ConnectionFromClient::for_each_client([&](auto& client) { client.async_update_system_fonts(default_font_query, fixed_width_font_query); }); @@ -845,7 +845,7 @@ Messages::WindowServer::SetSystemFontsResponse ClientConnection::set_system_font return true; } -void ClientConnection::set_window_base_size_and_size_increment(i32 window_id, Gfx::IntSize const& base_size, Gfx::IntSize const& size_increment) +void ConnectionFromClient::set_window_base_size_and_size_increment(i32 window_id, Gfx::IntSize const& base_size, Gfx::IntSize const& size_increment) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -858,7 +858,7 @@ void ClientConnection::set_window_base_size_and_size_increment(i32 window_id, Gf window.set_size_increment(size_increment); } -void ClientConnection::set_window_resize_aspect_ratio(i32 window_id, Optional<Gfx::IntSize> const& resize_aspect_ratio) +void ConnectionFromClient::set_window_resize_aspect_ratio(i32 window_id, Optional<Gfx::IntSize> const& resize_aspect_ratio) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -870,7 +870,7 @@ void ClientConnection::set_window_resize_aspect_ratio(i32 window_id, Optional<Gf window.set_resize_aspect_ratio(resize_aspect_ratio); } -void ClientConnection::enable_display_link() +void ConnectionFromClient::enable_display_link() { if (m_has_display_link) return; @@ -878,7 +878,7 @@ void ClientConnection::enable_display_link() Compositor::the().increment_display_link_count({}); } -void ClientConnection::disable_display_link() +void ConnectionFromClient::disable_display_link() { if (!m_has_display_link) return; @@ -886,7 +886,7 @@ void ClientConnection::disable_display_link() Compositor::the().decrement_display_link_count({}); } -void ClientConnection::notify_display_link(Badge<Compositor>) +void ConnectionFromClient::notify_display_link(Badge<Compositor>) { if (!m_has_display_link) return; @@ -894,7 +894,7 @@ void ClientConnection::notify_display_link(Badge<Compositor>) async_display_link_notification(); } -void ClientConnection::set_window_progress(i32 window_id, Optional<i32> const& progress) +void ConnectionFromClient::set_window_progress(i32 window_id, Optional<i32> const& progress) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -904,19 +904,19 @@ void ClientConnection::set_window_progress(i32 window_id, Optional<i32> const& p it->value->set_progress(progress); } -void ClientConnection::refresh_system_theme() +void ConnectionFromClient::refresh_system_theme() { // Post the client an UpdateSystemTheme message to refresh its theme. async_update_system_theme(Gfx::current_system_theme_buffer()); } -void ClientConnection::pong() +void ConnectionFromClient::pong() { m_ping_timer = nullptr; set_unresponsive(false); } -void ClientConnection::set_global_cursor_position(Gfx::IntPoint const& position) +void ConnectionFromClient::set_global_cursor_position(Gfx::IntPoint const& position) { if (!Screen::main().rect().contains(position)) { did_misbehave("SetGlobalCursorPosition with bad position"); @@ -928,12 +928,12 @@ void ClientConnection::set_global_cursor_position(Gfx::IntPoint const& position) } } -Messages::WindowServer::GetGlobalCursorPositionResponse ClientConnection::get_global_cursor_position() +Messages::WindowServer::GetGlobalCursorPositionResponse ConnectionFromClient::get_global_cursor_position() { return ScreenInput::the().cursor_location(); } -void ClientConnection::set_mouse_acceleration(float factor) +void ConnectionFromClient::set_mouse_acceleration(float factor) { double dbl_factor = (double)factor; if (dbl_factor < mouse_accel_min || dbl_factor > mouse_accel_max) { @@ -943,12 +943,12 @@ void ClientConnection::set_mouse_acceleration(float factor) WindowManager::the().set_acceleration_factor(dbl_factor); } -Messages::WindowServer::GetMouseAccelerationResponse ClientConnection::get_mouse_acceleration() +Messages::WindowServer::GetMouseAccelerationResponse ConnectionFromClient::get_mouse_acceleration() { return ScreenInput::the().acceleration_factor(); } -void ClientConnection::set_scroll_step_size(u32 step_size) +void ConnectionFromClient::set_scroll_step_size(u32 step_size) { if (step_size < scroll_step_size_min) { did_misbehave("SetScrollStepSize with bad scroll step size"); @@ -957,12 +957,12 @@ void ClientConnection::set_scroll_step_size(u32 step_size) WindowManager::the().set_scroll_step_size(step_size); } -Messages::WindowServer::GetScrollStepSizeResponse ClientConnection::get_scroll_step_size() +Messages::WindowServer::GetScrollStepSizeResponse ConnectionFromClient::get_scroll_step_size() { return ScreenInput::the().scroll_step_size(); } -void ClientConnection::set_double_click_speed(i32 speed) +void ConnectionFromClient::set_double_click_speed(i32 speed) { if (speed < double_click_speed_min || speed > double_click_speed_max) { did_misbehave("SetDoubleClickSpeed with bad speed"); @@ -971,22 +971,22 @@ void ClientConnection::set_double_click_speed(i32 speed) WindowManager::the().set_double_click_speed(speed); } -Messages::WindowServer::GetDoubleClickSpeedResponse ClientConnection::get_double_click_speed() +Messages::WindowServer::GetDoubleClickSpeedResponse ConnectionFromClient::get_double_click_speed() { return WindowManager::the().double_click_speed(); } -void ClientConnection::set_buttons_switched(bool switched) +void ConnectionFromClient::set_buttons_switched(bool switched) { WindowManager::the().set_buttons_switched(switched); } -Messages::WindowServer::GetButtonsSwitchedResponse ClientConnection::get_buttons_switched() +Messages::WindowServer::GetButtonsSwitchedResponse ConnectionFromClient::get_buttons_switched() { return WindowManager::the().get_buttons_switched(); } -void ClientConnection::set_unresponsive(bool unresponsive) +void ConnectionFromClient::set_unresponsive(bool unresponsive) { if (m_unresponsive == unresponsive) return; @@ -1003,7 +1003,7 @@ void ClientConnection::set_unresponsive(bool unresponsive) Compositor::the().invalidate_cursor(); } -void ClientConnection::may_have_become_unresponsive() +void ConnectionFromClient::may_have_become_unresponsive() { async_ping(); m_ping_timer = Core::Timer::create_single_shot(1000, [this] { @@ -1012,12 +1012,12 @@ void ClientConnection::may_have_become_unresponsive() m_ping_timer->start(); } -void ClientConnection::did_become_responsive() +void ConnectionFromClient::did_become_responsive() { set_unresponsive(false); } -Messages::WindowServer::GetScreenBitmapResponse ClientConnection::get_screen_bitmap(Optional<Gfx::IntRect> const& rect, Optional<u32> const& screen_index) +Messages::WindowServer::GetScreenBitmapResponse ConnectionFromClient::get_screen_bitmap(Optional<Gfx::IntRect> const& rect, Optional<u32> const& screen_index) { if (screen_index.has_value()) { auto* screen = Screen::find_by_index(screen_index.value()); @@ -1057,7 +1057,7 @@ Messages::WindowServer::GetScreenBitmapResponse ClientConnection::get_screen_bit return { Gfx::ShareableBitmap() }; } -Messages::WindowServer::GetScreenBitmapAroundCursorResponse ClientConnection::get_screen_bitmap_around_cursor(Gfx::IntSize const& size) +Messages::WindowServer::GetScreenBitmapAroundCursorResponse ConnectionFromClient::get_screen_bitmap_around_cursor(Gfx::IntSize const& size) { // TODO: Mixed scale setups at what scale? Lowest? Highest? Configurable? auto cursor_location = ScreenInput::the().cursor_location(); @@ -1126,7 +1126,7 @@ Messages::WindowServer::GetScreenBitmapAroundCursorResponse ClientConnection::ge return { {} }; } -Messages::WindowServer::GetColorUnderCursorResponse ClientConnection::get_color_under_cursor() +Messages::WindowServer::GetColorUnderCursorResponse ConnectionFromClient::get_color_under_cursor() { // FIXME: Add a mechanism to get screen bitmap without cursor, so we don't have to do this // manual translation to avoid sampling the color on the actual cursor itself. @@ -1139,7 +1139,7 @@ Messages::WindowServer::GetColorUnderCursorResponse ClientConnection::get_color_ return { Compositor::the().color_at_position({}, screen_with_cursor, cursor_location) }; } -Messages::WindowServer::IsWindowModifiedResponse ClientConnection::is_window_modified(i32 window_id) +Messages::WindowServer::IsWindowModifiedResponse ConnectionFromClient::is_window_modified(i32 window_id) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -1150,7 +1150,7 @@ Messages::WindowServer::IsWindowModifiedResponse ClientConnection::is_window_mod return window.is_modified(); } -Messages::WindowServer::GetDesktopDisplayScaleResponse ClientConnection::get_desktop_display_scale(u32 screen_index) +Messages::WindowServer::GetDesktopDisplayScaleResponse ConnectionFromClient::get_desktop_display_scale(u32 screen_index) { if (auto* screen = Screen::find_by_index(screen_index)) return screen->scale_factor(); @@ -1158,7 +1158,7 @@ Messages::WindowServer::GetDesktopDisplayScaleResponse ClientConnection::get_des return 0; } -void ClientConnection::set_window_modified(i32 window_id, bool modified) +void ConnectionFromClient::set_window_modified(i32 window_id, bool modified) { auto it = m_windows.find(window_id); if (it == m_windows.end()) { @@ -1169,12 +1169,12 @@ void ClientConnection::set_window_modified(i32 window_id, bool modified) window.set_modified(modified); } -void ClientConnection::set_flash_flush(bool enabled) +void ConnectionFromClient::set_flash_flush(bool enabled) { Compositor::the().set_flash_flush(enabled); } -void ClientConnection::set_window_parent_from_client(i32 client_id, i32 parent_id, i32 child_id) +void ConnectionFromClient::set_window_parent_from_client(i32 client_id, i32 parent_id, i32 child_id) { auto child_window = window_from_id(child_id); if (!child_window) @@ -1195,7 +1195,7 @@ void ClientConnection::set_window_parent_from_client(i32 client_id, i32 parent_i } } -Messages::WindowServer::GetWindowRectFromClientResponse ClientConnection::get_window_rect_from_client(i32 client_id, i32 window_id) +Messages::WindowServer::GetWindowRectFromClientResponse ConnectionFromClient::get_window_rect_from_client(i32 client_id, i32 window_id) { auto client_connection = from_client_id(client_id); if (!client_connection) @@ -1208,7 +1208,7 @@ Messages::WindowServer::GetWindowRectFromClientResponse ClientConnection::get_wi return window->rect(); } -void ClientConnection::add_window_stealing_for_client(i32 client_id, i32 window_id) +void ConnectionFromClient::add_window_stealing_for_client(i32 client_id, i32 window_id) { auto window = window_from_id(window_id); if (!window) @@ -1220,7 +1220,7 @@ void ClientConnection::add_window_stealing_for_client(i32 client_id, i32 window_ window->add_stealing_for_client(client_id); } -void ClientConnection::remove_window_stealing_for_client(i32 client_id, i32 window_id) +void ConnectionFromClient::remove_window_stealing_for_client(i32 client_id, i32 window_id) { auto window = window_from_id(window_id); if (!window) @@ -1231,7 +1231,7 @@ void ClientConnection::remove_window_stealing_for_client(i32 client_id, i32 wind window->remove_stealing_for_client(client_id); } -void ClientConnection::remove_window_stealing(i32 window_id) +void ConnectionFromClient::remove_window_stealing(i32 window_id) { auto window = window_from_id(window_id); if (!window) diff --git a/Userland/Services/WindowServer/ClientConnection.h b/Userland/Services/WindowServer/ConnectionFromClient.h index bc3c85752b..ce9e587701 100644 --- a/Userland/Services/WindowServer/ClientConnection.h +++ b/Userland/Services/WindowServer/ConnectionFromClient.h @@ -15,7 +15,7 @@ #include <LibCore/Object.h> #include <LibGfx/Bitmap.h> #include <LibGfx/Rect.h> -#include <LibIPC/ClientConnection.h> +#include <LibIPC/ConnectionFromClient.h> #include <WindowServer/Event.h> #include <WindowServer/Menu.h> #include <WindowServer/ScreenLayout.h> @@ -29,19 +29,19 @@ class Window; class Menu; class Menubar; class ScreenLayout; -class WMClientConnection; +class WMConnectionFromClient; -class ClientConnection final - : public IPC::ClientConnection<WindowClientEndpoint, WindowServerEndpoint> { - C_OBJECT(ClientConnection) +class ConnectionFromClient final + : public IPC::ConnectionFromClient<WindowClientEndpoint, WindowServerEndpoint> { + C_OBJECT(ConnectionFromClient) public: - ~ClientConnection() override; + ~ConnectionFromClient() override; bool is_unresponsive() const { return m_unresponsive; } bool does_global_mouse_tracking() const { return m_does_global_mouse_tracking; } - static ClientConnection* from_client_id(int client_id); - static void for_each_client(Function<void(ClientConnection&)>); + static ConnectionFromClient* from_client_id(int client_id); + static void for_each_client(Function<void(ConnectionFromClient&)>); void notify_about_new_screen_rects(); void post_paint_message(Window&, bool ignore_occlusion = false); @@ -81,9 +81,9 @@ public: void notify_display_link(Badge<Compositor>); private: - explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); + explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>, int client_id); - // ^ClientConnection + // ^ConnectionFromClient virtual void die() override; virtual void may_have_become_unresponsive() override; virtual void did_become_responsive() override; @@ -189,7 +189,7 @@ private: bool m_does_global_mouse_tracking { false }; // Need this to get private client connection stuff - friend WMClientConnection; + friend WMConnectionFromClient; }; } diff --git a/Userland/Services/WindowServer/EventLoop.cpp b/Userland/Services/WindowServer/EventLoop.cpp index 1b1831387e..d7621fc241 100644 --- a/Userland/Services/WindowServer/EventLoop.cpp +++ b/Userland/Services/WindowServer/EventLoop.cpp @@ -6,11 +6,11 @@ #include <AK/Debug.h> #include <Kernel/API/MousePacket.h> -#include <WindowServer/ClientConnection.h> +#include <WindowServer/ConnectionFromClient.h> #include <WindowServer/Cursor.h> #include <WindowServer/EventLoop.h> #include <WindowServer/Screen.h> -#include <WindowServer/WMClientConnection.h> +#include <WindowServer/WMConnectionFromClient.h> #include <WindowServer/WindowManager.h> #include <fcntl.h> #include <stdio.h> @@ -23,8 +23,8 @@ EventLoop::EventLoop() m_keyboard_fd = open("/dev/keyboard0", O_RDONLY | O_NONBLOCK | O_CLOEXEC); m_mouse_fd = open("/dev/mouse0", O_RDONLY | O_NONBLOCK | O_CLOEXEC); - m_window_server = MUST(IPC::MultiServer<ClientConnection>::try_create("/tmp/portal/window")); - m_wm_server = MUST(IPC::MultiServer<WMClientConnection>::try_create("/tmp/portal/wm")); + m_window_server = MUST(IPC::MultiServer<ConnectionFromClient>::try_create("/tmp/portal/window")); + m_wm_server = MUST(IPC::MultiServer<WMConnectionFromClient>::try_create("/tmp/portal/wm")); if (m_keyboard_fd >= 0) { m_keyboard_notifier = Core::Notifier::construct(m_keyboard_fd, Core::Notifier::Read); diff --git a/Userland/Services/WindowServer/EventLoop.h b/Userland/Services/WindowServer/EventLoop.h index dfad84b887..8d9b1b6394 100644 --- a/Userland/Services/WindowServer/EventLoop.h +++ b/Userland/Services/WindowServer/EventLoop.h @@ -6,8 +6,8 @@ #pragma once -#include "ClientConnection.h" -#include "WMClientConnection.h" +#include "ConnectionFromClient.h" +#include "WMConnectionFromClient.h" #include <AK/ByteBuffer.h> #include <LibCore/EventLoop.h> #include <LibCore/Notifier.h> @@ -15,7 +15,7 @@ namespace WindowServer { -class ClientConnection; +class ConnectionFromClient; class EventLoop { public: @@ -33,8 +33,8 @@ private: RefPtr<Core::Notifier> m_keyboard_notifier; int m_mouse_fd { -1 }; RefPtr<Core::Notifier> m_mouse_notifier; - OwnPtr<IPC::MultiServer<ClientConnection>> m_window_server; - OwnPtr<IPC::MultiServer<WMClientConnection>> m_wm_server; + OwnPtr<IPC::MultiServer<ConnectionFromClient>> m_window_server; + OwnPtr<IPC::MultiServer<WMConnectionFromClient>> m_wm_server; }; } diff --git a/Userland/Services/WindowServer/KeymapSwitcher.h b/Userland/Services/WindowServer/KeymapSwitcher.h index d87d0b7d20..a2d0ddf235 100644 --- a/Userland/Services/WindowServer/KeymapSwitcher.h +++ b/Userland/Services/WindowServer/KeymapSwitcher.h @@ -12,7 +12,7 @@ #include <LibCore/FileWatcher.h> #include <LibCore/Object.h> #include <LibKeyboard/CharacterMap.h> -#include <WindowServer/WMClientConnection.h> +#include <WindowServer/WMConnectionFromClient.h> namespace WindowServer { diff --git a/Userland/Services/WindowServer/Menu.cpp b/Userland/Services/WindowServer/Menu.cpp index 70a6f74b85..63af0b4130 100644 --- a/Userland/Services/WindowServer/Menu.cpp +++ b/Userland/Services/WindowServer/Menu.cpp @@ -19,7 +19,7 @@ #include <LibGfx/Painter.h> #include <LibGfx/StylePainter.h> #include <LibGfx/Triangle.h> -#include <WindowServer/ClientConnection.h> +#include <WindowServer/ConnectionFromClient.h> #include <WindowServer/WindowClientEndpoint.h> namespace WindowServer { @@ -37,7 +37,7 @@ u32 find_ampersand_shortcut_character(StringView string) return 0; } -Menu::Menu(ClientConnection* client, int menu_id, String name) +Menu::Menu(ConnectionFromClient* client, int menu_id, String name) : Core::Object(client) , m_client(client) , m_menu_id(menu_id) diff --git a/Userland/Services/WindowServer/Menu.h b/Userland/Services/WindowServer/Menu.h index 210afed6f5..806131d802 100644 --- a/Userland/Services/WindowServer/Menu.h +++ b/Userland/Services/WindowServer/Menu.h @@ -20,7 +20,7 @@ namespace WindowServer { -class ClientConnection; +class ConnectionFromClient; class Menubar; class Window; @@ -30,8 +30,8 @@ class Menu final : public Core::Object { public: virtual ~Menu() override; - ClientConnection* client() { return m_client; } - const ClientConnection* client() const { return m_client; } + ConnectionFromClient* client() { return m_client; } + const ConnectionFromClient* client() const { return m_client; } int menu_id() const { return m_menu_id; } bool is_open() const; @@ -129,7 +129,7 @@ public: const Vector<size_t>* items_with_alt_shortcut(u32 alt_shortcut) const; private: - Menu(ClientConnection*, int menu_id, String name); + Menu(ConnectionFromClient*, int menu_id, String name); virtual void event(Core::Event&) override; @@ -144,7 +144,7 @@ private: void start_activation_animation(MenuItem&); - ClientConnection* m_client { nullptr }; + ConnectionFromClient* m_client { nullptr }; int m_menu_id { 0 }; String m_name; u32 m_alt_shortcut_character { 0 }; diff --git a/Userland/Services/WindowServer/MenuItem.cpp b/Userland/Services/WindowServer/MenuItem.cpp index 7740dd9cd7..14dde1545d 100644 --- a/Userland/Services/WindowServer/MenuItem.cpp +++ b/Userland/Services/WindowServer/MenuItem.cpp @@ -5,7 +5,7 @@ */ #include "MenuItem.h" -#include "ClientConnection.h" +#include "ConnectionFromClient.h" #include "Menu.h" #include "WindowManager.h" #include <LibGfx/Bitmap.h> diff --git a/Userland/Services/WindowServer/MenuManager.cpp b/Userland/Services/WindowServer/MenuManager.cpp index 8c0aa61574..3b0e631b30 100644 --- a/Userland/Services/WindowServer/MenuManager.cpp +++ b/Userland/Services/WindowServer/MenuManager.cpp @@ -6,7 +6,7 @@ */ #include <AK/Badge.h> -#include <WindowServer/ClientConnection.h> +#include <WindowServer/ConnectionFromClient.h> #include <WindowServer/MenuManager.h> #include <WindowServer/Screen.h> #include <WindowServer/WindowManager.h> @@ -41,7 +41,7 @@ bool MenuManager::is_open(const Menu& menu) const void MenuManager::refresh() { - ClientConnection::for_each_client([&](ClientConnection& client) { + ConnectionFromClient::for_each_client([&](ConnectionFromClient& client) { client.for_each_menu([&](Menu& menu) { menu.redraw(); return IterationDecision::Continue; @@ -213,7 +213,7 @@ void MenuManager::handle_mouse_event(MouseEvent& mouse_event) } } -void MenuManager::close_all_menus_from_client(Badge<ClientConnection>, ClientConnection& client) +void MenuManager::close_all_menus_from_client(Badge<ConnectionFromClient>, ConnectionFromClient& client) { if (!has_open_menu()) return; diff --git a/Userland/Services/WindowServer/MenuManager.h b/Userland/Services/WindowServer/MenuManager.h index ca3e2f38ae..e9aa03a44f 100644 --- a/Userland/Services/WindowServer/MenuManager.h +++ b/Userland/Services/WindowServer/MenuManager.h @@ -34,7 +34,7 @@ public: void close_everyone_not_in_lineage(Menu&); void close_menu_and_descendants(Menu&); - void close_all_menus_from_client(Badge<ClientConnection>, ClientConnection&); + void close_all_menus_from_client(Badge<ConnectionFromClient>, ConnectionFromClient&); int theme_index() const { return m_theme_index; } diff --git a/Userland/Services/WindowServer/WMClientConnection.cpp b/Userland/Services/WindowServer/WMConnectionFromClient.cpp index b6f8b7025d..0ce4a6e7a6 100644 --- a/Userland/Services/WindowServer/WMClientConnection.cpp +++ b/Userland/Services/WindowServer/WMConnectionFromClient.cpp @@ -5,35 +5,35 @@ */ #include <WindowServer/AppletManager.h> -#include <WindowServer/ClientConnection.h> +#include <WindowServer/ConnectionFromClient.h> #include <WindowServer/Screen.h> -#include <WindowServer/WMClientConnection.h> +#include <WindowServer/WMConnectionFromClient.h> namespace WindowServer { -HashMap<int, NonnullRefPtr<WMClientConnection>> WMClientConnection::s_connections {}; +HashMap<int, NonnullRefPtr<WMConnectionFromClient>> WMConnectionFromClient::s_connections {}; -WMClientConnection::WMClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id) - : IPC::ClientConnection<WindowManagerClientEndpoint, WindowManagerServerEndpoint>(*this, move(client_socket), client_id) +WMConnectionFromClient::WMConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id) + : IPC::ConnectionFromClient<WindowManagerClientEndpoint, WindowManagerServerEndpoint>(*this, move(client_socket), client_id) { s_connections.set(client_id, *this); } -WMClientConnection::~WMClientConnection() +WMConnectionFromClient::~WMConnectionFromClient() { // The WM has gone away, so take away the applet manager (cause there's nowhere // to draw it in). AppletManager::the().set_position({}); } -void WMClientConnection::die() +void WMConnectionFromClient::die() { deferred_invoke([this] { s_connections.remove(client_id()); }); } -void WMClientConnection::set_applet_area_position(Gfx::IntPoint const& position) +void WMConnectionFromClient::set_applet_area_position(Gfx::IntPoint const& position) { if (m_window_id < 0) { did_misbehave("SetAppletAreaPosition: WM didn't assign window as manager yet"); @@ -43,16 +43,16 @@ void WMClientConnection::set_applet_area_position(Gfx::IntPoint const& position) AppletManager::the().set_position(position); - WindowServer::ClientConnection::for_each_client([](auto& connection) { + WindowServer::ConnectionFromClient::for_each_client([](auto& connection) { if (auto result = connection.post_message(Messages::WindowClient::AppletAreaRectChanged(AppletManager::the().window()->rect())); result.is_error()) { - dbgln("WMClientConnection::set_applet_area_position: {}", result.error()); + dbgln("WMConnectionFromClient::set_applet_area_position: {}", result.error()); } }); } -void WMClientConnection::set_active_window(i32 client_id, i32 window_id) +void WMConnectionFromClient::set_active_window(i32 client_id, i32 window_id) { - auto* client = WindowServer::ClientConnection::from_client_id(client_id); + auto* client = WindowServer::ConnectionFromClient::from_client_id(client_id); if (!client) { did_misbehave("SetActiveWindow: Bad client ID"); return; @@ -67,9 +67,9 @@ void WMClientConnection::set_active_window(i32 client_id, i32 window_id) WindowManager::the().move_to_front_and_make_active(window); } -void WMClientConnection::popup_window_menu(i32 client_id, i32 window_id, Gfx::IntPoint const& screen_position) +void WMConnectionFromClient::popup_window_menu(i32 client_id, i32 window_id, Gfx::IntPoint const& screen_position) { - auto* client = WindowServer::ClientConnection::from_client_id(client_id); + auto* client = WindowServer::ConnectionFromClient::from_client_id(client_id); if (!client) { did_misbehave("PopupWindowMenu: Bad client ID"); return; @@ -87,9 +87,9 @@ void WMClientConnection::popup_window_menu(i32 client_id, i32 window_id, Gfx::In } } -void WMClientConnection::start_window_resize(i32 client_id, i32 window_id) +void WMConnectionFromClient::start_window_resize(i32 client_id, i32 window_id) { - auto* client = WindowServer::ClientConnection::from_client_id(client_id); + auto* client = WindowServer::ConnectionFromClient::from_client_id(client_id); if (!client) { did_misbehave("WM_StartWindowResize: Bad client ID"); return; @@ -105,9 +105,9 @@ void WMClientConnection::start_window_resize(i32 client_id, i32 window_id) WindowManager::the().start_window_resize(window, ScreenInput::the().cursor_location(), MouseButton::Primary); } -void WMClientConnection::set_window_minimized(i32 client_id, i32 window_id, bool minimized) +void WMConnectionFromClient::set_window_minimized(i32 client_id, i32 window_id, bool minimized) { - auto* client = WindowServer::ClientConnection::from_client_id(client_id); + auto* client = WindowServer::ConnectionFromClient::from_client_id(client_id); if (!client) { did_misbehave("WM_SetWindowMinimized: Bad client ID"); return; @@ -121,7 +121,7 @@ void WMClientConnection::set_window_minimized(i32 client_id, i32 window_id, bool WindowManager::the().minimize_windows(window, minimized); } -void WMClientConnection::toggle_show_desktop() +void WMConnectionFromClient::toggle_show_desktop() { bool should_hide = false; auto& current_window_stack = WindowManager::the().current_window_stack(); @@ -146,12 +146,12 @@ void WMClientConnection::toggle_show_desktop() }); } -void WMClientConnection::set_event_mask(u32 event_mask) +void WMConnectionFromClient::set_event_mask(u32 event_mask) { m_event_mask = event_mask; } -void WMClientConnection::set_manager_window(i32 window_id) +void WMConnectionFromClient::set_manager_window(i32 window_id) { m_window_id = window_id; @@ -160,18 +160,18 @@ void WMClientConnection::set_manager_window(i32 window_id) WindowManager::the().greet_window_manager(*this); } -void WMClientConnection::set_workspace(u32 row, u32 col) +void WMConnectionFromClient::set_workspace(u32 row, u32 col) { WindowManager::the().switch_to_window_stack(row, col); } -void WMClientConnection::set_window_taskbar_rect(i32 client_id, i32 window_id, Gfx::IntRect const& rect) +void WMConnectionFromClient::set_window_taskbar_rect(i32 client_id, i32 window_id, Gfx::IntRect const& rect) { // Because the Taskbar (which should be the only user of this API) does not own the // window or the client id, there is a possibility that it may send this message for // a window or client that may have been destroyed already. This is not an error, // and we should not call did_misbehave() for either. - auto* client = WindowServer::ClientConnection::from_client_id(client_id); + auto* client = WindowServer::ConnectionFromClient::from_client_id(client_id); if (!client) return; diff --git a/Userland/Services/WindowServer/WMClientConnection.h b/Userland/Services/WindowServer/WMConnectionFromClient.h index e7f144782b..231f8fe57c 100644 --- a/Userland/Services/WindowServer/WMClientConnection.h +++ b/Userland/Services/WindowServer/WMConnectionFromClient.h @@ -8,18 +8,18 @@ #include "AK/NonnullRefPtr.h" #include <AK/HashMap.h> -#include <LibIPC/ClientConnection.h> +#include <LibIPC/ConnectionFromClient.h> #include <WindowServer/WindowManagerClientEndpoint.h> #include <WindowServer/WindowManagerServerEndpoint.h> namespace WindowServer { -class WMClientConnection final - : public IPC::ClientConnection<WindowManagerClientEndpoint, WindowManagerServerEndpoint> { - C_OBJECT(WMClientConnection) +class WMConnectionFromClient final + : public IPC::ConnectionFromClient<WindowManagerClientEndpoint, WindowManagerServerEndpoint> { + C_OBJECT(WMConnectionFromClient) public: - ~WMClientConnection() override; + ~WMConnectionFromClient() override; virtual void set_active_window(i32, i32) override; virtual void set_window_minimized(i32, i32, bool) override; @@ -36,13 +36,13 @@ public: int window_id() const { return m_window_id; } private: - explicit WMClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id); + explicit WMConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id); - // ^ClientConnection + // ^ConnectionFromClient virtual void die() override; // RefPtr<Core::Timer> m_ping_timer; - static HashMap<int, NonnullRefPtr<WMClientConnection>> s_connections; + static HashMap<int, NonnullRefPtr<WMConnectionFromClient>> s_connections; unsigned m_event_mask { 0 }; int m_window_id { -1 }; diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp index 7b44e5e9b1..fdd12a4fd7 100644 --- a/Userland/Services/WindowServer/Window.cpp +++ b/Userland/Services/WindowServer/Window.cpp @@ -7,8 +7,8 @@ #include "Window.h" #include "Animation.h" #include "AppletManager.h" -#include "ClientConnection.h" #include "Compositor.h" +#include "ConnectionFromClient.h" #include "Event.h" #include "EventLoop.h" #include "Screen.h" @@ -96,7 +96,7 @@ Window::Window(Core::Object& parent, WindowType type) 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) +Window::Window(ConnectionFromClient& client, WindowType window_type, int window_id, bool modal, bool minimizable, bool closeable, bool frameless, bool resizable, bool fullscreen, bool accessory, Window* parent_window) : Core::Object(&client) , m_client(&client) , m_type(window_type) @@ -1017,7 +1017,7 @@ void Window::set_tiled(WindowTileType tile_type) Core::EventLoop::current().post_event(*this, make<ResizeEvent>(m_rect)); } -void Window::detach_client(Badge<ClientConnection>) +void Window::detach_client(Badge<ConnectionFromClient>) { m_client = nullptr; } diff --git a/Userland/Services/WindowServer/Window.h b/Userland/Services/WindowServer/Window.h index eb5de5692c..a6a43a7c0f 100644 --- a/Userland/Services/WindowServer/Window.h +++ b/Userland/Services/WindowServer/Window.h @@ -22,7 +22,7 @@ namespace WindowServer { class Animation; -class ClientConnection; +class ConnectionFromClient; class Cursor; class KeyEvent; class Menu; @@ -143,8 +143,8 @@ public: Window* blocking_modal_window(); - ClientConnection* client() { return m_client; } - const ClientConnection* client() const { return m_client; } + ConnectionFromClient* client() { return m_client; } + const ConnectionFromClient* client() const { return m_client; } WindowType type() const { return m_type; } int window_id() const { return m_window_id; } @@ -296,7 +296,7 @@ public: IntrusiveListNode<Window> m_list_node; - void detach_client(Badge<ClientConnection>); + void detach_client(Badge<ConnectionFromClient>); Window* parent_window() { return m_parent_window; } const Window* parent_window() const { return m_parent_window; } @@ -381,7 +381,7 @@ public: bool is_stealable_by_client(i32 client_id) const { return m_stealable_by_client_ids.contains_slow(client_id); } private: - Window(ClientConnection&, WindowType, int window_id, bool modal, bool minimizable, bool closeable, bool frameless, bool resizable, bool fullscreen, bool accessory, Window* parent_window = nullptr); + Window(ConnectionFromClient&, WindowType, int window_id, bool modal, bool minimizable, bool closeable, bool frameless, bool resizable, bool fullscreen, bool accessory, Window* parent_window = nullptr); Window(Core::Object&, WindowType); virtual void event(Core::Event&) override; @@ -393,7 +393,7 @@ private: void update_window_menu_items(); void modal_unparented(); - ClientConnection* m_client { nullptr }; + ConnectionFromClient* m_client { nullptr }; WeakPtr<Window> m_parent_window; Vector<WeakPtr<Window>> m_child_windows; diff --git a/Userland/Services/WindowServer/WindowFrame.cpp b/Userland/Services/WindowServer/WindowFrame.cpp index b3c3363949..99819daa02 100644 --- a/Userland/Services/WindowServer/WindowFrame.cpp +++ b/Userland/Services/WindowServer/WindowFrame.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include "ClientConnection.h" +#include "ConnectionFromClient.h" #include <AK/Badge.h> #include <LibGfx/Font.h> #include <LibGfx/Painter.h> diff --git a/Userland/Services/WindowServer/WindowManager.cpp b/Userland/Services/WindowServer/WindowManager.cpp index 38019e25b4..a9d713fd2b 100644 --- a/Userland/Services/WindowServer/WindowManager.cpp +++ b/Userland/Services/WindowServer/WindowManager.cpp @@ -20,7 +20,7 @@ #include <LibGfx/SystemTheme.h> #include <WindowServer/AppletManager.h> #include <WindowServer/Button.h> -#include <WindowServer/ClientConnection.h> +#include <WindowServer/ConnectionFromClient.h> #include <WindowServer/Cursor.h> #include <WindowServer/WindowClientEndpoint.h> @@ -54,7 +54,7 @@ WindowManager::WindowManager(Gfx::PaletteImpl const& palette) reload_config(); m_keymap_switcher->on_keymap_change = [&](String const& keymap) { - for_each_window_manager([&keymap](WMClientConnection& conn) { + for_each_window_manager([&keymap](WMConnectionFromClient& conn) { if (!(conn.event_mask() & WMEventMask::KeymapChanged)) return IterationDecision::Continue; if (conn.window_id() < 0) @@ -409,7 +409,7 @@ void WindowManager::remove_window(Window& window) Compositor::the().invalidate_occlusions(); - for_each_window_manager([&](WMClientConnection& conn) { + for_each_window_manager([&](WMConnectionFromClient& conn) { if (conn.window_id() < 0 || !(conn.event_mask() & WMEventMask::WindowRemovals)) return IterationDecision::Continue; if (!window.is_internal() && !was_modal) @@ -418,7 +418,7 @@ void WindowManager::remove_window(Window& window) }); } -void WindowManager::greet_window_manager(WMClientConnection& conn) +void WindowManager::greet_window_manager(WMConnectionFromClient& conn) { if (conn.window_id() < 0) return; @@ -437,7 +437,7 @@ void WindowManager::greet_window_manager(WMClientConnection& conn) tell_wms_applet_area_size_changed(applet_area_window->size()); } -void WindowManager::tell_wm_about_window(WMClientConnection& conn, Window& window) +void WindowManager::tell_wm_about_window(WMConnectionFromClient& conn, Window& window) { if (conn.window_id() < 0) return; @@ -450,7 +450,7 @@ void WindowManager::tell_wm_about_window(WMClientConnection& conn, Window& windo conn.async_window_state_changed(conn.window_id(), window.client_id(), window.window_id(), parent ? parent->client_id() : -1, parent ? parent->window_id() : -1, window_stack.row(), window_stack.column(), window.is_active(), window.is_minimized(), window.is_modal_dont_unparent(), window.is_frameless(), (i32)window.type(), window.computed_title(), window.rect(), window.progress()); } -void WindowManager::tell_wm_about_window_rect(WMClientConnection& conn, Window& window) +void WindowManager::tell_wm_about_window_rect(WMConnectionFromClient& conn, Window& window) { if (conn.window_id() < 0) return; @@ -461,7 +461,7 @@ void WindowManager::tell_wm_about_window_rect(WMClientConnection& conn, Window& conn.async_window_rect_changed(conn.window_id(), window.client_id(), window.window_id(), window.rect()); } -void WindowManager::tell_wm_about_window_icon(WMClientConnection& conn, Window& window) +void WindowManager::tell_wm_about_window_icon(WMConnectionFromClient& conn, Window& window) { if (conn.window_id() < 0) return; @@ -472,7 +472,7 @@ void WindowManager::tell_wm_about_window_icon(WMClientConnection& conn, Window& conn.async_window_icon_bitmap_changed(conn.window_id(), window.client_id(), window.window_id(), window.icon().to_shareable_bitmap()); } -void WindowManager::tell_wm_about_current_window_stack(WMClientConnection& conn) +void WindowManager::tell_wm_about_current_window_stack(WMConnectionFromClient& conn) { if (conn.window_id() < 0) return; @@ -484,7 +484,7 @@ void WindowManager::tell_wm_about_current_window_stack(WMClientConnection& conn) void WindowManager::tell_wms_window_state_changed(Window& window) { - for_each_window_manager([&](WMClientConnection& conn) { + for_each_window_manager([&](WMConnectionFromClient& conn) { tell_wm_about_window(conn, window); return IterationDecision::Continue; }); @@ -492,7 +492,7 @@ void WindowManager::tell_wms_window_state_changed(Window& window) void WindowManager::tell_wms_window_icon_changed(Window& window) { - for_each_window_manager([&](WMClientConnection& conn) { + for_each_window_manager([&](WMConnectionFromClient& conn) { tell_wm_about_window_icon(conn, window); return IterationDecision::Continue; }); @@ -500,7 +500,7 @@ void WindowManager::tell_wms_window_icon_changed(Window& window) void WindowManager::tell_wms_window_rect_changed(Window& window) { - for_each_window_manager([&](WMClientConnection& conn) { + for_each_window_manager([&](WMConnectionFromClient& conn) { tell_wm_about_window_rect(conn, window); return IterationDecision::Continue; }); @@ -508,14 +508,14 @@ void WindowManager::tell_wms_window_rect_changed(Window& window) void WindowManager::tell_wms_screen_rects_changed() { - ClientConnection::for_each_client([&](ClientConnection& client) { + ConnectionFromClient::for_each_client([&](ConnectionFromClient& client) { client.notify_about_new_screen_rects(); }); } void WindowManager::tell_wms_applet_area_size_changed(Gfx::IntSize const& size) { - for_each_window_manager([&](WMClientConnection& conn) { + for_each_window_manager([&](WMConnectionFromClient& conn) { if (conn.window_id() < 0) return IterationDecision::Continue; @@ -526,7 +526,7 @@ void WindowManager::tell_wms_applet_area_size_changed(Gfx::IntSize const& size) void WindowManager::tell_wms_super_key_pressed() { - for_each_window_manager([](WMClientConnection& conn) { + for_each_window_manager([](WMConnectionFromClient& conn) { if (conn.window_id() < 0) return IterationDecision::Continue; @@ -537,7 +537,7 @@ void WindowManager::tell_wms_super_key_pressed() void WindowManager::tell_wms_super_space_key_pressed() { - for_each_window_manager([](WMClientConnection& conn) { + for_each_window_manager([](WMConnectionFromClient& conn) { if (conn.window_id() < 0) return IterationDecision::Continue; @@ -559,7 +559,7 @@ void WindowManager::tell_wms_super_digit_key_pressed(u8 digit) void WindowManager::tell_wms_current_window_stack_changed() { - for_each_window_manager([&](WMClientConnection& conn) { + for_each_window_manager([&](WMConnectionFromClient& conn) { tell_wm_about_current_window_stack(conn); return IterationDecision::Continue; }); @@ -1289,7 +1289,7 @@ void WindowManager::process_mouse_event(MouseEvent& event) return; // 2. Send the mouse event to all clients with global cursor tracking enabled. - ClientConnection::for_each_client([&](ClientConnection& conn) { + ConnectionFromClient::for_each_client([&](ConnectionFromClient& conn) { if (conn.does_global_mouse_tracking()) { conn.async_track_mouse_move(event.position()); } @@ -1917,7 +1917,7 @@ bool WindowManager::set_hovered_window(Window* window) return true; } -ClientConnection const* WindowManager::active_client() const +ConnectionFromClient const* WindowManager::active_client() const { if (auto* window = const_cast<WindowManager*>(this)->current_window_stack().active_window()) return window->client(); @@ -2052,7 +2052,7 @@ Gfx::IntRect WindowManager::tiled_window_rect(Window const& window, WindowTileTy return rect; } -void WindowManager::start_dnd_drag(ClientConnection& client, String const& text, Gfx::Bitmap const* bitmap, Core::MimeData const& mime_data) +void WindowManager::start_dnd_drag(ConnectionFromClient& client, String const& text, Gfx::Bitmap const* bitmap, Core::MimeData const& mime_data) { VERIFY(!m_dnd_client); m_dnd_client = client; @@ -2084,7 +2084,7 @@ void WindowManager::invalidate_after_theme_or_font_change() }); return IterationDecision::Continue; }); - ClientConnection::for_each_client([&](ClientConnection& client) { + ConnectionFromClient::for_each_client([&](ConnectionFromClient& client) { client.async_update_system_theme(Gfx::current_system_theme_buffer()); }); MenuManager::the().did_change_theme(); diff --git a/Userland/Services/WindowServer/WindowManager.h b/Userland/Services/WindowServer/WindowManager.h index b489164607..b6ec0885f8 100644 --- a/Userland/Services/WindowServer/WindowManager.h +++ b/Userland/Services/WindowServer/WindowManager.h @@ -22,7 +22,7 @@ #include <WindowServer/KeymapSwitcher.h> #include <WindowServer/MenuManager.h> #include <WindowServer/ScreenLayout.h> -#include <WindowServer/WMClientConnection.h> +#include <WindowServer/WMConnectionFromClient.h> #include <WindowServer/WindowSwitcher.h> #include <WindowServer/WindowType.h> @@ -34,7 +34,7 @@ const int double_click_speed_min = 100; class Screen; class MouseEvent; class Window; -class ClientConnection; +class ConnectionFromClient; class WindowSwitcher; class Button; class DndOverlay; @@ -90,10 +90,10 @@ public: Gfx::IntRect tiled_window_rect(Window const&, WindowTileType tile_type = WindowTileType::Maximized, bool relative_to_window_screen = false) const; - ClientConnection const* dnd_client() const { return m_dnd_client.ptr(); } + ConnectionFromClient const* dnd_client() const { return m_dnd_client.ptr(); } Core::MimeData const& dnd_mime_data() const { return *m_dnd_mime_data; } - void start_dnd_drag(ClientConnection&, String const& text, Gfx::Bitmap const*, Core::MimeData const&); + void start_dnd_drag(ConnectionFromClient&, String const& text, Gfx::Bitmap const*, Core::MimeData const&); void end_dnd_drag(); Window* active_window() @@ -118,7 +118,7 @@ public: return m_current_window_stack->active_input_window(); } - ClientConnection const* active_client() const; + ConnectionFromClient const* active_client() const; Window* window_with_active_menu() { return m_window_with_active_menu; } Window const* window_with_active_menu() const { return m_window_with_active_menu; } @@ -179,7 +179,7 @@ public: void clear_resize_candidate(); ResizeDirection resize_direction_of_window(Window const&); - void greet_window_manager(WMClientConnection&); + void greet_window_manager(WMConnectionFromClient&); void tell_wms_window_state_changed(Window&); void tell_wms_window_icon_changed(Window&); void tell_wms_window_rect_changed(Window&); @@ -345,10 +345,10 @@ private: void for_each_window_manager(Callback); virtual void event(Core::Event&) override; - void tell_wm_about_window(WMClientConnection& conn, Window&); - void tell_wm_about_window_icon(WMClientConnection& conn, Window&); - void tell_wm_about_window_rect(WMClientConnection& conn, Window&); - void tell_wm_about_current_window_stack(WMClientConnection&); + void tell_wm_about_window(WMConnectionFromClient& conn, Window&); + void tell_wm_about_window_icon(WMConnectionFromClient& conn, Window&); + void tell_wm_about_window_rect(WMConnectionFromClient& conn, Window&); + void tell_wm_about_current_window_stack(WMConnectionFromClient&); bool pick_new_active_window(Window*); void do_move_to_front(Window&, bool, bool); @@ -449,7 +449,7 @@ private: RefPtr<Core::ConfigFile> m_config; OwnPtr<DndOverlay> m_dnd_overlay; - WeakPtr<ClientConnection> m_dnd_client; + WeakPtr<ConnectionFromClient> m_dnd_client; String m_dnd_text; RefPtr<Core::MimeData> m_dnd_mime_data; @@ -535,7 +535,7 @@ inline IterationDecision WindowManager::for_each_visible_window_from_front_to_ba template<typename Callback> void WindowManager::for_each_window_manager(Callback callback) { - auto& connections = WMClientConnection::s_connections; + auto& connections = WMConnectionFromClient::s_connections; // FIXME: this isn't really ordered... does it need to be? for (auto it = connections.begin(); it != connections.end(); ++it) { diff --git a/Userland/Utilities/aplay.cpp b/Userland/Utilities/aplay.cpp index 37c82a19e2..3138a64934 100644 --- a/Userland/Utilities/aplay.cpp +++ b/Userland/Utilities/aplay.cpp @@ -6,7 +6,7 @@ */ #include <AK/Types.h> -#include <LibAudio/ClientConnection.h> +#include <LibAudio/ConnectionFromClient.h> #include <LibAudio/Loader.h> #include <LibCore/ArgsParser.h> #include <LibCore/EventLoop.h> @@ -39,7 +39,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) Core::EventLoop loop; - auto audio_client = TRY(Audio::ClientConnection::try_create()); + auto audio_client = TRY(Audio::ConnectionFromClient::try_create()); auto maybe_loader = Audio::Loader::create(path); if (maybe_loader.is_error()) { warnln("Failed to load audio file: {}", maybe_loader.error().description); diff --git a/Userland/Utilities/asctl.cpp b/Userland/Utilities/asctl.cpp index 8e9377e278..b3df2fd49d 100644 --- a/Userland/Utilities/asctl.cpp +++ b/Userland/Utilities/asctl.cpp @@ -9,7 +9,7 @@ #include <AK/Variant.h> #include <AK/Vector.h> #include <LibAudio/Buffer.h> -#include <LibAudio/ClientConnection.h> +#include <LibAudio/ConnectionFromClient.h> #include <LibCore/ArgsParser.h> #include <LibCore/EventLoop.h> #include <LibCore/File.h> @@ -29,7 +29,7 @@ enum AudioVariable : u32 { ErrorOr<int> serenity_main(Main::Arguments arguments) { Core::EventLoop loop; - auto audio_client = TRY(Audio::ClientConnection::try_create()); + auto audio_client = TRY(Audio::ConnectionFromClient::try_create()); String command = String::empty(); Vector<StringView> command_arguments; |