tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

debug_flags.rs (1575B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 use webrender_api::DebugFlags;
      6 use super::Gui;
      7 
      8 pub fn ui(app: &mut Gui, ui: &mut egui::Ui) {
      9    fn debug_flag(app: &mut Gui, ui: &mut egui::Ui, flag: DebugFlags, label: &str) -> bool {
     10        let initial = app.data_model.debug_flags;
     11        let mut checked = initial.contains(flag);
     12        let changed = ui.checkbox(&mut checked, label).changed();
     13        app.data_model.debug_flags.set(flag, checked);
     14 
     15        changed
     16    }
     17 
     18    let push_flags = debug_flag(app, ui, DebugFlags::FORCE_PICTURE_INVALIDATION, "Force invalidation")
     19        | debug_flag(app, ui, DebugFlags::PROFILER_DBG, "Pofiler")
     20        | debug_flag(app, ui, DebugFlags::RENDER_TARGET_DBG, "Render targets")
     21        | debug_flag(app, ui, DebugFlags::TEXTURE_CACHE_DBG, "Texture cache")
     22        | debug_flag(app, ui, DebugFlags::PICTURE_CACHING_DBG, "Picture cache")
     23        | debug_flag(app, ui, DebugFlags::PICTURE_BORDERS, "Picture borders")
     24        | debug_flag(app, ui, DebugFlags::HIGHLIGHT_BACKDROP_FILTERS, "Highlight backdrop filters")
     25        | debug_flag(app, ui, DebugFlags::DISABLE_ALPHA_PASS, "Skip alpha pass")
     26        | debug_flag(app, ui, DebugFlags::DISABLE_OPAQUE_PASS, "Skip opaque pass")
     27        | debug_flag(app, ui, DebugFlags::SHOW_OVERDRAW, "Show overdraw");
     28 
     29    if push_flags {
     30        app.net.post_with_content("debug-flags", &app.data_model.debug_flags).ok();
     31    }
     32 }