MCPcopy Create free account
hub / github.com/LadybirdBrowser/ladybird / service_main

Function service_main

UI/Android/src/main/cpp/WebContentService.cpp:41–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41ErrorOr<int> service_main(int ipc_socket)
42{
43 auto& event_loop = Core::EventLoop::initialize_for_current_thread();
44
45 Web::Platform::EventLoopPlugin::install(*new Web::Platform::EventLoopPlugin);
46
47 auto image_decoder_client = TRY(bind_image_decoder_service());
48 Web::Platform::ImageCodecPlugin::install(*new Web::Platform::RemoteImageCodecPlugin(move(image_decoder_client)));
49
50 Web::Bindings::initialize_main_thread_vm(Web::HTML::AgentType::SimilarOriginWindow);
51
52 auto request_server_client = TRY(bind_request_server_service());
53 Web::ResourceLoader::initialize(Web::Bindings::main_thread_vm().heap(), move(request_server_client));
54
55 bool is_test_mode = false;
56
57 Web::HTML::Window::set_internals_object_exposed(is_test_mode);
58 Web::Platform::FontPlugin::install(*new Web::Platform::FontPlugin(is_test_mode));
59
60 // Currently site isolation doesn't work on Android since everything is running
61 // in the same process. It would require an entire redesign of this port
62 // in order to make it work. For now, it's better to just disable it.
63 WebView::set_site_isolation_mode(WebView::SiteIsolationMode::Disabled);
64
65 auto webcontent_socket = TRY(Core::LocalSocket::adopt_fd(ipc_socket));
66 auto webcontent_client = TRY(WebContent::ConnectionFromClient::try_create(make<IPC::Transport>(move(webcontent_socket))));
67
68 return event_loop.exec();
69}
70
71template<typename Client>
72ErrorOr<NonnullRefPtr<Client>> bind_service(void (*bind_method)(int))

Calls 6

initializeFunction · 0.85
set_site_isolation_modeFunction · 0.85
execMethod · 0.45

Tested by

no test coverage detected