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

mercurial