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_CanvasLayerComposite_H
7 #define GFX_CanvasLayerComposite_H
9 #include "Layers.h" // for CanvasLayer, etc
10 #include "mozilla/Attributes.h" // for MOZ_OVERRIDE
11 #include "mozilla/RefPtr.h" // for RefPtr
12 #include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite, etc
13 #include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc
14 #include "nsDebug.h" // for NS_RUNTIMEABORT
15 #include "nsRect.h" // for nsIntRect
16 #include "nscore.h" // for nsACString
17 struct nsIntPoint;
19 namespace mozilla {
20 namespace layers {
22 class CompositableHost;
23 // Canvas layers use ImageHosts (but CanvasClients) because compositing a
24 // canvas is identical to compositing an image.
25 class ImageHost;
27 class CanvasLayerComposite : public CanvasLayer,
28 public LayerComposite
29 {
30 public:
31 CanvasLayerComposite(LayerManagerComposite* aManager);
33 virtual ~CanvasLayerComposite();
35 // CanvasLayer impl
36 virtual void Initialize(const Data& aData) MOZ_OVERRIDE
37 {
38 NS_RUNTIMEABORT("Incompatibe surface type");
39 }
41 virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
43 virtual bool SetCompositableHost(CompositableHost* aHost) MOZ_OVERRIDE;
45 virtual void Disconnect() MOZ_OVERRIDE
46 {
47 Destroy();
48 }
50 virtual Layer* GetLayer() MOZ_OVERRIDE;
51 virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE;
53 virtual void CleanupResources() MOZ_OVERRIDE;
55 CompositableHost* GetCompositableHost() MOZ_OVERRIDE;
57 virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; }
59 void SetBounds(nsIntRect aBounds) { mBounds = aBounds; }
61 virtual const char* Name() const MOZ_OVERRIDE { return "CanvasLayerComposite"; }
63 protected:
64 virtual nsACString& PrintInfo(nsACString& aTo, const char* aPrefix) MOZ_OVERRIDE;
66 private:
67 RefPtr<CompositableHost> mImageHost;
68 };
70 } /* layers */
71 } /* mozilla */
72 #endif /* GFX_CanvasLayerComposite_H */