Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
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 GLUploadHelpers_h_ |
michael@0 | 7 | #define GLUploadHelpers_h_ |
michael@0 | 8 | |
michael@0 | 9 | #include "GLDefs.h" |
michael@0 | 10 | #include "mozilla/gfx/Types.h" |
michael@0 | 11 | #include "nsPoint.h" |
michael@0 | 12 | |
michael@0 | 13 | class nsIntRegion; |
michael@0 | 14 | |
michael@0 | 15 | namespace mozilla { |
michael@0 | 16 | |
michael@0 | 17 | namespace gfx { |
michael@0 | 18 | class DataSourceSurface; |
michael@0 | 19 | } |
michael@0 | 20 | |
michael@0 | 21 | namespace gl { |
michael@0 | 22 | |
michael@0 | 23 | class GLContext; |
michael@0 | 24 | |
michael@0 | 25 | /** |
michael@0 | 26 | * Creates a RGB/RGBA texture (or uses one provided) and uploads the surface |
michael@0 | 27 | * contents to it within aSrcRect. |
michael@0 | 28 | * |
michael@0 | 29 | * aSrcRect.x/y will be uploaded to 0/0 in the texture, and the size |
michael@0 | 30 | * of the texture with be aSrcRect.width/height. |
michael@0 | 31 | * |
michael@0 | 32 | * If an existing texture is passed through aTexture, it is assumed it |
michael@0 | 33 | * has already been initialised with glTexImage2D (or this function), |
michael@0 | 34 | * and that its size is equal to or greater than aSrcRect + aDstPoint. |
michael@0 | 35 | * You can alternatively set the overwrite flag to true and have a new |
michael@0 | 36 | * texture memory block allocated. |
michael@0 | 37 | * |
michael@0 | 38 | * The aDstPoint parameter is ignored if no texture was provided |
michael@0 | 39 | * or aOverwrite is true. |
michael@0 | 40 | * |
michael@0 | 41 | * \param aData Image data to upload. |
michael@0 | 42 | * \param aDstRegion Region of texture to upload to. |
michael@0 | 43 | * \param aTexture Texture to use, or 0 to have one created for you. |
michael@0 | 44 | * \param aOverwrite Over an existing texture with a new one. |
michael@0 | 45 | * \param aSrcPoint Offset into aSrc where the region's bound's |
michael@0 | 46 | * TopLeft() sits. |
michael@0 | 47 | * \param aPixelBuffer Pass true to upload texture data with an |
michael@0 | 48 | * offset from the base data (generally for pixel buffer objects), |
michael@0 | 49 | * otherwise textures are upload with an absolute pointer to the data. |
michael@0 | 50 | * \param aTextureUnit, the texture unit used temporarily to upload the |
michael@0 | 51 | * surface. This testure may be overridden, clients should not rely on |
michael@0 | 52 | * the contents of this texture after this call or even on this |
michael@0 | 53 | * texture unit being active. |
michael@0 | 54 | * \return Surface format of this texture. |
michael@0 | 55 | */ |
michael@0 | 56 | gfx::SurfaceFormat |
michael@0 | 57 | UploadImageDataToTexture(GLContext* gl, |
michael@0 | 58 | unsigned char* aData, |
michael@0 | 59 | int32_t aStride, |
michael@0 | 60 | gfx::SurfaceFormat aFormat, |
michael@0 | 61 | const nsIntRegion& aDstRegion, |
michael@0 | 62 | GLuint& aTexture, |
michael@0 | 63 | bool aOverwrite = false, |
michael@0 | 64 | bool aPixelBuffer = false, |
michael@0 | 65 | GLenum aTextureUnit = LOCAL_GL_TEXTURE0, |
michael@0 | 66 | GLenum aTextureTarget = LOCAL_GL_TEXTURE_2D); |
michael@0 | 67 | |
michael@0 | 68 | /** |
michael@0 | 69 | * Convenience wrapper around UploadImageDataToTexture for gfx::DataSourceSurface's. |
michael@0 | 70 | */ |
michael@0 | 71 | gfx::SurfaceFormat |
michael@0 | 72 | UploadSurfaceToTexture(GLContext* gl, |
michael@0 | 73 | gfx::DataSourceSurface *aSurface, |
michael@0 | 74 | const nsIntRegion& aDstRegion, |
michael@0 | 75 | GLuint& aTexture, |
michael@0 | 76 | bool aOverwrite = false, |
michael@0 | 77 | const nsIntPoint& aSrcPoint = nsIntPoint(0, 0), |
michael@0 | 78 | bool aPixelBuffer = false, |
michael@0 | 79 | GLenum aTextureUnit = LOCAL_GL_TEXTURE0, |
michael@0 | 80 | GLenum aTextureTarget = LOCAL_GL_TEXTURE_2D); |
michael@0 | 81 | |
michael@0 | 82 | bool CanUploadSubTextures(GLContext* gl); |
michael@0 | 83 | bool CanUploadNonPowerOfTwo(GLContext* gl); |
michael@0 | 84 | |
michael@0 | 85 | } |
michael@0 | 86 | } |
michael@0 | 87 | |
michael@0 | 88 | #endif |