Auto merge of #11343 - servo:privatize-compositing, r=nox

Privatize some things in compositing.

Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data:
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy --faster` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

Either:
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because refactoring

Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11343)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-05-23 15:36:43 -07:00
commit a636b7127e
2 changed files with 20 additions and 21 deletions

View file

@ -58,14 +58,14 @@ use webrender_traits::{self, ScrollEventPhase};
use windowing::{self, MouseWindowEvent, WindowEvent, WindowMethods, WindowNavigateMsg};
#[derive(Debug, PartialEq)]
pub enum UnableToComposite {
enum UnableToComposite {
NoContext,
WindowUnprepared,
NotReadyToPaintImage(NotReadyToPaint),
}
#[derive(Debug, PartialEq)]
pub enum NotReadyToPaint {
enum NotReadyToPaint {
LayerHasOutstandingPaintMessages,
MissingRoot,
PendingSubpages(usize),
@ -80,7 +80,7 @@ const BUFFER_MAP_SIZE: usize = 10000000;
const MAX_ZOOM: f32 = 8.0;
const MIN_ZOOM: f32 = 0.1;
pub trait ConvertPipelineIdFromWebRender {
trait ConvertPipelineIdFromWebRender {
fn from_webrender(&self) -> PipelineId;
}
@ -221,7 +221,7 @@ pub struct IOCompositor<Window: WindowMethods> {
}
#[derive(Copy, Clone)]
pub struct ScrollZoomEvent {
struct ScrollZoomEvent {
/// Change the pinch zoom level by this factor
magnification: f32,
/// Scroll by this offset
@ -253,7 +253,7 @@ struct HitTestResult {
point: TypedPoint2D<LayerPixel, f32>,
}
pub struct PipelineDetails {
struct PipelineDetails {
/// The pipeline associated with this PipelineDetails object.
pipeline: Option<CompositionPipeline>,
@ -279,7 +279,7 @@ impl PipelineDetails {
}
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum CompositeTarget {
enum CompositeTarget {
/// Normal composition to a window
Window,
@ -346,7 +346,7 @@ fn initialize_png(width: usize, height: usize) -> RenderTargetInfo {
}
}
pub fn reporter_name() -> String {
fn reporter_name() -> String {
"compositor-reporter".to_owned()
}
@ -485,7 +485,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
compositor
}
pub fn start_shutting_down(&mut self) {
fn start_shutting_down(&mut self) {
debug!("Compositor sending Exit message to Constellation");
if let Err(e) = self.constellation_chan.send(ConstellationMsg::Exit) {
warn!("Sending exit message to constellation failed ({}).", e);
@ -496,7 +496,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.shutdown_state = ShutdownState::ShuttingDown;
}
pub fn finish_shutting_down(&mut self) {
fn finish_shutting_down(&mut self) {
debug!("Compositor received message that constellation shutdown is complete");
// Clear out the compositor layers so that painting threads can destroy the buffers.
@ -790,9 +790,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
}
}
pub fn pipeline_details (&mut self,
pipeline_id: PipelineId)
-> &mut PipelineDetails {
fn pipeline_details(&mut self, pipeline_id: PipelineId) -> &mut PipelineDetails {
if !self.pipeline_details.contains_key(&pipeline_id) {
self.pipeline_details.insert(pipeline_id, PipelineDetails::new());
}
@ -1124,11 +1122,11 @@ impl<Window: WindowMethods> IOCompositor<Window> {
}
}
pub fn move_layer(&self,
pipeline_id: PipelineId,
layer_id: LayerId,
origin: TypedPoint2D<LayerPixel, f32>)
-> bool {
fn move_layer(&self,
pipeline_id: PipelineId,
layer_id: LayerId,
origin: TypedPoint2D<LayerPixel, f32>)
-> bool {
match self.find_layer_with_pipeline_and_layer_id(pipeline_id, layer_id) {
Some(ref layer) => {
if layer.wants_scroll_events() == WantsScrollEventsFlag::WantsScrollEvents {
@ -2081,8 +2079,9 @@ impl<Window: WindowMethods> IOCompositor<Window> {
/// for some reason. If CompositeTarget is Window or Png no image data is returned;
/// in the latter case the image is written directly to a file. If CompositeTarget
/// is WindowAndPng Ok(Some(png::Image)) is returned.
pub fn composite_specific_target(&mut self, target: CompositeTarget) -> Result<Option<Image>, UnableToComposite> {
fn composite_specific_target(&mut self,
target: CompositeTarget)
-> Result<Option<Image>, UnableToComposite> {
if self.context.is_none() && self.webrender.is_none() {
return Err(UnableToComposite::NoContext)
}

View file

@ -21,7 +21,7 @@ pub struct DelayedCompositionTimerProxy {
sender: Sender<ToDelayedCompositionTimerMsg>,
}
pub struct DelayedCompositionTimer {
struct DelayedCompositionTimer {
compositor_proxy: Box<CompositorProxy>,
receiver: Receiver<ToDelayedCompositionTimerMsg>,
}
@ -56,7 +56,7 @@ impl DelayedCompositionTimerProxy {
}
impl DelayedCompositionTimer {
pub fn run(&mut self) {
fn run(&mut self) {
'outer: loop {
let mut timestamp;
loop {