gfx/2d/SourceSurfaceDual.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_SOURCESURFACEDUAL_H_
     7 #define MOZILLA_GFX_SOURCESURFACEDUAL_H_
     9 #include "2D.h"
    11 namespace mozilla {
    12 namespace gfx {
    14 class DualSurface;
    15 class DualPattern;
    17 class SourceSurfaceDual : public SourceSurface
    18 {
    19 public:
    20   MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SourceSurfaceDual)
    21   SourceSurfaceDual(DrawTarget *aDTA, DrawTarget *aDTB)
    22     : mA(aDTA->Snapshot())
    23     , mB(aDTB->Snapshot())
    24   { }
    26   virtual SurfaceType GetType() const { return SurfaceType::DUAL_DT; }
    27   virtual IntSize GetSize() const { return mA->GetSize(); }
    28   virtual SurfaceFormat GetFormat() const { return mA->GetFormat(); }
    30   /* Readback from this surface type is not supported! */
    31   virtual TemporaryRef<DataSourceSurface> GetDataSurface() { return nullptr; }
    32 private:
    33   friend class DualSurface;
    34   friend class DualPattern;
    36   RefPtr<SourceSurface> mA;
    37   RefPtr<SourceSurface> mB;
    38 };
    40 }
    41 }
    43 #endif /* MOZILLA_GFX_SOURCESURFACEDUAL_H_ */

mercurial