Repository: servo/servo
File: ports/servoshell/egl/app.rs (Rust)

Code before:
        let servo = servo_builder.build();

        let initial_url = init.initial_url.and_then(|string| Url::parse(&string).ok());
        let initial_url = initial_url
            .or_else(|| Url::parse(&init.servoshell_preferences.homepage).ok())
            .or_else(|| Url::parse("about:blank").ok())
            .expect("Failed to parse initial URL");

        let user_content_manager = Rc::new(UserContentManager::new(&servo));
        let state = Rc::new(RunningAppState::new(
            servo,
            init.servoshell_preferences,
            init.event_loop_waker,
            user_content_manager,
        ));

        Rc::new(Self {
            state,
            host: init.host,
            refresh_driver: Rc::new(VsyncRefreshDriver::default()),
            window_rendering_context: RefCell::new(None),
            initial_url,
        })
    }

    pub(crate) fn initialize_platform_window(
        &self,
        display_handle: DisplayHandle,
        window_handle: WindowHandle,
        viewport_rect: Rect<i32, DevicePixel>,
        hidpi_scale_factor: Scale<f32, DeviceIndependentPixel, DevicePixel>,
    ) {
        let viewport_size = viewport_rect.size;
        let rendering_context = Rc::new(
            WindowRenderingContext::new_with_refresh_driver(
                display_handle,
                window_handle,
                PhysicalSize::new(viewport_size.width as u32, viewport_size.height as u32),
                self.refresh_driver.clone(),
            )
            .expect("Could not create RenderingContext"),
        );
        if let Some(old) = self
            .window_rendering_context
            .borrow_mut()
            .replace(rendering_context.clone())
        {
            warn!("Replacing existing platform window rendering context");
        }
        let platform_window = Rc::new(EmbeddedPlatformWindow {
            host: self.host.clone(),

Review comment (suggestion):
Let's get ready for multiwindow support by just calling this `add_platform_window`:

```suggestion
    pub(crate) fn add_platform_window(
```

Code after:
        let initial_url = init.initial_url.and_then(|string| Url::parse(&string).ok());
        let initial_url = initial_url
            .or_else(|| Url::parse(&init.servoshell_preferences.homepage).ok())
            .or_else(|| Url::parse("about:blank").ok())
            .expect("Failed to parse initial URL");

        let user_content_manager = Rc::new(UserContentManager::new(&servo));
        let state = Rc::new(RunningAppState::new(
            servo,
            init.servoshell_preferences,
            init.event_loop_waker,
            user_content_manager,
        ));

        Rc::new(Self {
            state,
            host: init.host,
            initial_url,
        })
    }

    pub(crate) fn add_platform_window(
        &self,
        display_handle: DisplayHandle,
        window_handle: WindowHandle,
        viewport_rect: Rect<i32, DevicePixel>,
        hidpi_scale_factor: Scale<f32, DeviceIndependentPixel, DevicePixel>,
    ) {
        let viewport_size = viewport_rect.size;
        let refresh_driver = Rc::new(VsyncRefreshDriver::default());
        let rendering_context = Rc::new(
            WindowRenderingContext::new_with_refresh_driver(
                display_handle,
                window_handle,
                PhysicalSize::new(viewport_size.width as u32, viewport_size.height as u32),
                refresh_driver.clone(),
            )
            .expect("Could not create RenderingContext"),
        );
        let platform_window = Rc::new(EmbeddedPlatformWindow {
            host: self.host.clone(),
            rendering_context,
            refresh_driver,
            viewport_rect: RefCell::new(viewport_rect),
            hidpi_scale_factor,
            visible_input_methods: Default::default(),
            current_title: Default::default(),
            current_url: Default::default(),
            current_can_go_back: Default::default(),
            current_can_go_forward: Default::default(),
            current_load_status: Default::default(),