mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Ladybird: Rename classes ending with Ladybird
Now that all the classes for Ladybird are in the Ladybird namespace, we don't need them named as Ladybird::FooBarLadybird. For the Qt-specific classes, we can tack on a Qt at the end for clarity, but FontPlugin and ImageCodecPlugin no longer have anything to do with Qt.
This commit is contained in:
parent
506b03740c
commit
88ccaae11e
Notes:
sideshowbarker
2024-07-17 02:38:39 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/88ccaae11e Pull-request: https://github.com/SerenityOS/serenity/pull/20339
13 changed files with 76 additions and 76 deletions
|
@ -4,21 +4,21 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "AudioCodecPluginLadybird.h"
|
#include "AudioCodecPluginQt.h"
|
||||||
#include "AudioThread.h"
|
#include "AudioThread.h"
|
||||||
#include <LibAudio/Loader.h>
|
#include <LibAudio/Loader.h>
|
||||||
|
|
||||||
namespace Ladybird {
|
namespace Ladybird {
|
||||||
|
|
||||||
ErrorOr<NonnullOwnPtr<AudioCodecPluginLadybird>> AudioCodecPluginLadybird::create(NonnullRefPtr<Audio::Loader> loader)
|
ErrorOr<NonnullOwnPtr<AudioCodecPluginQt>> AudioCodecPluginQt::create(NonnullRefPtr<Audio::Loader> loader)
|
||||||
{
|
{
|
||||||
auto audio_thread = TRY(AudioThread::create(move(loader)));
|
auto audio_thread = TRY(AudioThread::create(move(loader)));
|
||||||
audio_thread->start();
|
audio_thread->start();
|
||||||
|
|
||||||
return adopt_nonnull_own_or_enomem(new (nothrow) AudioCodecPluginLadybird(move(audio_thread)));
|
return adopt_nonnull_own_or_enomem(new (nothrow) AudioCodecPluginQt(move(audio_thread)));
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioCodecPluginLadybird::AudioCodecPluginLadybird(NonnullOwnPtr<AudioThread> audio_thread)
|
AudioCodecPluginQt::AudioCodecPluginQt(NonnullOwnPtr<AudioThread> audio_thread)
|
||||||
: m_audio_thread(move(audio_thread))
|
: m_audio_thread(move(audio_thread))
|
||||||
{
|
{
|
||||||
connect(m_audio_thread, &AudioThread::playback_position_updated, this, [this](auto position) {
|
connect(m_audio_thread, &AudioThread::playback_position_updated, this, [this](auto position) {
|
||||||
|
@ -27,22 +27,22 @@ AudioCodecPluginLadybird::AudioCodecPluginLadybird(NonnullOwnPtr<AudioThread> au
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioCodecPluginLadybird::~AudioCodecPluginLadybird()
|
AudioCodecPluginQt::~AudioCodecPluginQt()
|
||||||
{
|
{
|
||||||
m_audio_thread->stop().release_value_but_fixme_should_propagate_errors();
|
m_audio_thread->stop().release_value_but_fixme_should_propagate_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioCodecPluginLadybird::resume_playback()
|
void AudioCodecPluginQt::resume_playback()
|
||||||
{
|
{
|
||||||
m_audio_thread->queue_task({ AudioTask::Type::Play }).release_value_but_fixme_should_propagate_errors();
|
m_audio_thread->queue_task({ AudioTask::Type::Play }).release_value_but_fixme_should_propagate_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioCodecPluginLadybird::pause_playback()
|
void AudioCodecPluginQt::pause_playback()
|
||||||
{
|
{
|
||||||
m_audio_thread->queue_task({ AudioTask::Type::Pause }).release_value_but_fixme_should_propagate_errors();
|
m_audio_thread->queue_task({ AudioTask::Type::Pause }).release_value_but_fixme_should_propagate_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioCodecPluginLadybird::set_volume(double volume)
|
void AudioCodecPluginQt::set_volume(double volume)
|
||||||
{
|
{
|
||||||
|
|
||||||
AudioTask task { AudioTask::Type::Volume };
|
AudioTask task { AudioTask::Type::Volume };
|
||||||
|
@ -51,7 +51,7 @@ void AudioCodecPluginLadybird::set_volume(double volume)
|
||||||
m_audio_thread->queue_task(move(task)).release_value_but_fixme_should_propagate_errors();
|
m_audio_thread->queue_task(move(task)).release_value_but_fixme_should_propagate_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioCodecPluginLadybird::seek(double position)
|
void AudioCodecPluginQt::seek(double position)
|
||||||
{
|
{
|
||||||
AudioTask task { AudioTask::Type::Seek };
|
AudioTask task { AudioTask::Type::Seek };
|
||||||
task.data = position;
|
task.data = position;
|
||||||
|
@ -59,7 +59,7 @@ void AudioCodecPluginLadybird::seek(double position)
|
||||||
m_audio_thread->queue_task(move(task)).release_value_but_fixme_should_propagate_errors();
|
m_audio_thread->queue_task(move(task)).release_value_but_fixme_should_propagate_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
Duration AudioCodecPluginLadybird::duration()
|
Duration AudioCodecPluginQt::duration()
|
||||||
{
|
{
|
||||||
return m_audio_thread->duration();
|
return m_audio_thread->duration();
|
||||||
}
|
}
|
|
@ -17,14 +17,14 @@ namespace Ladybird {
|
||||||
|
|
||||||
class AudioThread;
|
class AudioThread;
|
||||||
|
|
||||||
class AudioCodecPluginLadybird final
|
class AudioCodecPluginQt final
|
||||||
: public QObject
|
: public QObject
|
||||||
, public Web::Platform::AudioCodecPlugin {
|
, public Web::Platform::AudioCodecPlugin {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static ErrorOr<NonnullOwnPtr<AudioCodecPluginLadybird>> create(NonnullRefPtr<Audio::Loader>);
|
static ErrorOr<NonnullOwnPtr<AudioCodecPluginQt>> create(NonnullRefPtr<Audio::Loader>);
|
||||||
virtual ~AudioCodecPluginLadybird() override;
|
virtual ~AudioCodecPluginQt() override;
|
||||||
|
|
||||||
virtual void resume_playback() override;
|
virtual void resume_playback() override;
|
||||||
virtual void pause_playback() override;
|
virtual void pause_playback() override;
|
||||||
|
@ -34,7 +34,7 @@ public:
|
||||||
virtual Duration duration() override;
|
virtual Duration duration() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit AudioCodecPluginLadybird(NonnullOwnPtr<AudioThread>);
|
explicit AudioCodecPluginQt(NonnullOwnPtr<AudioThread>);
|
||||||
|
|
||||||
NonnullOwnPtr<AudioThread> m_audio_thread;
|
NonnullOwnPtr<AudioThread> m_audio_thread;
|
||||||
};
|
};
|
|
@ -5,7 +5,7 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "FontPluginLadybird.h"
|
#include "FontPlugin.h"
|
||||||
#include <AK/DeprecatedString.h>
|
#include <AK/DeprecatedString.h>
|
||||||
#include <AK/String.h>
|
#include <AK/String.h>
|
||||||
#include <LibCore/StandardPaths.h>
|
#include <LibCore/StandardPaths.h>
|
||||||
|
@ -16,7 +16,7 @@ extern DeprecatedString s_serenity_resource_root;
|
||||||
|
|
||||||
namespace Ladybird {
|
namespace Ladybird {
|
||||||
|
|
||||||
FontPluginLadybird::FontPluginLadybird(bool is_layout_test_mode)
|
FontPlugin::FontPlugin(bool is_layout_test_mode)
|
||||||
: m_is_layout_test_mode(is_layout_test_mode)
|
: m_is_layout_test_mode(is_layout_test_mode)
|
||||||
{
|
{
|
||||||
// Load the default SerenityOS fonts...
|
// Load the default SerenityOS fonts...
|
||||||
|
@ -42,19 +42,19 @@ FontPluginLadybird::FontPluginLadybird(bool is_layout_test_mode)
|
||||||
VERIFY(m_default_fixed_width_font);
|
VERIFY(m_default_fixed_width_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
FontPluginLadybird::~FontPluginLadybird() = default;
|
FontPlugin::~FontPlugin() = default;
|
||||||
|
|
||||||
Gfx::Font& FontPluginLadybird::default_font()
|
Gfx::Font& FontPlugin::default_font()
|
||||||
{
|
{
|
||||||
return *m_default_font;
|
return *m_default_font;
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::Font& FontPluginLadybird::default_fixed_width_font()
|
Gfx::Font& FontPlugin::default_fixed_width_font()
|
||||||
{
|
{
|
||||||
return *m_default_fixed_width_font;
|
return *m_default_fixed_width_font;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FontPluginLadybird::update_generic_fonts()
|
void FontPlugin::update_generic_fonts()
|
||||||
{
|
{
|
||||||
// How we choose which system font to use for each CSS font:
|
// How we choose which system font to use for each CSS font:
|
||||||
// 1. Try a list of known-suitable fonts with their names hard-coded below.
|
// 1. Try a list of known-suitable fonts with their names hard-coded below.
|
||||||
|
@ -109,7 +109,7 @@ void FontPluginLadybird::update_generic_fonts()
|
||||||
update_mapping(Web::Platform::GenericFont::UiSerif, serif_fallbacks);
|
update_mapping(Web::Platform::GenericFont::UiSerif, serif_fallbacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString FontPluginLadybird::generic_font_name(Web::Platform::GenericFont generic_font)
|
DeprecatedString FontPlugin::generic_font_name(Web::Platform::GenericFont generic_font)
|
||||||
{
|
{
|
||||||
return m_generic_font_names[static_cast<size_t>(generic_font)];
|
return m_generic_font_names[static_cast<size_t>(generic_font)];
|
||||||
}
|
}
|
|
@ -12,10 +12,10 @@
|
||||||
|
|
||||||
namespace Ladybird {
|
namespace Ladybird {
|
||||||
|
|
||||||
class FontPluginLadybird final : public Web::Platform::FontPlugin {
|
class FontPlugin final : public Web::Platform::FontPlugin {
|
||||||
public:
|
public:
|
||||||
FontPluginLadybird(bool is_layout_test_mode);
|
FontPlugin(bool is_layout_test_mode);
|
||||||
virtual ~FontPluginLadybird();
|
virtual ~FontPlugin();
|
||||||
|
|
||||||
virtual Gfx::Font& default_font() override;
|
virtual Gfx::Font& default_font() override;
|
||||||
virtual Gfx::Font& default_fixed_width_font() override;
|
virtual Gfx::Font& default_fixed_width_font() override;
|
|
@ -5,15 +5,15 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ImageCodecPluginLadybird.h"
|
#include "ImageCodecPlugin.h"
|
||||||
#include <LibGfx/Bitmap.h>
|
#include <LibGfx/Bitmap.h>
|
||||||
#include <LibGfx/ImageFormats/ImageDecoder.h>
|
#include <LibGfx/ImageFormats/ImageDecoder.h>
|
||||||
|
|
||||||
namespace Ladybird {
|
namespace Ladybird {
|
||||||
|
|
||||||
ImageCodecPluginLadybird::~ImageCodecPluginLadybird() = default;
|
ImageCodecPlugin::~ImageCodecPlugin() = default;
|
||||||
|
|
||||||
Optional<Web::Platform::DecodedImage> ImageCodecPluginLadybird::decode_image(ReadonlyBytes data)
|
Optional<Web::Platform::DecodedImage> ImageCodecPlugin::decode_image(ReadonlyBytes data)
|
||||||
{
|
{
|
||||||
auto decoder = Gfx::ImageDecoder::try_create_for_raw_bytes(data);
|
auto decoder = Gfx::ImageDecoder::try_create_for_raw_bytes(data);
|
||||||
|
|
|
@ -11,10 +11,10 @@
|
||||||
|
|
||||||
namespace Ladybird {
|
namespace Ladybird {
|
||||||
|
|
||||||
class ImageCodecPluginLadybird final : public Web::Platform::ImageCodecPlugin {
|
class ImageCodecPlugin final : public Web::Platform::ImageCodecPlugin {
|
||||||
public:
|
public:
|
||||||
ImageCodecPluginLadybird() = default;
|
ImageCodecPlugin() = default;
|
||||||
virtual ~ImageCodecPluginLadybird() override;
|
virtual ~ImageCodecPlugin() override;
|
||||||
|
|
||||||
virtual Optional<Web::Platform::DecodedImage> decode_image(ReadonlyBytes data) override;
|
virtual Optional<Web::Platform::DecodedImage> decode_image(ReadonlyBytes data) override;
|
||||||
};
|
};
|
|
@ -6,16 +6,16 @@ set(WEBCONTENT_SOURCES
|
||||||
${WEBCONTENT_SOURCE_DIR}/PageHost.cpp
|
${WEBCONTENT_SOURCE_DIR}/PageHost.cpp
|
||||||
${WEBCONTENT_SOURCE_DIR}/WebContentConsoleClient.cpp
|
${WEBCONTENT_SOURCE_DIR}/WebContentConsoleClient.cpp
|
||||||
${WEBCONTENT_SOURCE_DIR}/WebDriverConnection.cpp
|
${WEBCONTENT_SOURCE_DIR}/WebDriverConnection.cpp
|
||||||
../AudioCodecPluginLadybird.cpp
|
../AudioCodecPluginQt.cpp
|
||||||
../AudioThread.cpp
|
../AudioThread.cpp
|
||||||
../EventLoopImplementationQt.cpp
|
../EventLoopImplementationQt.cpp
|
||||||
../FontPluginLadybird.cpp
|
../FontPlugin.cpp
|
||||||
../HelperProcess.cpp
|
../HelperProcess.cpp
|
||||||
../ImageCodecPluginLadybird.cpp
|
../ImageCodecPlugin.cpp
|
||||||
../RequestManagerQt.cpp
|
../RequestManagerQt.cpp
|
||||||
../Utilities.cpp
|
../Utilities.cpp
|
||||||
../WebSocketClientManagerLadybird.cpp
|
../WebSocketClientManagerQt.cpp
|
||||||
../WebSocketLadybird.cpp
|
../WebSocketQt.cpp
|
||||||
../WebSocketImplQt.cpp
|
../WebSocketImplQt.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../AudioCodecPluginLadybird.h"
|
#include "../AudioCodecPluginQt.h"
|
||||||
#include "../EventLoopImplementationQt.h"
|
#include "../EventLoopImplementationQt.h"
|
||||||
#include "../FontPluginLadybird.h"
|
#include "../FontPlugin.h"
|
||||||
#include "../HelperProcess.h"
|
#include "../HelperProcess.h"
|
||||||
#include "../ImageCodecPluginLadybird.h"
|
#include "../ImageCodecPlugin.h"
|
||||||
#include "../RequestManagerQt.h"
|
#include "../RequestManagerQt.h"
|
||||||
#include "../Utilities.h"
|
#include "../Utilities.h"
|
||||||
#include "../WebSocketClientManagerLadybird.h"
|
#include "../WebSocketClientManagerQt.h"
|
||||||
#include <AK/LexicalPath.h>
|
#include <AK/LexicalPath.h>
|
||||||
#include <LibAudio/Loader.h>
|
#include <LibAudio/Loader.h>
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
|
@ -50,13 +50,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
platform_init();
|
platform_init();
|
||||||
|
|
||||||
Web::Platform::EventLoopPlugin::install(*new Web::Platform::EventLoopPluginSerenity);
|
Web::Platform::EventLoopPlugin::install(*new Web::Platform::EventLoopPluginSerenity);
|
||||||
Web::Platform::ImageCodecPlugin::install(*new Ladybird::ImageCodecPluginLadybird);
|
Web::Platform::ImageCodecPlugin::install(*new Ladybird::ImageCodecPlugin);
|
||||||
|
|
||||||
Web::Platform::AudioCodecPlugin::install_creation_hook([](auto loader) {
|
Web::Platform::AudioCodecPlugin::install_creation_hook([](auto loader) {
|
||||||
return Ladybird::AudioCodecPluginLadybird::create(move(loader));
|
return Ladybird::AudioCodecPluginQt::create(move(loader));
|
||||||
});
|
});
|
||||||
|
|
||||||
Web::WebSockets::WebSocketClientManager::initialize(Ladybird::WebSocketClientManagerLadybird::create());
|
Web::WebSockets::WebSocketClientManager::initialize(Ladybird::WebSocketClientManagerQt::create());
|
||||||
|
|
||||||
Web::FrameLoader::set_default_favicon_path(DeprecatedString::formatted("{}/res/icons/16x16/app-browser.png", s_serenity_resource_root));
|
Web::FrameLoader::set_default_favicon_path(DeprecatedString::formatted("{}/res/icons/16x16/app-browser.png", s_serenity_resource_root));
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
|
|
||||||
VERIFY(webcontent_fd_passing_socket >= 0);
|
VERIFY(webcontent_fd_passing_socket >= 0);
|
||||||
|
|
||||||
Web::Platform::FontPlugin::install(*new Ladybird::FontPluginLadybird(is_layout_test_mode));
|
Web::Platform::FontPlugin::install(*new Ladybird::FontPlugin(is_layout_test_mode));
|
||||||
|
|
||||||
Web::FrameLoader::set_error_page_url(DeprecatedString::formatted("file://{}/res/html/error.html", s_serenity_resource_root));
|
Web::FrameLoader::set_error_page_url(DeprecatedString::formatted("file://{}/res/html/error.html", s_serenity_resource_root));
|
||||||
|
|
||||||
|
|
|
@ -5,21 +5,21 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "WebSocketClientManagerLadybird.h"
|
#include "WebSocketClientManagerQt.h"
|
||||||
#include "WebSocketImplQt.h"
|
#include "WebSocketImplQt.h"
|
||||||
#include "WebSocketLadybird.h"
|
#include "WebSocketQt.h"
|
||||||
|
|
||||||
namespace Ladybird {
|
namespace Ladybird {
|
||||||
|
|
||||||
NonnullRefPtr<WebSocketClientManagerLadybird> WebSocketClientManagerLadybird::create()
|
NonnullRefPtr<WebSocketClientManagerQt> WebSocketClientManagerQt::create()
|
||||||
{
|
{
|
||||||
return adopt_ref(*new WebSocketClientManagerLadybird());
|
return adopt_ref(*new WebSocketClientManagerQt());
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSocketClientManagerLadybird::WebSocketClientManagerLadybird() = default;
|
WebSocketClientManagerQt::WebSocketClientManagerQt() = default;
|
||||||
WebSocketClientManagerLadybird::~WebSocketClientManagerLadybird() = default;
|
WebSocketClientManagerQt::~WebSocketClientManagerQt() = default;
|
||||||
|
|
||||||
RefPtr<Web::WebSockets::WebSocketClientSocket> WebSocketClientManagerLadybird::connect(AK::URL const& url, DeprecatedString const& origin, Vector<DeprecatedString> const& protocols)
|
RefPtr<Web::WebSockets::WebSocketClientSocket> WebSocketClientManagerQt::connect(AK::URL const& url, DeprecatedString const& origin, Vector<DeprecatedString> const& protocols)
|
||||||
{
|
{
|
||||||
WebSocket::ConnectionInfo connection_info(url);
|
WebSocket::ConnectionInfo connection_info(url);
|
||||||
connection_info.set_origin(origin);
|
connection_info.set_origin(origin);
|
||||||
|
@ -28,7 +28,7 @@ RefPtr<Web::WebSockets::WebSocketClientSocket> WebSocketClientManagerLadybird::c
|
||||||
auto impl = adopt_ref(*new WebSocketImplQt);
|
auto impl = adopt_ref(*new WebSocketImplQt);
|
||||||
auto web_socket = WebSocket::WebSocket::create(move(connection_info), move(impl));
|
auto web_socket = WebSocket::WebSocket::create(move(connection_info), move(impl));
|
||||||
web_socket->start();
|
web_socket->start();
|
||||||
return WebSocketLadybird::create(web_socket);
|
return WebSocketQt::create(web_socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -14,15 +14,15 @@
|
||||||
|
|
||||||
namespace Ladybird {
|
namespace Ladybird {
|
||||||
|
|
||||||
class WebSocketClientManagerLadybird : public Web::WebSockets::WebSocketClientManager {
|
class WebSocketClientManagerQt : public Web::WebSockets::WebSocketClientManager {
|
||||||
public:
|
public:
|
||||||
static NonnullRefPtr<WebSocketClientManagerLadybird> create();
|
static NonnullRefPtr<WebSocketClientManagerQt> create();
|
||||||
|
|
||||||
virtual ~WebSocketClientManagerLadybird() override;
|
virtual ~WebSocketClientManagerQt() override;
|
||||||
virtual RefPtr<Web::WebSockets::WebSocketClientSocket> connect(AK::URL const&, DeprecatedString const& origin, Vector<DeprecatedString> const& protocols) override;
|
virtual RefPtr<Web::WebSockets::WebSocketClientSocket> connect(AK::URL const&, DeprecatedString const& origin, Vector<DeprecatedString> const& protocols) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WebSocketClientManagerLadybird();
|
WebSocketClientManagerQt();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
|
@ -5,16 +5,16 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "WebSocketLadybird.h"
|
#include "WebSocketQt.h"
|
||||||
|
|
||||||
namespace Ladybird {
|
namespace Ladybird {
|
||||||
|
|
||||||
NonnullRefPtr<WebSocketLadybird> WebSocketLadybird::create(NonnullRefPtr<WebSocket::WebSocket> underlying_socket)
|
NonnullRefPtr<WebSocketQt> WebSocketQt::create(NonnullRefPtr<WebSocket::WebSocket> underlying_socket)
|
||||||
{
|
{
|
||||||
return adopt_ref(*new WebSocketLadybird(move(underlying_socket)));
|
return adopt_ref(*new WebSocketQt(move(underlying_socket)));
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSocketLadybird::WebSocketLadybird(NonnullRefPtr<WebSocket::WebSocket> underlying_socket)
|
WebSocketQt::WebSocketQt(NonnullRefPtr<WebSocket::WebSocket> underlying_socket)
|
||||||
: m_websocket(move(underlying_socket))
|
: m_websocket(move(underlying_socket))
|
||||||
{
|
{
|
||||||
m_websocket->on_open = [weak_this = make_weak_ptr()] {
|
m_websocket->on_open = [weak_this = make_weak_ptr()] {
|
||||||
|
@ -57,9 +57,9 @@ WebSocketLadybird::WebSocketLadybird(NonnullRefPtr<WebSocket::WebSocket> underly
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSocketLadybird::~WebSocketLadybird() = default;
|
WebSocketQt::~WebSocketQt() = default;
|
||||||
|
|
||||||
Web::WebSockets::WebSocket::ReadyState WebSocketLadybird::ready_state()
|
Web::WebSockets::WebSocket::ReadyState WebSocketQt::ready_state()
|
||||||
{
|
{
|
||||||
switch (m_websocket->ready_state()) {
|
switch (m_websocket->ready_state()) {
|
||||||
case WebSocket::ReadyState::Connecting:
|
case WebSocket::ReadyState::Connecting:
|
||||||
|
@ -74,22 +74,22 @@ Web::WebSockets::WebSocket::ReadyState WebSocketLadybird::ready_state()
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString WebSocketLadybird::subprotocol_in_use()
|
DeprecatedString WebSocketQt::subprotocol_in_use()
|
||||||
{
|
{
|
||||||
return m_websocket->subprotocol_in_use();
|
return m_websocket->subprotocol_in_use();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebSocketLadybird::send(ByteBuffer binary_or_text_message, bool is_text)
|
void WebSocketQt::send(ByteBuffer binary_or_text_message, bool is_text)
|
||||||
{
|
{
|
||||||
m_websocket->send(WebSocket::Message(binary_or_text_message, is_text));
|
m_websocket->send(WebSocket::Message(binary_or_text_message, is_text));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebSocketLadybird::send(StringView message)
|
void WebSocketQt::send(StringView message)
|
||||||
{
|
{
|
||||||
m_websocket->send(WebSocket::Message(message));
|
m_websocket->send(WebSocket::Message(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebSocketLadybird::close(u16 code, DeprecatedString reason)
|
void WebSocketQt::close(u16 code, DeprecatedString reason)
|
||||||
{
|
{
|
||||||
m_websocket->close(code, reason);
|
m_websocket->close(code, reason);
|
||||||
}
|
}
|
|
@ -12,13 +12,13 @@
|
||||||
|
|
||||||
namespace Ladybird {
|
namespace Ladybird {
|
||||||
|
|
||||||
class WebSocketLadybird
|
class WebSocketQt
|
||||||
: public Web::WebSockets::WebSocketClientSocket
|
: public Web::WebSockets::WebSocketClientSocket
|
||||||
, public Weakable<WebSocketLadybird> {
|
, public Weakable<WebSocketQt> {
|
||||||
public:
|
public:
|
||||||
static NonnullRefPtr<WebSocketLadybird> create(NonnullRefPtr<WebSocket::WebSocket>);
|
static NonnullRefPtr<WebSocketQt> create(NonnullRefPtr<WebSocket::WebSocket>);
|
||||||
|
|
||||||
virtual ~WebSocketLadybird() override;
|
virtual ~WebSocketQt() override;
|
||||||
|
|
||||||
virtual Web::WebSockets::WebSocket::ReadyState ready_state() override;
|
virtual Web::WebSockets::WebSocket::ReadyState ready_state() override;
|
||||||
virtual DeprecatedString subprotocol_in_use() override;
|
virtual DeprecatedString subprotocol_in_use() override;
|
||||||
|
@ -27,7 +27,7 @@ public:
|
||||||
virtual void close(u16 code, DeprecatedString reason) override;
|
virtual void close(u16 code, DeprecatedString reason) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit WebSocketLadybird(NonnullRefPtr<WebSocket::WebSocket>);
|
explicit WebSocketQt(NonnullRefPtr<WebSocket::WebSocket>);
|
||||||
|
|
||||||
NonnullRefPtr<WebSocket::WebSocket> m_websocket;
|
NonnullRefPtr<WebSocket::WebSocket> m_websocket;
|
||||||
};
|
};
|
|
@ -3,7 +3,7 @@ import("//Ladybird/moc_qt_objects.gni")
|
||||||
|
|
||||||
moc_qt_objects("generate_moc") {
|
moc_qt_objects("generate_moc") {
|
||||||
sources = [
|
sources = [
|
||||||
"//Ladybird/AudioCodecPluginLadybird.h",
|
"//Ladybird/AudioCodecPluginQt.h",
|
||||||
"//Ladybird/AudioThread.h",
|
"//Ladybird/AudioThread.h",
|
||||||
"//Ladybird/RequestManagerQt.h",
|
"//Ladybird/RequestManagerQt.h",
|
||||||
]
|
]
|
||||||
|
@ -45,17 +45,17 @@ executable("WebContent") {
|
||||||
"//Userland/Libraries/LibWebView:WebDriverServerEndpoint",
|
"//Userland/Libraries/LibWebView:WebDriverServerEndpoint",
|
||||||
]
|
]
|
||||||
sources = [
|
sources = [
|
||||||
"../AudioCodecPluginLadybird.cpp",
|
"../AudioCodecPluginQt.cpp",
|
||||||
"../AudioThread.cpp",
|
"../AudioThread.cpp",
|
||||||
"../EventLoopImplementationQt.cpp",
|
"../EventLoopImplementationQt.cpp",
|
||||||
"../FontPluginLadybird.cpp",
|
"../FontPlugin.cpp",
|
||||||
"../HelperProcess.cpp",
|
"../HelperProcess.cpp",
|
||||||
"../ImageCodecPluginLadybird.cpp",
|
"../ImageCodecPlugin.cpp",
|
||||||
"../RequestManagerQt.cpp",
|
"../RequestManagerQt.cpp",
|
||||||
"../Utilities.cpp",
|
"../Utilities.cpp",
|
||||||
"../WebSocketClientManagerLadybird.cpp",
|
"../WebSocketClientManagerQt.cpp",
|
||||||
"../WebSocketImplQt.cpp",
|
"../WebSocketImplQt.cpp",
|
||||||
"../WebSocketLadybird.cpp",
|
"../WebSocketQt.cpp",
|
||||||
"//Userland/Services/WebContent/ConnectionFromClient.cpp",
|
"//Userland/Services/WebContent/ConnectionFromClient.cpp",
|
||||||
"//Userland/Services/WebContent/ConsoleGlobalEnvironmentExtensions.cpp",
|
"//Userland/Services/WebContent/ConsoleGlobalEnvironmentExtensions.cpp",
|
||||||
"//Userland/Services/WebContent/PageHost.cpp",
|
"//Userland/Services/WebContent/PageHost.cpp",
|
||||||
|
|
Loading…
Reference in a new issue