gfx/gl/SharedSurface.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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.

     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 /* SharedSurface abstracts an actual surface (can be a GL texture, but
     7  * not necessarily) that handles sharing.
     8  * Its specializations are:
     9  *     SharedSurface_Basic (client-side bitmap, does readback)
    10  *     SharedSurface_GLTexture
    11  *     SharedSurface_EGLImage
    12  *     SharedSurface_ANGLEShareHandle
    13  */
    15 #ifndef SHARED_SURFACE_H_
    16 #define SHARED_SURFACE_H_
    18 #include <stdint.h>
    19 #include "mozilla/Attributes.h"
    20 #include "GLDefs.h"
    21 #include "mozilla/gfx/Point.h"
    22 #include "SurfaceTypes.h"
    24 namespace mozilla {
    25 namespace gfx {
    27 class SurfaceFactory;
    29 class SharedSurface
    30 {
    31 protected:
    32     const SharedSurfaceType mType;
    33     const APITypeT mAPI;
    34     const AttachmentType mAttachType;
    35     const gfx::IntSize mSize;
    36     const bool mHasAlpha;
    37     bool mIsLocked;
    39     SharedSurface(SharedSurfaceType type,
    40                   APITypeT api,
    41                   AttachmentType attachType,
    42                   const gfx::IntSize& size,
    43                   bool hasAlpha)
    44         : mType(type)
    45         , mAPI(api)
    46         , mAttachType(attachType)
    47         , mSize(size)
    48         , mHasAlpha(hasAlpha)
    49         , mIsLocked(false)
    50     {
    51     }
    53 public:
    54     virtual ~SharedSurface() {
    55     }
    57     static void Copy(SharedSurface* src, SharedSurface* dest,
    58                      SurfaceFactory* factory);
    60     // This locks the SharedSurface as the production buffer for the context.
    61     // This is needed by backends which use PBuffers and/or EGLSurfaces.
    62     virtual void LockProd() {
    63         MOZ_ASSERT(!mIsLocked);
    64         LockProdImpl();
    65         mIsLocked = true;
    66     }
    68     // Unlocking is harmless if we're already unlocked.
    69     virtual void UnlockProd() {
    70         if (!mIsLocked)
    71             return;
    73         UnlockProdImpl();
    74         mIsLocked = false;
    75     }
    77     virtual void LockProdImpl() = 0;
    78     virtual void UnlockProdImpl() = 0;
    80     virtual void Fence() = 0;
    81     virtual bool WaitSync() = 0;
    84     SharedSurfaceType Type() const {
    85         return mType;
    86     }
    88     APITypeT APIType() const {
    89         return mAPI;
    90     }
    92     AttachmentType AttachType() const {
    93         return mAttachType;
    94     }
    96     const gfx::IntSize& Size() const {
    97         return mSize;
    98     }
   100     bool HasAlpha() const {
   101         return mHasAlpha;
   102     }
   103 };
   105 } /* namespace gfx */
   106 } /* namespace mozilla */
   108 #endif /* SHARED_SURFACE_H_ */

mercurial