gfx/layers/LayerTreeInvalidation.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /*-*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     2  * This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     4  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef GFX_LAYER_TREE_INVALIDATION_H
     7 #define GFX_LAYER_TREE_INVALIDATION_H
     9 #include "nsRegion.h"                   // for nsIntRegion
    11 class nsPresContext;
    12 struct nsIntPoint;
    14 namespace mozilla {
    15 namespace layers {
    17 class Layer;
    18 class ContainerLayer;
    20 /**
    21  * Callback for ContainerLayer invalidations.
    22  *
    23  * @param aContainer ContainerLayer being invalidated.
    24  * @param aRegion Invalidated region in the ContainerLayer's coordinate
    25  * space.
    26  */
    27 typedef void (*NotifySubDocInvalidationFunc)(ContainerLayer* aLayer,
    28                                              const nsIntRegion& aRegion);
    30 /**
    31  * A set of cached layer properties (including those of child layers),
    32  * used for comparing differences in layer trees.
    33  */
    34 struct LayerProperties
    35 {
    36   virtual ~LayerProperties() {}
    38   /**
    39    * Copies the current layer tree properties into
    40    * a new LayerProperties object.
    41    *
    42    * @param Layer tree to copy, or nullptr if we have no 
    43    * initial layer tree.
    44    */
    45   static LayerProperties* CloneFrom(Layer* aRoot);
    47   /**
    48    * Clear all invalidation status from this layer tree.
    49    */
    50   static void ClearInvalidations(Layer* aRoot);
    52   /**
    53    * Compares a set of existing layer tree properties to the current layer
    54    * tree and generates the changed rectangle.
    55    *
    56    * @param aRoot Root layer of the layer tree to compare against.
    57    * @param aCallback If specified, callback to call when ContainerLayers
    58    * are invalidated.
    59    * @return Painted area changed by the layer tree changes.
    60    */
    61   virtual nsIntRegion ComputeDifferences(Layer* aRoot, 
    62                                          NotifySubDocInvalidationFunc aCallback,
    63                                          bool* aGeometryChanged = nullptr) = 0;
    66   virtual void MoveBy(const nsIntPoint& aOffset) = 0;
    67 };
    69 } // namespace layers
    70 } // namespace mozilla
    72 #endif /* GFX_LAYER_TREE_INVALIDATON_H */

mercurial