gfx/layers/composite/ColorLayerComposite.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: 20; 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
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef GFX_ColorLayerComposite_H
     7 #define GFX_ColorLayerComposite_H
     9 #include "Layers.h"                     // for ColorLayer, etc
    10 #include "mozilla/Attributes.h"         // for MOZ_OVERRIDE
    11 #include "mozilla/layers/LayerManagerComposite.h"  // for LayerComposite, etc
    12 #include "nsISupportsImpl.h"            // for MOZ_COUNT_CTOR, etc
    14 struct nsIntPoint;
    15 struct nsIntRect;
    17 namespace mozilla {
    18 namespace layers {
    20 class CompositableHost;
    22 class ColorLayerComposite : public ColorLayer,
    23                             public LayerComposite
    24 {
    25 public:
    26   ColorLayerComposite(LayerManagerComposite *aManager)
    27     : ColorLayer(aManager, nullptr)
    28     , LayerComposite(aManager)
    29   {
    30     MOZ_COUNT_CTOR(ColorLayerComposite);
    31     mImplData = static_cast<LayerComposite*>(this);
    32   }
    33   ~ColorLayerComposite()
    34   {
    35     MOZ_COUNT_DTOR(ColorLayerComposite);
    36     Destroy();
    37   }
    39   // LayerComposite Implementation
    40   virtual Layer* GetLayer() MOZ_OVERRIDE { return this; }
    42   virtual void Destroy() MOZ_OVERRIDE { mDestroyed = true; }
    44   virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE;
    45   virtual void CleanupResources() MOZ_OVERRIDE {};
    47   CompositableHost* GetCompositableHost() MOZ_OVERRIDE { return nullptr; }
    49   virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; }
    51   virtual const char* Name() const MOZ_OVERRIDE { return "ColorLayerComposite"; }
    52 };
    54 } /* layers */
    55 } /* mozilla */
    56 #endif /* GFX_ColorLayerComposite_H */

mercurial