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_SHAREDTEXTUREIMAGE_H |
michael@0 | 7 | #define GFX_SHAREDTEXTUREIMAGE_H |
michael@0 | 8 | |
michael@0 | 9 | #include "GLContextProvider.h" // for GLContextProvider |
michael@0 | 10 | #include "ImageContainer.h" // for Image |
michael@0 | 11 | #include "ImageTypes.h" // for ImageFormat::SHARED_TEXTURE |
michael@0 | 12 | #include "nsCOMPtr.h" // for already_AddRefed |
michael@0 | 13 | #include "mozilla/gfx/Point.h" // for IntSize |
michael@0 | 14 | |
michael@0 | 15 | // Split into a separate header from ImageLayers.h due to GLContext.h dependence |
michael@0 | 16 | // Implementation remains in ImageLayers.cpp |
michael@0 | 17 | |
michael@0 | 18 | namespace mozilla { |
michael@0 | 19 | |
michael@0 | 20 | namespace layers { |
michael@0 | 21 | |
michael@0 | 22 | class SharedTextureImage : public Image { |
michael@0 | 23 | public: |
michael@0 | 24 | struct Data { |
michael@0 | 25 | gl::SharedTextureHandle mHandle; |
michael@0 | 26 | gl::SharedTextureShareType mShareType; |
michael@0 | 27 | gfx::IntSize mSize; |
michael@0 | 28 | bool mInverted; |
michael@0 | 29 | }; |
michael@0 | 30 | |
michael@0 | 31 | void SetData(const Data& aData) { mData = aData; } |
michael@0 | 32 | const Data* GetData() { return &mData; } |
michael@0 | 33 | |
michael@0 | 34 | gfx::IntSize GetSize() { return mData.mSize; } |
michael@0 | 35 | |
michael@0 | 36 | virtual TemporaryRef<gfx::SourceSurface> GetAsSourceSurface() MOZ_OVERRIDE |
michael@0 | 37 | { |
michael@0 | 38 | return nullptr; |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | SharedTextureImage() : Image(nullptr, ImageFormat::SHARED_TEXTURE) {} |
michael@0 | 42 | |
michael@0 | 43 | private: |
michael@0 | 44 | Data mData; |
michael@0 | 45 | }; |
michael@0 | 46 | |
michael@0 | 47 | } // layers |
michael@0 | 48 | } // mozilla |
michael@0 | 49 | |
michael@0 | 50 | #endif // GFX_SHAREDTEXTUREIMAGE_H |