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