tor-browser

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

browser-graphics-utils.js (1657B)


      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 /**
      6 * Global browser interface with graphics utilities.
      7 */
      8 var gGfxUtils = {
      9  _isRecording: false,
     10  _isTransactionLogging: false,
     11  _isCapturingFrames: false,
     12 
     13  init() {
     14    if (Services.prefs.getBoolPref("gfx.webrender.debug.enable-capture")) {
     15      document.getElementById("wrCaptureCmd").removeAttribute("disabled");
     16      document
     17        .getElementById("wrToggleCaptureSequenceCmd")
     18        .removeAttribute("disabled");
     19    }
     20  },
     21 
     22  /**
     23   * Toggle composition recording for the current window.
     24   */
     25  toggleWindowRecording() {
     26    window.windowUtils.setCompositionRecording(!this._isRecording);
     27    this._isRecording = !this._isRecording;
     28  },
     29  /**
     30   * Trigger a WebRender capture of the current state into a local folder.
     31   */
     32  webrenderCapture() {
     33    window.windowUtils.wrCapture();
     34  },
     35 
     36  captureSequencePath: "wr-capture-sequence",
     37  captureSequenceFlags:
     38    window.windowUtils.WR_CAPTURE_SCENE |
     39    window.windowUtils.WR_CAPTURE_EXTERNALS,
     40 
     41  /**
     42   * Trigger a WebRender capture of the current state and future state
     43   * into a local folder. If called again, it will stop capturing.
     44   */
     45  toggleWebrenderCaptureSequence() {
     46    this._isCapturingFrames = !this._isCapturingFrames;
     47    if (this._isCapturingFrames) {
     48      window.windowUtils.wrStartCaptureSequence(
     49        this.captureSequencePath,
     50        this.captureSequenceFlags
     51      );
     52    } else {
     53      window.windowUtils.wrStopCaptureSequence();
     54    }
     55  },
     56 };