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