gfx/gl/SharedSurfaceEGL.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.

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 SHARED_SURFACE_EGL_H_
michael@0 7 #define SHARED_SURFACE_EGL_H_
michael@0 8
michael@0 9 #include "SharedSurfaceGL.h"
michael@0 10 #include "SurfaceFactory.h"
michael@0 11 #include "GLLibraryEGL.h"
michael@0 12 #include "SurfaceTypes.h"
michael@0 13 #include "mozilla/Attributes.h"
michael@0 14 #include "mozilla/Mutex.h"
michael@0 15
michael@0 16 namespace mozilla {
michael@0 17 namespace gl {
michael@0 18
michael@0 19 class GLContext;
michael@0 20 class TextureGarbageBin;
michael@0 21
michael@0 22 class SharedSurface_EGLImage
michael@0 23 : public SharedSurface_GL
michael@0 24 {
michael@0 25 public:
michael@0 26 static SharedSurface_EGLImage* Create(GLContext* prodGL,
michael@0 27 const GLFormats& formats,
michael@0 28 const gfx::IntSize& size,
michael@0 29 bool hasAlpha,
michael@0 30 EGLContext context);
michael@0 31
michael@0 32 static SharedSurface_EGLImage* Cast(SharedSurface* surf) {
michael@0 33 MOZ_ASSERT(surf->Type() == SharedSurfaceType::EGLImageShare);
michael@0 34
michael@0 35 return (SharedSurface_EGLImage*)surf;
michael@0 36 }
michael@0 37
michael@0 38 static bool HasExtensions(GLLibraryEGL* egl, GLContext* gl);
michael@0 39
michael@0 40 protected:
michael@0 41 mutable Mutex mMutex;
michael@0 42 GLLibraryEGL* const mEGL;
michael@0 43 const GLFormats mFormats;
michael@0 44 GLuint mProdTex;
michael@0 45 EGLImage mImage;
michael@0 46 GLContext* mCurConsGL;
michael@0 47 GLuint mConsTex;
michael@0 48 nsRefPtr<TextureGarbageBin> mGarbageBin;
michael@0 49 EGLSync mSync;
michael@0 50
michael@0 51 SharedSurface_EGLImage(GLContext* gl,
michael@0 52 GLLibraryEGL* egl,
michael@0 53 const gfx::IntSize& size,
michael@0 54 bool hasAlpha,
michael@0 55 const GLFormats& formats,
michael@0 56 GLuint prodTex,
michael@0 57 EGLImage image);
michael@0 58
michael@0 59 EGLDisplay Display() const;
michael@0 60 void UpdateProdTexture(const MutexAutoLock& curAutoLock);
michael@0 61
michael@0 62 public:
michael@0 63 virtual ~SharedSurface_EGLImage();
michael@0 64
michael@0 65 virtual void LockProdImpl() MOZ_OVERRIDE {}
michael@0 66 virtual void UnlockProdImpl() MOZ_OVERRIDE {}
michael@0 67
michael@0 68
michael@0 69 virtual void Fence() MOZ_OVERRIDE;
michael@0 70 virtual bool WaitSync() MOZ_OVERRIDE;
michael@0 71
michael@0 72 virtual GLuint ProdTexture() MOZ_OVERRIDE {
michael@0 73 return mProdTex;
michael@0 74 }
michael@0 75
michael@0 76 // Implementation-specific functions below:
michael@0 77 // Returns texture and target
michael@0 78 void AcquireConsumerTexture(GLContext* consGL, GLuint* out_texture, GLuint* out_target);
michael@0 79 };
michael@0 80
michael@0 81
michael@0 82
michael@0 83 class SurfaceFactory_EGLImage
michael@0 84 : public SurfaceFactory_GL
michael@0 85 {
michael@0 86 public:
michael@0 87 // Fallible:
michael@0 88 static SurfaceFactory_EGLImage* Create(GLContext* prodGL,
michael@0 89 const SurfaceCaps& caps);
michael@0 90
michael@0 91 protected:
michael@0 92 const EGLContext mContext;
michael@0 93
michael@0 94 SurfaceFactory_EGLImage(GLContext* prodGL,
michael@0 95 EGLContext context,
michael@0 96 const SurfaceCaps& caps)
michael@0 97 : SurfaceFactory_GL(prodGL, SharedSurfaceType::EGLImageShare, caps)
michael@0 98 , mContext(context)
michael@0 99 {}
michael@0 100
michael@0 101 public:
michael@0 102 virtual SharedSurface* CreateShared(const gfx::IntSize& size) MOZ_OVERRIDE {
michael@0 103 bool hasAlpha = mReadCaps.alpha;
michael@0 104 return SharedSurface_EGLImage::Create(mGL, mFormats, size, hasAlpha, mContext);
michael@0 105 }
michael@0 106 };
michael@0 107
michael@0 108 } /* namespace gfx */
michael@0 109 } /* namespace mozilla */
michael@0 110
michael@0 111 #endif /* SHARED_SURFACE_EGL_H_ */

mercurial