| 39 | } |
| 40 | |
| 41 | ErrorOr<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 | |
| 71 | template<typename Client> |
| 72 | ErrorOr<NonnullRefPtr<Client>> bind_service(void (*bind_method)(int)) |
no test coverage detected