mirror of
https://github.com/servo/servo.git
synced 2025-07-01 20:43:39 +01:00
feat(capture_webrender): write webrender revision into text
This commit is contained in:
parent
6b16e712e7
commit
0671fcb5c7
2 changed files with 21 additions and 2 deletions
|
@ -24,7 +24,8 @@ use servo_config::opts;
|
||||||
use servo_geometry::{DeviceIndependentPixel, DeviceUintLength};
|
use servo_geometry::{DeviceIndependentPixel, DeviceUintLength};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fs::File;
|
use std::fs::{File, create_dir_all};
|
||||||
|
use std::io::Write;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::mpsc::Sender;
|
use std::sync::mpsc::Sender;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
@ -36,6 +37,7 @@ use touch::{TouchHandler, TouchAction};
|
||||||
use webrender;
|
use webrender;
|
||||||
use webrender_api::{self, DeviceIntPoint, DevicePoint, DeviceUintRect, DeviceUintSize, HitTestFlags, HitTestResult};
|
use webrender_api::{self, DeviceIntPoint, DevicePoint, DeviceUintRect, DeviceUintSize, HitTestFlags, HitTestResult};
|
||||||
use webrender_api::{LayoutVector2D, ScrollEventPhase, ScrollLocation};
|
use webrender_api::{LayoutVector2D, ScrollEventPhase, ScrollLocation};
|
||||||
|
use webrender_revision::REVISION;
|
||||||
use windowing::{self, MouseWindowEvent, WebRenderDebugOption, WindowMethods};
|
use windowing::{self, MouseWindowEvent, WebRenderDebugOption, WindowMethods};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
|
@ -1540,9 +1542,25 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
Ok(current_dir) => {
|
Ok(current_dir) => {
|
||||||
let capture_id = now().to_timespec().sec.to_string();
|
let capture_id = now().to_timespec().sec.to_string();
|
||||||
let capture_path = current_dir.join("capture_webrender").join(capture_id);
|
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());
|
self.webrender_api.save_capture(capture_path, webrender_api::CaptureBits::all());
|
||||||
|
|
||||||
|
match File::create(revision_file_path) {
|
||||||
|
Ok(mut file) => {
|
||||||
|
if let Err(err) = write!(&mut file, "{}", REVISION) {
|
||||||
|
println!("Unable to write webrender revision: {:?}", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(err) => println!("Capture triggered, creating webrender 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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ use style_traits::CSSPixel;
|
||||||
mod compositor;
|
mod compositor;
|
||||||
pub mod compositor_thread;
|
pub mod compositor_thread;
|
||||||
mod touch;
|
mod touch;
|
||||||
|
mod webrender_revision;
|
||||||
pub mod windowing;
|
pub mod windowing;
|
||||||
|
|
||||||
pub struct SendableFrameTree {
|
pub struct SendableFrameTree {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue