mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
LibWebView+Services+UI: Move process helpers to LibWebView
This commit is contained in:
parent
a14937c45e
commit
0ff91a5273
Notes:
github-actions[bot]
2024-11-11 12:36:39 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/0ff91a52733 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2269
29 changed files with 110 additions and 119 deletions
|
@ -7,6 +7,7 @@ set(SOURCES
|
|||
ChromeProcess.cpp
|
||||
CookieJar.cpp
|
||||
Database.cpp
|
||||
HelperProcess.cpp
|
||||
InspectorClient.cpp
|
||||
Plugins/FontPlugin.cpp
|
||||
Plugins/ImageCodecPlugin.cpp
|
||||
|
@ -17,11 +18,16 @@ set(SOURCES
|
|||
SourceHighlighter.cpp
|
||||
URL.cpp
|
||||
UserAgent.cpp
|
||||
Utilities.cpp
|
||||
ViewImplementation.cpp
|
||||
WebContentClient.cpp
|
||||
${PUBLIC_SUFFIX_SOURCES}
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
list(APPEND SOURCES MachPortServer.cpp)
|
||||
endif()
|
||||
|
||||
if (ENABLE_QT)
|
||||
list(APPEND SOURCES
|
||||
EventLoop/EventLoopImplementationQt.cpp
|
||||
|
@ -49,6 +55,10 @@ embed_as_string(
|
|||
compile_ipc(UIProcessServer.ipc UIProcessServerEndpoint.h)
|
||||
compile_ipc(UIProcessClient.ipc UIProcessClientEndpoint.h)
|
||||
|
||||
if (NOT APPLE AND NOT CMAKE_INSTALL_LIBEXECDIR STREQUAL "libexec")
|
||||
set_source_files_properties(Utilities.cpp PROPERTIES COMPILE_DEFINITIONS LADYBIRD_LIBEXECDIR="${CMAKE_INSTALL_LIBEXECDIR}")
|
||||
endif()
|
||||
|
||||
set(GENERATED_SOURCES
|
||||
${GENERATED_SOURCES}
|
||||
../../Services/RequestServer/RequestClientEndpoint.h
|
||||
|
@ -66,6 +76,10 @@ serenity_lib(LibWebView webview)
|
|||
target_link_libraries(LibWebView PRIVATE LibCore LibFileSystem LibGfx LibImageDecoderClient LibIPC LibRequests LibJS LibWeb LibUnicode LibURL LibSyntax)
|
||||
target_compile_definitions(LibWebView PRIVATE ENABLE_PUBLIC_SUFFIX=$<BOOL:${ENABLE_PUBLIC_SUFFIX_DOWNLOAD}>)
|
||||
|
||||
if (APPLE)
|
||||
target_link_libraries(LibWebView PRIVATE LibThreading)
|
||||
endif()
|
||||
|
||||
# Third-party
|
||||
find_package(SQLite3 REQUIRED)
|
||||
target_link_libraries(LibWebView PRIVATE SQLite::SQLite3)
|
||||
|
|
|
@ -7,8 +7,10 @@
|
|||
#include <AK/Enumerate.h>
|
||||
#include <LibCore/Process.h>
|
||||
#include <LibWebView/Application.h>
|
||||
#include <UI/HelperProcess.h>
|
||||
#include <UI/Utilities.h>
|
||||
#include <LibWebView/HelperProcess.h>
|
||||
#include <LibWebView/Utilities.h>
|
||||
|
||||
namespace WebView {
|
||||
|
||||
template<typename ClientType, typename... ClientArguments>
|
||||
static ErrorOr<NonnullRefPtr<ClientType>> launch_server_process(
|
||||
|
@ -191,3 +193,5 @@ ErrorOr<IPC::File> connect_new_image_decoder_client(ImageDecoderClient::Client&
|
|||
|
||||
return socket;
|
||||
}
|
||||
|
||||
}
|
|
@ -16,6 +16,8 @@
|
|||
#include <LibWebView/ViewImplementation.h>
|
||||
#include <LibWebView/WebContentClient.h>
|
||||
|
||||
namespace WebView {
|
||||
|
||||
ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(
|
||||
WebView::ViewImplementation& view,
|
||||
ReadonlySpan<ByteString> candidate_web_content_paths,
|
||||
|
@ -28,3 +30,5 @@ ErrorOr<NonnullRefPtr<Requests::RequestClient>> launch_request_server_process(Re
|
|||
|
||||
ErrorOr<IPC::File> connect_new_request_server_client(Requests::RequestClient&);
|
||||
ErrorOr<IPC::File> connect_new_image_decoder_client(ImageDecoderClient::Client&);
|
||||
|
||||
}
|
|
@ -7,9 +7,9 @@
|
|||
#include <AK/Debug.h>
|
||||
#include <LibCore/Platform/MachMessageTypes.h>
|
||||
#include <LibCore/Platform/ProcessStatisticsMach.h>
|
||||
#include <UI/MachPortServer.h>
|
||||
#include <LibWebView/MachPortServer.h>
|
||||
|
||||
namespace Ladybird {
|
||||
namespace WebView {
|
||||
|
||||
MachPortServer::MachPortServer()
|
||||
: m_thread(Threading::Thread::construct([this]() -> intptr_t { thread_loop(); return 0; }, "MachPortServer"sv))
|
|
@ -6,18 +6,17 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Atomic.h>
|
||||
#include <AK/Platform.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/MachPort.h>
|
||||
#include <LibThreading/Thread.h>
|
||||
|
||||
#if !defined(AK_OS_MACH)
|
||||
# error "This file is only for Mach kernel-based OS's"
|
||||
#endif
|
||||
|
||||
#include <AK/Atomic.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/MachPort.h>
|
||||
#include <LibThreading/Thread.h>
|
||||
|
||||
namespace Ladybird {
|
||||
namespace WebView {
|
||||
|
||||
class MachPortServer {
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
#include <LibGfx/ImageFormats/ImageDecoder.h>
|
||||
#include <LibImageDecoderClient/Client.h>
|
||||
#include <LibWebView/Plugins/ImageCodecPlugin.h>
|
||||
#include <UI/Utilities.h>
|
||||
#include <LibWebView/Utilities.h>
|
||||
|
||||
namespace WebView {
|
||||
|
||||
|
|
|
@ -13,16 +13,18 @@
|
|||
#include <LibCore/ResourceImplementationFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibFileSystem/FileSystem.h>
|
||||
#include <UI/Utilities.h>
|
||||
#include <LibWebView/Utilities.h>
|
||||
|
||||
#define TOKENCAT(x, y) x##y
|
||||
#define STRINGIFY(x) TOKENCAT(x, sv)
|
||||
|
||||
namespace WebView {
|
||||
|
||||
// This is expected to be set from the build scripts, if a packager desires
|
||||
#if defined(LADYBIRD_LIBEXECDIR)
|
||||
constexpr auto libexec_path = STRINGIFY(LADYBIRD_LIBEXECDIR);
|
||||
static constexpr auto libexec_path = STRINGIFY(LADYBIRD_LIBEXECDIR);
|
||||
#else
|
||||
constexpr auto libexec_path = "libexec"sv;
|
||||
static constexpr auto libexec_path = "libexec"sv;
|
||||
#endif
|
||||
|
||||
ByteString s_ladybird_resource_root;
|
||||
|
@ -112,3 +114,5 @@ ErrorOr<Vector<ByteString>> get_paths_for_helper_process(StringView process_name
|
|||
// NOTE: Add platform-specific paths here
|
||||
return paths;
|
||||
}
|
||||
|
||||
}
|
|
@ -12,6 +12,8 @@
|
|||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
namespace WebView {
|
||||
|
||||
void platform_init();
|
||||
void copy_default_config_files(StringView config_path);
|
||||
ErrorOr<ByteString> application_directory();
|
||||
|
@ -20,3 +22,5 @@ ErrorOr<Vector<ByteString>> get_paths_for_helper_process(StringView process_name
|
|||
extern ByteString s_ladybird_resource_root;
|
||||
Optional<ByteString const&> mach_server_name();
|
||||
void set_mach_server_name(ByteString name);
|
||||
|
||||
}
|
|
@ -10,7 +10,6 @@ if (ANDROID)
|
|||
add_library(imagedecoderservice SHARED
|
||||
${LADYBIRD_SOURCE_DIR}/UI/Android/src/main/cpp/ImageDecoderService.cpp
|
||||
${LADYBIRD_SOURCE_DIR}/UI/Android/src/main/cpp/LadybirdServiceBaseJNI.cpp
|
||||
${LADYBIRD_SOURCE_DIR}/UI/Utilities.cpp
|
||||
${SOURCES}
|
||||
)
|
||||
else()
|
||||
|
|
|
@ -10,7 +10,6 @@ if (ANDROID)
|
|||
add_library(requestserverservice SHARED
|
||||
${LADYBIRD_SOURCE_DIR}/UI/Android/src/main/cpp/RequestServerService.cpp
|
||||
${LADYBIRD_SOURCE_DIR}/UI/Android/src/main/cpp/LadybirdServiceBaseJNI.cpp
|
||||
${LADYBIRD_SOURCE_DIR}/UI/Utilities.cpp
|
||||
${SOURCES}
|
||||
)
|
||||
else()
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
include(pulseaudio)
|
||||
|
||||
set(SOURCES
|
||||
${LADYBIRD_SOURCE_DIR}/UI/HelperProcess.cpp
|
||||
${LADYBIRD_SOURCE_DIR}/UI/Utilities.cpp
|
||||
ConnectionFromClient.cpp
|
||||
ConsoleGlobalEnvironmentExtensions.cpp
|
||||
BackingStoreManager.cpp
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include <LibWeb/Platform/EventLoopPluginSerenity.h>
|
||||
#include <LibWebView/Plugins/FontPlugin.h>
|
||||
#include <LibWebView/Plugins/ImageCodecPlugin.h>
|
||||
#include <UI/Utilities.h>
|
||||
#include <LibWebView/Utilities.h>
|
||||
#include <WebContent/ConnectionFromClient.h>
|
||||
#include <WebContent/PageClient.h>
|
||||
#include <WebContent/WebDriverConnection.h>
|
||||
|
@ -75,7 +75,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
#endif
|
||||
Core::EventLoop event_loop;
|
||||
|
||||
platform_init();
|
||||
WebView::platform_init();
|
||||
|
||||
Web::Platform::EventLoopPlugin::install(*new Web::Platform::EventLoopPluginSerenity);
|
||||
|
||||
|
@ -92,7 +92,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
StringView command_line {};
|
||||
StringView executable_path {};
|
||||
auto config_path = ByteString::formatted("{}/ladybird/default-config", s_ladybird_resource_root);
|
||||
auto config_path = ByteString::formatted("{}/ladybird/default-config", WebView::s_ladybird_resource_root);
|
||||
StringView mach_server_name {};
|
||||
Vector<ByteString> certificates;
|
||||
int request_server_socket { -1 };
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
set(SOURCES
|
||||
${LADYBIRD_SOURCE_DIR}/UI/Utilities.cpp
|
||||
Client.cpp
|
||||
Session.cpp
|
||||
WebContentConnection.cpp
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
#include <LibCore/TCPServer.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <LibWeb/WebDriver/Capabilities.h>
|
||||
#include <UI/Utilities.h>
|
||||
#include <LibWebView/Utilities.h>
|
||||
#include <WebDriver/Client.h>
|
||||
|
||||
static Vector<ByteString> certificates;
|
||||
|
||||
static ErrorOr<pid_t> launch_process(StringView application, ReadonlySpan<ByteString> arguments)
|
||||
{
|
||||
auto paths = TRY(get_paths_for_helper_process(application));
|
||||
auto paths = TRY(WebView::get_paths_for_helper_process(application));
|
||||
|
||||
ErrorOr<pid_t> result = -1;
|
||||
for (auto const& path : paths) {
|
||||
|
@ -96,7 +96,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
return 1;
|
||||
}
|
||||
|
||||
platform_init();
|
||||
WebView::platform_init();
|
||||
|
||||
Web::WebDriver::set_default_interface_mode(headless ? Web::WebDriver::InterfaceMode::Headless : Web::WebDriver::InterfaceMode::Graphical);
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
set(WEBWORKER_SOURCES
|
||||
${LADYBIRD_SOURCE_DIR}/UI/HelperProcess.cpp
|
||||
${LADYBIRD_SOURCE_DIR}/UI/Utilities.cpp
|
||||
ConnectionFromClient.cpp
|
||||
DedicatedWorkerHost.cpp
|
||||
PageHost.cpp
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
#include <LibWeb/Platform/EventLoopPlugin.h>
|
||||
#include <LibWeb/Platform/EventLoopPluginSerenity.h>
|
||||
#include <LibWeb/WebSockets/WebSocket.h>
|
||||
#include <LibWebView/HelperProcess.h>
|
||||
#include <LibWebView/Plugins/FontPlugin.h>
|
||||
#include <UI/HelperProcess.h>
|
||||
#include <UI/Utilities.h>
|
||||
#include <LibWebView/Utilities.h>
|
||||
#include <WebWorker/ConnectionFromClient.h>
|
||||
|
||||
#if defined(HAVE_QT)
|
||||
|
@ -56,7 +56,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
#endif
|
||||
Core::EventLoop event_loop;
|
||||
|
||||
platform_init();
|
||||
WebView::platform_init();
|
||||
|
||||
Web::Platform::EventLoopPlugin::install(*new Web::Platform::EventLoopPluginSerenity);
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
#include <LibImageDecoderClient/Client.h>
|
||||
#include <LibRequests/RequestClient.h>
|
||||
#include <LibWebView/Application.h>
|
||||
#include <LibWebView/HelperProcess.h>
|
||||
#include <LibWebView/Utilities.h>
|
||||
#include <LibWebView/WebContentClient.h>
|
||||
#include <UI/HelperProcess.h>
|
||||
#include <UI/Utilities.h>
|
||||
#include <Utilities/Conversions.h>
|
||||
|
||||
#import <Application/Application.h>
|
||||
|
@ -70,16 +70,16 @@ ApplicationBridge::ApplicationBridge(Badge<WebView::Application>, Main::Argument
|
|||
|
||||
- (ErrorOr<void>)launchRequestServer
|
||||
{
|
||||
auto request_server_paths = TRY(get_paths_for_helper_process("RequestServer"sv));
|
||||
m_request_server_client = TRY(launch_request_server_process(request_server_paths, s_ladybird_resource_root));
|
||||
auto request_server_paths = TRY(WebView::get_paths_for_helper_process("RequestServer"sv));
|
||||
m_request_server_client = TRY(WebView::launch_request_server_process(request_server_paths, WebView::s_ladybird_resource_root));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
static ErrorOr<NonnullRefPtr<ImageDecoderClient::Client>> launch_new_image_decoder()
|
||||
{
|
||||
auto image_decoder_paths = TRY(get_paths_for_helper_process("ImageDecoder"sv));
|
||||
return launch_image_decoder_process(image_decoder_paths);
|
||||
auto image_decoder_paths = TRY(WebView::get_paths_for_helper_process("ImageDecoder"sv));
|
||||
return WebView::launch_image_decoder_process(image_decoder_paths);
|
||||
}
|
||||
|
||||
- (ErrorOr<void>)launchImageDecoder
|
||||
|
@ -120,19 +120,19 @@ static ErrorOr<NonnullRefPtr<ImageDecoderClient::Client>> launch_new_image_decod
|
|||
- (ErrorOr<NonnullRefPtr<WebView::WebContentClient>>)launchWebContent:(Ladybird::WebViewBridge&)web_view_bridge
|
||||
{
|
||||
// FIXME: Fail to open the tab, rather than crashing the whole application if this fails
|
||||
auto request_server_socket = TRY(connect_new_request_server_client(*m_request_server_client));
|
||||
auto image_decoder_socket = TRY(connect_new_image_decoder_client(*m_image_decoder_client));
|
||||
auto request_server_socket = TRY(WebView::connect_new_request_server_client(*m_request_server_client));
|
||||
auto image_decoder_socket = TRY(WebView::connect_new_image_decoder_client(*m_image_decoder_client));
|
||||
|
||||
auto web_content_paths = TRY(get_paths_for_helper_process("WebContent"sv));
|
||||
auto web_content = TRY(launch_web_content_process(web_view_bridge, web_content_paths, move(image_decoder_socket), move(request_server_socket)));
|
||||
auto web_content_paths = TRY(WebView::get_paths_for_helper_process("WebContent"sv));
|
||||
auto web_content = TRY(WebView::launch_web_content_process(web_view_bridge, web_content_paths, move(image_decoder_socket), move(request_server_socket)));
|
||||
|
||||
return web_content;
|
||||
}
|
||||
|
||||
- (ErrorOr<IPC::File>)launchWebWorker
|
||||
{
|
||||
auto web_worker_paths = TRY(get_paths_for_helper_process("WebWorker"sv));
|
||||
auto worker_client = TRY(launch_web_worker_process(web_worker_paths, *m_request_server_client));
|
||||
auto web_worker_paths = TRY(WebView::get_paths_for_helper_process("WebWorker"sv));
|
||||
auto worker_client = TRY(WebView::launch_web_worker_process(web_worker_paths, *m_request_server_client));
|
||||
|
||||
return worker_client->clone_transport();
|
||||
}
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
#include <LibWeb/Crypto/Crypto.h>
|
||||
#include <LibWebView/Application.h>
|
||||
#include <LibWebView/UserAgent.h>
|
||||
#include <UI/HelperProcess.h>
|
||||
#include <UI/Utilities.h>
|
||||
|
||||
#import <Interface/Palette.h>
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include <LibCore/Resource.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
#include <LibGfx/SystemTheme.h>
|
||||
#include <UI/Utilities.h>
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <Interface/Palette.h>
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include <LibGfx/ShareableBitmap.h>
|
||||
#include <LibURL/URL.h>
|
||||
#include <LibWebView/ViewImplementation.h>
|
||||
#include <UI/Utilities.h>
|
||||
|
||||
#import <Application/ApplicationDelegate.h>
|
||||
#import <Interface/Inspector.h>
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
#include <LibWebView/Application.h>
|
||||
#include <LibWebView/ChromeProcess.h>
|
||||
#include <LibWebView/EventLoop/EventLoopImplementationMacOS.h>
|
||||
#include <LibWebView/MachPortServer.h>
|
||||
#include <LibWebView/URL.h>
|
||||
#include <LibWebView/Utilities.h>
|
||||
#include <LibWebView/ViewImplementation.h>
|
||||
#include <LibWebView/WebContentClient.h>
|
||||
#include <UI/DefaultSettings.h>
|
||||
#include <UI/MachPortServer.h>
|
||||
#include <UI/Utilities.h>
|
||||
|
||||
#import <Application/Application.h>
|
||||
#import <Application/ApplicationDelegate.h>
|
||||
|
@ -51,7 +51,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
Core::EventLoopManager::install(*new WebView::EventLoopManagerMacOS);
|
||||
[application setupWebViewApplication:arguments newTabPageURL:Browser::default_new_tab_url];
|
||||
|
||||
platform_init();
|
||||
WebView::platform_init();
|
||||
|
||||
WebView::ChromeProcess chrome_process;
|
||||
|
||||
|
@ -72,12 +72,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
open_urls_from_client(raw_urls, WebView::NewWindow::Yes);
|
||||
};
|
||||
|
||||
auto mach_port_server = make<Ladybird::MachPortServer>();
|
||||
set_mach_server_name(mach_port_server->server_port_name());
|
||||
auto mach_port_server = make<WebView::MachPortServer>();
|
||||
WebView::set_mach_server_name(mach_port_server->server_port_name());
|
||||
|
||||
mach_port_server->on_receive_child_mach_port = [&](auto pid, auto port) {
|
||||
WebView::Application::the().set_process_mach_port(pid, move(port));
|
||||
};
|
||||
mach_port_server->on_receive_backing_stores = [](Ladybird::MachPortServer::BackingStoresMessage message) {
|
||||
mach_port_server->on_receive_backing_stores = [](WebView::MachPortServer::BackingStoresMessage message) {
|
||||
if (auto view = WebView::WebContentClient::view_for_pid_and_page_id(message.pid, message.page_id); view.has_value())
|
||||
view->did_allocate_iosurface_backing_stores(message.front_backing_store_id, move(message.front_backing_store_port), message.back_backing_store_id, move(message.back_backing_store_port));
|
||||
};
|
||||
|
|
|
@ -1,14 +1,5 @@
|
|||
include(cmake/ResourceFiles.cmake)
|
||||
|
||||
set(LADYBIRD_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/HelperProcess.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Utilities.cpp
|
||||
)
|
||||
set(LADYBIRD_HEADERS
|
||||
HelperProcess.h
|
||||
Utilities.h
|
||||
)
|
||||
|
||||
function(create_ladybird_bundle target_name)
|
||||
set_target_properties(${target_name} PROPERTIES
|
||||
OUTPUT_NAME "Ladybird"
|
||||
|
@ -64,26 +55,13 @@ elseif(ANDROID)
|
|||
add_subdirectory(Android)
|
||||
else()
|
||||
# TODO: Check for other GUI frameworks here when we move them in-tree
|
||||
# For now, we can export a static library of common files for chromes to link to
|
||||
add_library(ladybird STATIC ${LADYBIRD_SOURCES})
|
||||
return()
|
||||
endif()
|
||||
|
||||
if (NOT TARGET ladybird)
|
||||
message(FATAL_ERROR "UI Framework selection must declare a ladybird target")
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
target_sources(ladybird PRIVATE MachPortServer.cpp)
|
||||
target_link_libraries(ladybird PRIVATE LibThreading)
|
||||
endif()
|
||||
|
||||
if (ENABLE_INSTALL_HEADERS)
|
||||
target_sources(ladybird PUBLIC FILE_SET ladybird TYPE HEADERS
|
||||
BASE_DIRS ${LADYBIRD_SOURCE_DIR}
|
||||
FILES ${LADYBIRD_HEADERS}
|
||||
)
|
||||
endif()
|
||||
|
||||
if (TARGET ladybird_impl)
|
||||
set(LADYBIRD_TARGET ladybird_impl PUBLIC)
|
||||
else()
|
||||
|
@ -104,12 +82,6 @@ function(set_helper_process_properties)
|
|||
set_target_properties(${targets} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "$<TARGET_FILE_DIR:ladybird>")
|
||||
else()
|
||||
set_target_properties(${targets} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${IN_BUILD_PREFIX}${CMAKE_INSTALL_LIBEXECDIR}")
|
||||
|
||||
if (NOT CMAKE_INSTALL_LIBEXECDIR STREQUAL "libexec")
|
||||
set_source_files_properties(Utilities.cpp PROPERTIES COMPILE_DEFINITIONS LADYBIRD_LIBEXECDIR="${CMAKE_INSTALL_LIBEXECDIR}")
|
||||
set_source_files_properties(Utilities.cpp TARGET_DIRECTORY ladybird PROPERTIES COMPILE_DEFINITIONS LADYBIRD_LIBEXECDIR="${CMAKE_INSTALL_LIBEXECDIR}")
|
||||
set_source_files_properties(Utilities.cpp TARGET_DIRECTORY ${targets} PROPERTIES COMPILE_DEFINITIONS LADYBIRD_LIBEXECDIR="${CMAKE_INSTALL_LIBEXECDIR}")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
|
|
@ -7,16 +7,16 @@
|
|||
#include <LibCore/AnonymousBuffer.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibWebView/HelperProcess.h>
|
||||
#include <LibWebView/Utilities.h>
|
||||
#include <UI/Headless/Application.h>
|
||||
#include <UI/Headless/Fixture.h>
|
||||
#include <UI/Headless/HeadlessWebView.h>
|
||||
#include <UI/HelperProcess.h>
|
||||
#include <UI/Utilities.h>
|
||||
|
||||
namespace Ladybird {
|
||||
|
||||
Application::Application(Badge<WebView::Application>, Main::Arguments&)
|
||||
: resources_folder(s_ladybird_resource_root)
|
||||
: resources_folder(WebView::s_ladybird_resource_root)
|
||||
, test_concurrency(Core::System::hardware_concurrency())
|
||||
, python_executable_path("python3")
|
||||
|
||||
|
@ -73,11 +73,11 @@ void Application::create_platform_options(WebView::ChromeOptions& chrome_options
|
|||
|
||||
ErrorOr<void> Application::launch_services()
|
||||
{
|
||||
auto request_server_paths = TRY(get_paths_for_helper_process("RequestServer"sv));
|
||||
m_request_client = TRY(launch_request_server_process(request_server_paths, resources_folder));
|
||||
auto request_server_paths = TRY(WebView::get_paths_for_helper_process("RequestServer"sv));
|
||||
m_request_client = TRY(WebView::launch_request_server_process(request_server_paths, resources_folder));
|
||||
|
||||
auto image_decoder_paths = TRY(get_paths_for_helper_process("ImageDecoder"sv));
|
||||
m_image_decoder_client = TRY(launch_image_decoder_process(image_decoder_paths));
|
||||
auto image_decoder_paths = TRY(WebView::get_paths_for_helper_process("ImageDecoder"sv));
|
||||
m_image_decoder_client = TRY(WebView::launch_image_decoder_process(image_decoder_paths));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/ShareableBitmap.h>
|
||||
#include <LibWeb/Crypto/Crypto.h>
|
||||
#include <LibWebView/HelperProcess.h>
|
||||
#include <LibWebView/Utilities.h>
|
||||
#include <UI/Headless/Application.h>
|
||||
#include <UI/Headless/HeadlessWebView.h>
|
||||
#include <UI/HelperProcess.h>
|
||||
#include <UI/Utilities.h>
|
||||
|
||||
namespace Ladybird {
|
||||
|
||||
|
@ -32,8 +32,8 @@ HeadlessWebView::HeadlessWebView(Core::AnonymousBuffer theme, Gfx::IntSize viewp
|
|||
};
|
||||
|
||||
on_request_worker_agent = []() {
|
||||
auto web_worker_paths = MUST(get_paths_for_helper_process("WebWorker"sv));
|
||||
auto worker_client = MUST(launch_web_worker_process(web_worker_paths, Application::request_client()));
|
||||
auto web_worker_paths = MUST(WebView::get_paths_for_helper_process("WebWorker"sv));
|
||||
auto worker_client = MUST(WebView::launch_web_worker_process(web_worker_paths, Application::request_client()));
|
||||
|
||||
return worker_client->clone_transport();
|
||||
};
|
||||
|
@ -143,11 +143,11 @@ NonnullOwnPtr<HeadlessWebView> HeadlessWebView::create_child(HeadlessWebView con
|
|||
void HeadlessWebView::initialize_client(CreateNewClient create_new_client)
|
||||
{
|
||||
if (create_new_client == CreateNewClient::Yes) {
|
||||
auto request_server_socket = connect_new_request_server_client(Application::request_client()).release_value_but_fixme_should_propagate_errors();
|
||||
auto image_decoder_socket = connect_new_image_decoder_client(Application::image_decoder_client()).release_value_but_fixme_should_propagate_errors();
|
||||
auto request_server_socket = WebView::connect_new_request_server_client(Application::request_client()).release_value_but_fixme_should_propagate_errors();
|
||||
auto image_decoder_socket = WebView::connect_new_image_decoder_client(Application::image_decoder_client()).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
auto web_content_paths = get_paths_for_helper_process("WebContent"sv).release_value_but_fixme_should_propagate_errors();
|
||||
m_client_state.client = launch_web_content_process(*this, web_content_paths, move(image_decoder_socket), move(request_server_socket)).release_value_but_fixme_should_propagate_errors();
|
||||
auto web_content_paths = WebView::get_paths_for_helper_process("WebContent"sv).release_value_but_fixme_should_propagate_errors();
|
||||
m_client_state.client = WebView::launch_web_content_process(*this, web_content_paths, move(image_decoder_socket), move(request_server_socket)).release_value_but_fixme_should_propagate_errors();
|
||||
} else {
|
||||
m_client_state.client->register_view(m_client_state.page_index, *this);
|
||||
}
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
#include <LibGfx/ImageFormats/PNGWriter.h>
|
||||
#include <LibGfx/SystemTheme.h>
|
||||
#include <LibURL/URL.h>
|
||||
#include <LibWebView/Utilities.h>
|
||||
#include <UI/Headless/Application.h>
|
||||
#include <UI/Headless/HeadlessWebView.h>
|
||||
#include <UI/Headless/Test.h>
|
||||
#include <UI/Utilities.h>
|
||||
|
||||
static ErrorOr<NonnullRefPtr<Core::Timer>> load_page_for_screenshot_and_exit(Core::EventLoop& event_loop, Ladybird::HeadlessWebView& view, URL::URL const& url, int screenshot_timeout)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ static ErrorOr<NonnullRefPtr<Core::Timer>> load_page_for_screenshot_and_exit(Cor
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
platform_init();
|
||||
WebView::platform_init();
|
||||
|
||||
auto app = Ladybird::Application::create(arguments, "about:newtab"sv);
|
||||
TRY(app->launch_services());
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
*/
|
||||
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibWebView/HelperProcess.h>
|
||||
#include <LibWebView/URL.h>
|
||||
#include <UI/HelperProcess.h>
|
||||
#include <LibWebView/Utilities.h>
|
||||
#include <UI/Qt/Application.h>
|
||||
#include <UI/Qt/Settings.h>
|
||||
#include <UI/Qt/StringUtils.h>
|
||||
#include <UI/Qt/TaskManagerWindow.h>
|
||||
#include <UI/Utilities.h>
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QFileOpenEvent>
|
||||
|
@ -56,8 +56,8 @@ bool Application::event(QEvent* event)
|
|||
|
||||
static ErrorOr<NonnullRefPtr<ImageDecoderClient::Client>> launch_new_image_decoder()
|
||||
{
|
||||
auto paths = TRY(get_paths_for_helper_process("ImageDecoder"sv));
|
||||
return launch_image_decoder_process(paths);
|
||||
auto paths = TRY(WebView::get_paths_for_helper_process("ImageDecoder"sv));
|
||||
return WebView::launch_image_decoder_process(paths);
|
||||
}
|
||||
|
||||
ErrorOr<void> Application::initialize_image_decoder()
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <UI/Qt/TabBar.h>
|
||||
#include <UI/Qt/TaskManagerWindow.h>
|
||||
#include <UI/Qt/WebContentView.h>
|
||||
#include <UI/Utilities.h>
|
||||
|
||||
#include <QAction>
|
||||
#include <QActionGroup>
|
||||
|
|
|
@ -24,12 +24,12 @@
|
|||
#include <LibWeb/UIEvents/KeyCode.h>
|
||||
#include <LibWeb/UIEvents/MouseButton.h>
|
||||
#include <LibWebView/Application.h>
|
||||
#include <LibWebView/HelperProcess.h>
|
||||
#include <LibWebView/Utilities.h>
|
||||
#include <LibWebView/WebContentClient.h>
|
||||
#include <UI/HelperProcess.h>
|
||||
#include <UI/Qt/Application.h>
|
||||
#include <UI/Qt/StringUtils.h>
|
||||
#include <UI/Qt/WebContentView.h>
|
||||
#include <UI/Utilities.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCursor>
|
||||
|
@ -129,7 +129,7 @@ WebContentView::WebContentView(QWidget* window, RefPtr<WebView::WebContentClient
|
|||
|
||||
on_request_worker_agent = [&]() {
|
||||
auto& request_server_client = static_cast<Ladybird::Application*>(QApplication::instance())->request_server_client;
|
||||
auto worker_client = MUST(launch_web_worker_process(MUST(get_paths_for_helper_process("WebWorker"sv)), *request_server_client));
|
||||
auto worker_client = MUST(WebView::launch_web_worker_process(MUST(WebView::get_paths_for_helper_process("WebWorker"sv)), *request_server_client));
|
||||
return worker_client->clone_transport();
|
||||
};
|
||||
|
||||
|
@ -632,12 +632,12 @@ void WebContentView::initialize_client(WebView::ViewImplementation::CreateNewCli
|
|||
auto& request_server_client = static_cast<Ladybird::Application*>(QApplication::instance())->request_server_client;
|
||||
|
||||
// FIXME: Fail to open the tab, rather than crashing the whole application if this fails
|
||||
auto request_server_socket = connect_new_request_server_client(*request_server_client).release_value_but_fixme_should_propagate_errors();
|
||||
auto request_server_socket = WebView::connect_new_request_server_client(*request_server_client).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
auto image_decoder = static_cast<Ladybird::Application*>(QApplication::instance())->image_decoder_client();
|
||||
auto image_decoder_socket = connect_new_image_decoder_client(*image_decoder).release_value_but_fixme_should_propagate_errors();
|
||||
auto image_decoder_socket = WebView::connect_new_image_decoder_client(*image_decoder).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
auto candidate_web_content_paths = get_paths_for_helper_process("WebContent"sv).release_value_but_fixme_should_propagate_errors();
|
||||
auto candidate_web_content_paths = WebView::get_paths_for_helper_process("WebContent"sv).release_value_but_fixme_should_propagate_errors();
|
||||
auto new_client = launch_web_content_process(*this, candidate_web_content_paths, AK::move(image_decoder_socket), AK::move(request_server_socket)).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
m_client_state.client = new_client;
|
||||
|
|
|
@ -13,17 +13,17 @@
|
|||
#include <LibWebView/Application.h>
|
||||
#include <LibWebView/ChromeProcess.h>
|
||||
#include <LibWebView/EventLoop/EventLoopImplementationQt.h>
|
||||
#include <LibWebView/HelperProcess.h>
|
||||
#include <LibWebView/ProcessManager.h>
|
||||
#include <LibWebView/URL.h>
|
||||
#include <UI/HelperProcess.h>
|
||||
#include <LibWebView/Utilities.h>
|
||||
#include <UI/Qt/Application.h>
|
||||
#include <UI/Qt/BrowserWindow.h>
|
||||
#include <UI/Qt/Settings.h>
|
||||
#include <UI/Qt/WebContentView.h>
|
||||
#include <UI/Utilities.h>
|
||||
|
||||
#if defined(AK_OS_MACOS)
|
||||
# include <UI/MachPortServer.h>
|
||||
# include <LibWebView/MachPortServer.h>
|
||||
#endif
|
||||
|
||||
namespace Ladybird {
|
||||
|
@ -71,7 +71,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
static_cast<WebView::EventLoopImplementationQt&>(Core::EventLoop::current().impl()).set_main_loop();
|
||||
TRY(handle_attached_debugger());
|
||||
|
||||
platform_init();
|
||||
WebView::platform_init();
|
||||
|
||||
WebView::ChromeProcess chrome_process;
|
||||
|
||||
|
@ -100,22 +100,23 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
};
|
||||
|
||||
#if defined(AK_OS_MACOS)
|
||||
auto mach_port_server = make<Ladybird::MachPortServer>();
|
||||
set_mach_server_name(mach_port_server->server_port_name());
|
||||
auto mach_port_server = make<WebView::MachPortServer>();
|
||||
WebView::set_mach_server_name(mach_port_server->server_port_name());
|
||||
|
||||
mach_port_server->on_receive_child_mach_port = [&app](auto pid, auto port) {
|
||||
app->set_process_mach_port(pid, move(port));
|
||||
};
|
||||
mach_port_server->on_receive_backing_stores = [](Ladybird::MachPortServer::BackingStoresMessage message) {
|
||||
mach_port_server->on_receive_backing_stores = [](WebView::MachPortServer::BackingStoresMessage message) {
|
||||
if (auto view = WebView::WebContentClient::view_for_pid_and_page_id(message.pid, message.page_id); view.has_value())
|
||||
view->did_allocate_iosurface_backing_stores(message.front_backing_store_id, move(message.front_backing_store_port), message.back_backing_store_id, move(message.back_backing_store_port));
|
||||
};
|
||||
#endif
|
||||
|
||||
copy_default_config_files(Ladybird::Settings::the()->directory());
|
||||
WebView::copy_default_config_files(Ladybird::Settings::the()->directory());
|
||||
|
||||
// FIXME: Create an abstraction to re-spawn the RequestServer and re-hook up its client hooks to each tab on crash
|
||||
auto request_server_paths = TRY(get_paths_for_helper_process("RequestServer"sv));
|
||||
auto requests_client = TRY(launch_request_server_process(request_server_paths, s_ladybird_resource_root));
|
||||
auto request_server_paths = TRY(WebView::get_paths_for_helper_process("RequestServer"sv));
|
||||
auto requests_client = TRY(WebView::launch_request_server_process(request_server_paths, WebView::s_ladybird_resource_root));
|
||||
app->request_server_client = move(requests_client);
|
||||
|
||||
TRY(app->initialize_image_decoder());
|
||||
|
|
Loading…
Reference in a new issue