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: 4 -*- */ |
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 TextureImageCGL_h_ |
michael@0 | 7 | #define TextureImageCGL_h_ |
michael@0 | 8 | |
michael@0 | 9 | #include "GLTextureImage.h" |
michael@0 | 10 | #include "GLContextTypes.h" |
michael@0 | 11 | #include "nsAutoPtr.h" |
michael@0 | 12 | #include "nsSize.h" |
michael@0 | 13 | |
michael@0 | 14 | class gfxASurface; |
michael@0 | 15 | |
michael@0 | 16 | namespace mozilla { |
michael@0 | 17 | namespace gl { |
michael@0 | 18 | |
michael@0 | 19 | class TextureImageCGL : public BasicTextureImage |
michael@0 | 20 | { |
michael@0 | 21 | public: |
michael@0 | 22 | |
michael@0 | 23 | TextureImageCGL(GLuint aTexture, |
michael@0 | 24 | const nsIntSize& aSize, |
michael@0 | 25 | GLenum aWrapMode, |
michael@0 | 26 | ContentType aContentType, |
michael@0 | 27 | GLContext* aContext, |
michael@0 | 28 | TextureImage::Flags aFlags = TextureImage::NoFlags, |
michael@0 | 29 | TextureImage::ImageFormat aImageFormat = gfxImageFormat::Unknown); |
michael@0 | 30 | |
michael@0 | 31 | ~TextureImageCGL(); |
michael@0 | 32 | |
michael@0 | 33 | protected: |
michael@0 | 34 | already_AddRefed<gfxASurface> |
michael@0 | 35 | GetSurfaceForUpdate(const gfxIntSize& aSize, ImageFormat aFmt); |
michael@0 | 36 | |
michael@0 | 37 | bool FinishedSurfaceUpdate(); |
michael@0 | 38 | |
michael@0 | 39 | void FinishedSurfaceUpload(); |
michael@0 | 40 | |
michael@0 | 41 | private: |
michael@0 | 42 | |
michael@0 | 43 | GLuint mPixelBuffer; |
michael@0 | 44 | int32_t mPixelBufferSize; |
michael@0 | 45 | bool mBoundPixelBuffer; |
michael@0 | 46 | }; |
michael@0 | 47 | |
michael@0 | 48 | already_AddRefed<TextureImage> |
michael@0 | 49 | CreateTextureImageCGL(GLContext *gl, |
michael@0 | 50 | const gfx::IntSize& aSize, |
michael@0 | 51 | TextureImage::ContentType aContentType, |
michael@0 | 52 | GLenum aWrapMode, |
michael@0 | 53 | TextureImage::Flags aFlags, |
michael@0 | 54 | TextureImage::ImageFormat aImageFormat); |
michael@0 | 55 | |
michael@0 | 56 | already_AddRefed<TextureImage> |
michael@0 | 57 | TileGenFuncCGL(GLContext *gl, |
michael@0 | 58 | const nsIntSize& aSize, |
michael@0 | 59 | TextureImage::ContentType aContentType, |
michael@0 | 60 | TextureImage::Flags aFlags, |
michael@0 | 61 | TextureImage::ImageFormat aImageFormat); |
michael@0 | 62 | |
michael@0 | 63 | } |
michael@0 | 64 | } |
michael@0 | 65 | |
michael@0 | 66 | #endif |