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 MOZILLA_GFX_IMAGEHOST_H |
michael@0 | 7 | #define MOZILLA_GFX_IMAGEHOST_H |
michael@0 | 8 | |
michael@0 | 9 | #include <stdio.h> // for FILE |
michael@0 | 10 | #include "CompositableHost.h" // for CompositableHost |
michael@0 | 11 | #include "mozilla/Attributes.h" // for MOZ_OVERRIDE |
michael@0 | 12 | #include "mozilla/RefPtr.h" // for RefPtr |
michael@0 | 13 | #include "mozilla/gfx/Point.h" // for Point |
michael@0 | 14 | #include "mozilla/gfx/Rect.h" // for Rect |
michael@0 | 15 | #include "mozilla/gfx/Types.h" // for Filter |
michael@0 | 16 | #include "mozilla/layers/CompositorTypes.h" // for TextureInfo, etc |
michael@0 | 17 | #include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor |
michael@0 | 18 | #include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc |
michael@0 | 19 | #include "mozilla/layers/TextureHost.h" // for TextureHost, etc |
michael@0 | 20 | #include "mozilla/mozalloc.h" // for operator delete |
michael@0 | 21 | #include "nsCOMPtr.h" // for already_AddRefed |
michael@0 | 22 | #include "nsRect.h" // for nsIntRect |
michael@0 | 23 | #include "nscore.h" // for nsACString |
michael@0 | 24 | |
michael@0 | 25 | class nsIntRegion; |
michael@0 | 26 | |
michael@0 | 27 | namespace mozilla { |
michael@0 | 28 | namespace gfx { |
michael@0 | 29 | class Matrix4x4; |
michael@0 | 30 | } |
michael@0 | 31 | namespace layers { |
michael@0 | 32 | |
michael@0 | 33 | class Compositor; |
michael@0 | 34 | class ISurfaceAllocator; |
michael@0 | 35 | struct EffectChain; |
michael@0 | 36 | |
michael@0 | 37 | /** |
michael@0 | 38 | * ImageHost. Works with ImageClientSingle and ImageClientBuffered |
michael@0 | 39 | */ |
michael@0 | 40 | class ImageHost : public CompositableHost |
michael@0 | 41 | { |
michael@0 | 42 | public: |
michael@0 | 43 | ImageHost(const TextureInfo& aTextureInfo); |
michael@0 | 44 | ~ImageHost(); |
michael@0 | 45 | |
michael@0 | 46 | virtual CompositableType GetType() { return mTextureInfo.mCompositableType; } |
michael@0 | 47 | |
michael@0 | 48 | virtual void Composite(EffectChain& aEffectChain, |
michael@0 | 49 | float aOpacity, |
michael@0 | 50 | const gfx::Matrix4x4& aTransform, |
michael@0 | 51 | const gfx::Filter& aFilter, |
michael@0 | 52 | const gfx::Rect& aClipRect, |
michael@0 | 53 | const nsIntRegion* aVisibleRegion = nullptr, |
michael@0 | 54 | TiledLayerProperties* aLayerProperties = nullptr) MOZ_OVERRIDE; |
michael@0 | 55 | |
michael@0 | 56 | virtual void UseTextureHost(TextureHost* aTexture) MOZ_OVERRIDE; |
michael@0 | 57 | |
michael@0 | 58 | virtual void RemoveTextureHost(TextureHost* aTexture) MOZ_OVERRIDE; |
michael@0 | 59 | |
michael@0 | 60 | virtual TextureHost* GetAsTextureHost() MOZ_OVERRIDE; |
michael@0 | 61 | |
michael@0 | 62 | virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE; |
michael@0 | 63 | |
michael@0 | 64 | virtual void SetPictureRect(const nsIntRect& aPictureRect) MOZ_OVERRIDE |
michael@0 | 65 | { |
michael@0 | 66 | mPictureRect = aPictureRect; |
michael@0 | 67 | mHasPictureRect = true; |
michael@0 | 68 | } |
michael@0 | 69 | |
michael@0 | 70 | virtual LayerRenderState GetRenderState() MOZ_OVERRIDE; |
michael@0 | 71 | |
michael@0 | 72 | virtual void PrintInfo(nsACString& aTo, const char* aPrefix); |
michael@0 | 73 | |
michael@0 | 74 | #ifdef MOZ_DUMP_PAINTING |
michael@0 | 75 | virtual void Dump(FILE* aFile = nullptr, |
michael@0 | 76 | const char* aPrefix = "", |
michael@0 | 77 | bool aDumpHtml = false) MOZ_OVERRIDE; |
michael@0 | 78 | |
michael@0 | 79 | virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE; |
michael@0 | 80 | #endif |
michael@0 | 81 | |
michael@0 | 82 | protected: |
michael@0 | 83 | |
michael@0 | 84 | RefPtr<TextureHost> mFrontBuffer; |
michael@0 | 85 | nsIntRect mPictureRect; |
michael@0 | 86 | bool mHasPictureRect; |
michael@0 | 87 | }; |
michael@0 | 88 | |
michael@0 | 89 | } |
michael@0 | 90 | } |
michael@0 | 91 | |
michael@0 | 92 | #endif |