remove useless arguments from prepare_for_composite

This commit is contained in:
Paul Rouget 2018-10-30 07:51:38 +01:00
parent b19f9d9c5b
commit d6b41ba67d
5 changed files with 13 additions and 18 deletions

View file

@ -1213,7 +1213,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
) -> Result<Option<Image>, UnableToComposite> { ) -> Result<Option<Image>, UnableToComposite> {
let width = self.embedder_coordinates.framebuffer.width_typed(); let width = self.embedder_coordinates.framebuffer.width_typed();
let height = self.embedder_coordinates.framebuffer.height_typed(); let height = self.embedder_coordinates.framebuffer.height_typed();
if !self.window.prepare_for_composite(width, height) { if !self.window.prepare_for_composite() {
return Err(UnableToComposite::WindowUnprepared); return Err(UnableToComposite::WindowUnprepared);
} }

View file

@ -11,7 +11,7 @@ use gleam::gl;
use keyboard_types::KeyboardEvent; use keyboard_types::KeyboardEvent;
use msg::constellation_msg::{TopLevelBrowsingContextId, TraversalDirection}; use msg::constellation_msg::{TopLevelBrowsingContextId, TraversalDirection};
use script_traits::{MouseButton, TouchEventType, TouchId}; use script_traits::{MouseButton, TouchEventType, TouchId};
use servo_geometry::{DeviceIndependentPixel, DeviceUintLength}; use servo_geometry::DeviceIndependentPixel;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::fmt::{Debug, Error, Formatter}; use std::fmt::{Debug, Error, Formatter};
#[cfg(feature = "gleam")] #[cfg(feature = "gleam")]
@ -129,7 +129,7 @@ pub trait WindowMethods {
/// Requests that the window system prepare a composite. Typically this will involve making /// Requests that the window system prepare a composite. Typically this will involve making
/// some type of platform-specific graphics context current. Returns true if the composite may /// some type of platform-specific graphics context current. Returns true if the composite may
/// proceed and false if it should not. /// proceed and false if it should not.
fn prepare_for_composite(&self, width: DeviceUintLength, height: DeviceUintLength) -> bool; fn prepare_for_composite(&self) -> bool;
/// Return the GL function pointer trait. /// Return the GL function pointer trait.
#[cfg(feature = "gleam")] #[cfg(feature = "gleam")]
fn gl(&self) -> Rc<gl::Gl>; fn gl(&self) -> Rc<gl::Gl>;

View file

@ -82,7 +82,6 @@ use constellation::{FromCompositorLogger, FromScriptLogger};
use constellation::content_process_sandbox_profile; use constellation::content_process_sandbox_profile;
use embedder_traits::{EmbedderMsg, EmbedderProxy, EmbedderReceiver, EventLoopWaker}; use embedder_traits::{EmbedderMsg, EmbedderProxy, EmbedderReceiver, EventLoopWaker};
use env_logger::Builder as EnvLoggerBuilder; use env_logger::Builder as EnvLoggerBuilder;
use euclid::Length;
#[cfg(all(not(target_os = "windows"), not(target_os = "ios")))] #[cfg(all(not(target_os = "windows"), not(target_os = "ios")))]
use gaol::sandbox::{ChildSandbox, ChildSandboxMethods}; use gaol::sandbox::{ChildSandbox, ChildSandboxMethods};
use gfx::font_cache_thread::FontCacheThread; use gfx::font_cache_thread::FontCacheThread;
@ -138,7 +137,7 @@ where
let opts = opts::get(); let opts = opts::get();
// Make sure the gl context is made current. // Make sure the gl context is made current.
window.prepare_for_composite(Length::new(0), Length::new(0)); window.prepare_for_composite();
// Reserving a namespace to create TopLevelBrowserContextId. // Reserving a namespace to create TopLevelBrowserContextId.
PipelineNamespace::install(PipelineNamespaceId(0)); PipelineNamespace::install(PipelineNamespaceId(0));

View file

@ -7,13 +7,12 @@ use servo::{self, gl, webrender_api, BrowserId, Servo};
use servo::compositing::windowing::{AnimationState, EmbedderCoordinates, MouseWindowEvent, WindowEvent, WindowMethods}; use servo::compositing::windowing::{AnimationState, EmbedderCoordinates, MouseWindowEvent, WindowEvent, WindowMethods};
use servo::embedder_traits::EmbedderMsg; use servo::embedder_traits::EmbedderMsg;
use servo::embedder_traits::resources::{self, Resource}; use servo::embedder_traits::resources::{self, Resource};
use servo::euclid::{Length, TypedPoint2D, TypedScale, TypedSize2D, TypedVector2D}; use servo::euclid::{TypedPoint2D, TypedScale, TypedSize2D, TypedVector2D};
use servo::msg::constellation_msg::TraversalDirection; use servo::msg::constellation_msg::TraversalDirection;
use servo::script_traits::{MouseButton, TouchEventType}; use servo::script_traits::{MouseButton, TouchEventType};
use servo::servo_config::opts; use servo::servo_config::opts;
use servo::servo_config::prefs::{PrefValue, PREFS}; use servo::servo_config::prefs::{PrefValue, PREFS};
use servo::servo_url::ServoUrl; use servo::servo_url::ServoUrl;
use servo::style_traits::DevicePixel;
use std::cell::{Cell, RefCell}; use std::cell::{Cell, RefCell};
use std::mem; use std::mem;
use std::path::PathBuf; use std::path::PathBuf;
@ -433,11 +432,7 @@ struct ServoCallbacks {
} }
impl WindowMethods for ServoCallbacks { impl WindowMethods for ServoCallbacks {
fn prepare_for_composite( fn prepare_for_composite(&self) -> bool {
&self,
_width: Length<u32, DevicePixel>,
_height: Length<u32, DevicePixel>,
) -> bool {
debug!("WindowMethods::prepare_for_composite"); debug!("WindowMethods::prepare_for_composite");
self.host_callbacks.make_current(); self.host_callbacks.make_current();
true true

View file

@ -4,7 +4,7 @@
//! A windowing implementation using winit. //! A windowing implementation using winit.
use euclid::{Length, TypedPoint2D, TypedVector2D, TypedScale, TypedSize2D}; use euclid::{TypedPoint2D, TypedVector2D, TypedScale, TypedSize2D};
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
use gdi32; use gdi32;
use gleam::gl; use gleam::gl;
@ -776,11 +776,12 @@ impl WindowMethods for Window {
self.animation_state.set(state); self.animation_state.set(state);
} }
fn prepare_for_composite( fn prepare_for_composite(&self) -> bool {
&self, if let WindowKind::Window(ref window, ..) = self.kind {
_width: Length<u32, DevicePixel>, if let Err(err) = unsafe { window.context().make_current() } {
_height: Length<u32, DevicePixel>, warn!("Couldn't make window current: {}", err);
) -> bool { }
};
true true
} }
} }