gfx/layers/composite/ThebesLayerComposite.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.

michael@0 1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef GFX_ThebesLayerComposite_H
michael@0 7 #define GFX_ThebesLayerComposite_H
michael@0 8
michael@0 9 #include "Layers.h" // for Layer (ptr only), etc
michael@0 10 #include "gfxRect.h" // for gfxRect
michael@0 11 #include "mozilla/Attributes.h" // for MOZ_OVERRIDE
michael@0 12 #include "mozilla/RefPtr.h" // for RefPtr
michael@0 13 #include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite, etc
michael@0 14 #include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc
michael@0 15 #include "nsDebug.h" // for NS_RUNTIMEABORT
michael@0 16 #include "nsRegion.h" // for nsIntRegion
michael@0 17 #include "nscore.h" // for nsACString
michael@0 18
michael@0 19 struct nsIntPoint;
michael@0 20 struct nsIntRect;
michael@0 21
michael@0 22
michael@0 23 namespace mozilla {
michael@0 24 namespace layers {
michael@0 25
michael@0 26 /**
michael@0 27 * Thebes layers use ContentHosts for their compsositable host.
michael@0 28 * By using different ContentHosts, ThebesLayerComposite support tiled and
michael@0 29 * non-tiled Thebes layers and single or double buffering.
michael@0 30 */
michael@0 31
michael@0 32 class CompositableHost;
michael@0 33 class ContentHost;
michael@0 34 class TiledLayerComposer;
michael@0 35
michael@0 36 class ThebesLayerComposite : public ThebesLayer,
michael@0 37 public LayerComposite
michael@0 38 {
michael@0 39 public:
michael@0 40 ThebesLayerComposite(LayerManagerComposite *aManager);
michael@0 41 virtual ~ThebesLayerComposite();
michael@0 42
michael@0 43 virtual void Disconnect() MOZ_OVERRIDE;
michael@0 44
michael@0 45 virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
michael@0 46
michael@0 47 CompositableHost* GetCompositableHost() MOZ_OVERRIDE;
michael@0 48
michael@0 49 virtual void Destroy() MOZ_OVERRIDE;
michael@0 50
michael@0 51 virtual Layer* GetLayer() MOZ_OVERRIDE;
michael@0 52
michael@0 53 virtual TiledLayerComposer* GetTiledLayerComposer() MOZ_OVERRIDE;
michael@0 54
michael@0 55 virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE;
michael@0 56
michael@0 57 virtual void CleanupResources() MOZ_OVERRIDE;
michael@0 58
michael@0 59 virtual bool SetCompositableHost(CompositableHost* aHost) MOZ_OVERRIDE;
michael@0 60
michael@0 61 virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; }
michael@0 62
michael@0 63 void EnsureTiled() { mRequiresTiledProperties = true; }
michael@0 64
michael@0 65 virtual void InvalidateRegion(const nsIntRegion& aRegion)
michael@0 66 {
michael@0 67 NS_RUNTIMEABORT("ThebesLayerComposites can't fill invalidated regions");
michael@0 68 }
michael@0 69
michael@0 70 void SetValidRegion(const nsIntRegion& aRegion)
michael@0 71 {
michael@0 72 MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ValidRegion", this));
michael@0 73 mValidRegion = aRegion;
michael@0 74 Mutated();
michael@0 75 }
michael@0 76
michael@0 77 MOZ_LAYER_DECL_NAME("ThebesLayerComposite", TYPE_THEBES)
michael@0 78
michael@0 79 protected:
michael@0 80
michael@0 81 virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix) MOZ_OVERRIDE;
michael@0 82
michael@0 83 private:
michael@0 84 CSSToScreenScale GetEffectiveResolution();
michael@0 85
michael@0 86 RefPtr<ContentHost> mBuffer;
michael@0 87 bool mRequiresTiledProperties;
michael@0 88 };
michael@0 89
michael@0 90 } /* layers */
michael@0 91 } /* mozilla */
michael@0 92 #endif /* GFX_ThebesLayerComposite_H */

mercurial