Bug 1596769 - Fix broken WebRender capture on Windows r=kvark
authorBert Peers <bpeers@mozilla.com>
Fri, 15 Nov 2019 16:02:56 +0000
changeset 502215 d7d66b80b6e5ca09a275ed0dc91e1d83fbd642ab
parent 502214 0ece9bc4cec274c87d92469c2b145621f4704cfd
child 502216 85ae973aca6e5d2d924a2448b2687a58f6574308
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskvark
bugs1596769
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1596769 - Fix broken WebRender capture on Windows r=kvark On Windows, save the Ctrl-Shift-3 capture to the user's local app data to make sure we have write permissions. Verified with ./mach run + capture => saved to C:\Users\...\AppData\Local\wr-capture Differential Revision: https://phabricator.services.mozilla.com/D53208
Cargo.lock
gfx/webrender_bindings/Cargo.toml
gfx/webrender_bindings/src/bindings.rs
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4215,16 +4215,17 @@ dependencies = [
 [[package]]
 name = "webrender_bindings"
 version = "0.1.0"
 dependencies = [
  "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "dwrote 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "foreign-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "gleam 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "nsstring 0.1.0",
  "num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
--- a/gfx/webrender_bindings/Cargo.toml
+++ b/gfx/webrender_bindings/Cargo.toml
@@ -23,14 +23,15 @@ fxhash = "0.2.1"
 [dependencies.webrender]
 path = "../wr/webrender"
 version = "0.60.0"
 default-features = false
 features = ["capture", "serialize_program"]
 
 [target.'cfg(target_os = "windows")'.dependencies]
 dwrote = "0.9"
+dirs = "1.0"
 
 [target.'cfg(target_os = "macos")'.dependencies]
 core-foundation = "0.6"
 core-graphics = "0.17.1"
 foreign-types = "0.3.0"
 
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -2002,16 +2002,23 @@ pub extern "C" fn wr_api_capture(
         // storage so that (a) it can be written without requiring permissions
         // and (b) it can be pulled off via `adb pull`. This env var is set
         // in GeckoLoader.java.
         if let Ok(storage_path) = env::var("PUBLIC_STORAGE") {
             path = PathBuf::from(storage_path).join(path);
         }
     }
 
+	#[cfg(target_os = "windows")]
+	{
+		if let Some(storage_path) = dirs::data_local_dir() {
+			path = PathBuf::from(storage_path).join(path);
+		}
+	}
+
     // Increment the extension until we find a fresh path
     while path.is_dir() {
         let count: u32 = path.extension()
             .and_then(|x| x.to_str())
             .and_then(|x| x.parse().ok())
             .unwrap_or(0);
         path.set_extension((count + 1).to_string());
     }