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