Skip to content

Commit

Permalink
feat(capture_webrender): write webrender revision into text
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed Mar 16, 2018
1 parent 482c198 commit 5c5c237
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
20 changes: 18 additions & 2 deletions components/compositing/compositor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ use servo_config::opts;
use servo_geometry::DeviceIndependentPixel;
use std::collections::HashMap;
use std::env;
use std::fs::File;
use std::fs::{File, create_dir_all};
use std::io::Write;
use std::rc::Rc;
use std::sync::mpsc::Sender;
use std::time::{Duration, Instant};
Expand All @@ -36,6 +37,7 @@ use touch::{TouchHandler, TouchAction};
use webrender;
use webrender_api::{self, DeviceUintRect, DeviceUintSize, HitTestFlags, HitTestResult};
use webrender_api::{LayoutVector2D, ScrollEventPhase, ScrollLocation};
use webrender_revision::REVISION;
use windowing::{self, MouseWindowEvent, WebRenderDebugOption, WindowMethods};

#[derive(Debug, PartialEq)]
Expand Down Expand Up @@ -1537,9 +1539,23 @@ impl<Window: WindowMethods> IOCompositor<Window> {
Ok(current_dir) => {
let capture_id = now().to_timespec().sec.to_string();
let capture_path = current_dir.join("capture_webrender").join(capture_id);
let revision_file_path = capture_path.join("wr.txt");

if let Err(err) = create_dir_all(&capture_path) {
println!("Unable to create path '{:?}' for capture: {:?}", capture_path, err);
return
}

self.webrender_api.save_capture(capture_path, webrender_api::CaptureBits::all());

match File::create(revision_file_path) {
Ok(mut file) => {
write!(&mut file, "{}", REVISION).unwrap();
}
Err(err) => println!("Capture triggered, creating web render revision info skipped: {:?}", err)
}
},
Err(err) => println!("could not locate path to save captures: {:?}", err)
Err(err) => println!("Unable to locate path to save captures: {:?}", err)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions components/compositing/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ use style_traits::CSSPixel;
mod compositor;
pub mod compositor_thread;
mod touch;
mod webrender_revision;
pub mod windowing;

pub struct SendableFrameTree {
Expand Down

0 comments on commit 5c5c237

Please sign in to comment.