gfx/layers/SharedTextureImage.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

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

mercurial