gfx/gl/SurfaceTypes.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++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */
     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 SURFACE_TYPES_H_
     7 #define SURFACE_TYPES_H_
     9 #include "mozilla/TypedEnum.h"
    10 #include "mozilla/RefPtr.h"
    11 #include "mozilla/Attributes.h"
    12 #include <stdint.h>
    14 namespace mozilla {
    15 namespace layers {
    16 class ISurfaceAllocator;
    17 }
    19 namespace gfx {
    21 typedef uintptr_t SurfaceStreamHandle;
    23 struct SurfaceCaps MOZ_FINAL
    24 {
    25     bool any;
    26     bool color, alpha;
    27     bool bpp16;
    28     bool depth, stencil;
    29     bool antialias;
    30     bool preserve;
    32     // The surface allocator that we want to create this
    33     // for.  May be null.
    34     RefPtr<layers::ISurfaceAllocator> surfaceAllocator;
    36     SurfaceCaps();
    37     SurfaceCaps(const SurfaceCaps& other);
    38     ~SurfaceCaps();
    40     void Clear();
    42     SurfaceCaps& operator=(const SurfaceCaps& other);
    44     // We can't use just 'RGB' here, since it's an ancient Windows macro.
    45     static SurfaceCaps ForRGB() {
    46         SurfaceCaps caps;
    48         caps.color = true;
    50         return caps;
    51     }
    53     static SurfaceCaps ForRGBA() {
    54         SurfaceCaps caps;
    56         caps.color = true;
    57         caps.alpha = true;
    59         return caps;
    60     }
    62     static SurfaceCaps Any() {
    63         SurfaceCaps caps;
    65         caps.any = true;
    67         return caps;
    68     }
    69 };
    71 MOZ_BEGIN_ENUM_CLASS(SharedSurfaceType, uint8_t)
    72     Unknown = 0,
    74     Basic,
    75     GLTextureShare,
    76     EGLImageShare,
    77     EGLSurfaceANGLE,
    78     DXGLInterop,
    79     DXGLInterop2,
    80     Gralloc,
    81     IOSurface,
    83     Max
    84 MOZ_END_ENUM_CLASS(SharedSurfaceType)
    87 MOZ_BEGIN_ENUM_CLASS(SurfaceStreamType, uint8_t)
    88     SingleBuffer,
    89     TripleBuffer_Copy,
    90     TripleBuffer_Async,
    91     TripleBuffer,
    92     Max
    93 MOZ_END_ENUM_CLASS(SurfaceStreamType)
    96 MOZ_BEGIN_ENUM_CLASS(APITypeT, uint8_t)
    97     Generic = 0,
    99     OpenGL,
   101     Max
   102 MOZ_END_ENUM_CLASS(APITypeT)
   105 MOZ_BEGIN_ENUM_CLASS(AttachmentType, uint8_t)
   106     Screen = 0,
   108     GLTexture,
   109     GLRenderbuffer,
   111     Max
   112 MOZ_END_ENUM_CLASS(AttachmentType)
   114 } /* namespace gfx */
   115 } /* namespace mozilla */
   117 #endif /* SURFACE_TYPES_H_ */

mercurial