Tue, 06 Jan 2015 21:39:09 +0100
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_ContainerLayerComposite_H |
michael@0 | 7 | #define GFX_ContainerLayerComposite_H |
michael@0 | 8 | |
michael@0 | 9 | #include "Layers.h" // for Layer (ptr only), etc |
michael@0 | 10 | #include "mozilla/Attributes.h" // for MOZ_OVERRIDE |
michael@0 | 11 | #include "mozilla/layers/LayerManagerComposite.h" |
michael@0 | 12 | |
michael@0 | 13 | struct nsIntPoint; |
michael@0 | 14 | struct nsIntRect; |
michael@0 | 15 | |
michael@0 | 16 | namespace mozilla { |
michael@0 | 17 | namespace layers { |
michael@0 | 18 | |
michael@0 | 19 | class CompositableHost; |
michael@0 | 20 | |
michael@0 | 21 | class ContainerLayerComposite : public ContainerLayer, |
michael@0 | 22 | public LayerComposite |
michael@0 | 23 | { |
michael@0 | 24 | template<class ContainerT> |
michael@0 | 25 | friend void ContainerRender(ContainerT* aContainer, |
michael@0 | 26 | LayerManagerComposite* aManager, |
michael@0 | 27 | const nsIntRect& aClipRect); |
michael@0 | 28 | public: |
michael@0 | 29 | ContainerLayerComposite(LayerManagerComposite *aManager); |
michael@0 | 30 | |
michael@0 | 31 | ~ContainerLayerComposite(); |
michael@0 | 32 | |
michael@0 | 33 | // LayerComposite Implementation |
michael@0 | 34 | virtual Layer* GetLayer() MOZ_OVERRIDE { return this; } |
michael@0 | 35 | |
michael@0 | 36 | virtual void Destroy() MOZ_OVERRIDE; |
michael@0 | 37 | |
michael@0 | 38 | LayerComposite* GetFirstChildComposite(); |
michael@0 | 39 | |
michael@0 | 40 | virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE; |
michael@0 | 41 | |
michael@0 | 42 | virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE |
michael@0 | 43 | { |
michael@0 | 44 | DefaultComputeEffectiveTransforms(aTransformToSurface); |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | virtual void CleanupResources() MOZ_OVERRIDE; |
michael@0 | 48 | |
michael@0 | 49 | virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; } |
michael@0 | 50 | |
michael@0 | 51 | // container layers don't use a compositable |
michael@0 | 52 | CompositableHost* GetCompositableHost() MOZ_OVERRIDE { return nullptr; } |
michael@0 | 53 | |
michael@0 | 54 | virtual const char* Name() const MOZ_OVERRIDE { return "ContainerLayerComposite"; } |
michael@0 | 55 | }; |
michael@0 | 56 | |
michael@0 | 57 | class RefLayerComposite : public RefLayer, |
michael@0 | 58 | public LayerComposite |
michael@0 | 59 | { |
michael@0 | 60 | template<class ContainerT> |
michael@0 | 61 | friend void ContainerRender(ContainerT* aContainer, |
michael@0 | 62 | LayerManagerComposite* aManager, |
michael@0 | 63 | const nsIntRect& aClipRect); |
michael@0 | 64 | public: |
michael@0 | 65 | RefLayerComposite(LayerManagerComposite *aManager); |
michael@0 | 66 | ~RefLayerComposite(); |
michael@0 | 67 | |
michael@0 | 68 | /** LayerOGL implementation */ |
michael@0 | 69 | Layer* GetLayer() MOZ_OVERRIDE { return this; } |
michael@0 | 70 | |
michael@0 | 71 | void Destroy() MOZ_OVERRIDE; |
michael@0 | 72 | |
michael@0 | 73 | LayerComposite* GetFirstChildComposite(); |
michael@0 | 74 | |
michael@0 | 75 | virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE; |
michael@0 | 76 | |
michael@0 | 77 | virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE |
michael@0 | 78 | { |
michael@0 | 79 | DefaultComputeEffectiveTransforms(aTransformToSurface); |
michael@0 | 80 | } |
michael@0 | 81 | |
michael@0 | 82 | virtual void CleanupResources() MOZ_OVERRIDE; |
michael@0 | 83 | |
michael@0 | 84 | virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; } |
michael@0 | 85 | |
michael@0 | 86 | // ref layers don't use a compositable |
michael@0 | 87 | CompositableHost* GetCompositableHost() MOZ_OVERRIDE { return nullptr; } |
michael@0 | 88 | |
michael@0 | 89 | virtual const char* Name() const MOZ_OVERRIDE { return "RefLayerComposite"; } |
michael@0 | 90 | }; |
michael@0 | 91 | |
michael@0 | 92 | } /* layers */ |
michael@0 | 93 | } /* mozilla */ |
michael@0 | 94 | |
michael@0 | 95 | #endif /* GFX_ContainerLayerComposite_H */ |