gfx/gl/GLSharedHandleHelpers.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 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #ifndef GLSHAREDHANDLEHELPERS_H_
michael@0 6 #define GLSHAREDHANDLEHELPERS_H_
michael@0 7
michael@0 8 #include "GLContextTypes.h"
michael@0 9 #include "mozilla/gfx/Types.h"
michael@0 10
michael@0 11 namespace mozilla {
michael@0 12 namespace gl {
michael@0 13
michael@0 14 /**
michael@0 15 * Create a new shared GLContext content handle, using the passed buffer as a source.
michael@0 16 * Must be released by ReleaseSharedHandle.
michael@0 17 */
michael@0 18 SharedTextureHandle CreateSharedHandle(GLContext* gl,
michael@0 19 SharedTextureShareType shareType,
michael@0 20 void* buffer,
michael@0 21 SharedTextureBufferType bufferType);
michael@0 22
michael@0 23 /**
michael@0 24 * - It is better to call ReleaseSharedHandle before original GLContext destroyed,
michael@0 25 * otherwise warning will be thrown on attempt to destroy Texture associated with SharedHandle, depends on backend implementation.
michael@0 26 * - It does not require to be called on context where it was created,
michael@0 27 * because SharedHandle suppose to keep Context reference internally,
michael@0 28 * or don't require specific context at all, for example IPC SharedHandle.
michael@0 29 * - Not recommended to call this between AttachSharedHandle and Draw Target call.
michael@0 30 * if it is really required for some special backend, then DetachSharedHandle API must be added with related implementation.
michael@0 31 * - It is recommended to stop any possible access to SharedHandle (Attachments, pending GL calls) before calling Release,
michael@0 32 * otherwise some artifacts might appear or even crash if API backend implementation does not expect that.
michael@0 33 * SharedHandle (currently EGLImage) does not require GLContext because it is EGL call, and can be destroyed
michael@0 34 * at any time, unless EGLImage have siblings (which are not expected with current API).
michael@0 35 */
michael@0 36 void ReleaseSharedHandle(GLContext* gl,
michael@0 37 SharedTextureShareType shareType,
michael@0 38 SharedTextureHandle sharedHandle);
michael@0 39
michael@0 40
michael@0 41 typedef struct {
michael@0 42 GLenum mTarget;
michael@0 43 gfx::SurfaceFormat mTextureFormat;
michael@0 44 gfx::Matrix4x4 mTextureTransform;
michael@0 45 } SharedHandleDetails;
michael@0 46
michael@0 47 /**
michael@0 48 * Returns information necessary for rendering a shared handle.
michael@0 49 * These values change depending on what sharing mechanism is in use
michael@0 50 */
michael@0 51 bool GetSharedHandleDetails(GLContext* gl,
michael@0 52 SharedTextureShareType shareType,
michael@0 53 SharedTextureHandle sharedHandle,
michael@0 54 SharedHandleDetails& details);
michael@0 55 /**
michael@0 56 * Attach Shared GL Handle to GL_TEXTURE_2D target
michael@0 57 * GLContext must be current before this call
michael@0 58 */
michael@0 59 bool AttachSharedHandle(GLContext* gl,
michael@0 60 SharedTextureShareType shareType,
michael@0 61 SharedTextureHandle sharedHandle);
michael@0 62
michael@0 63 /**
michael@0 64 * Detach Shared GL Handle from GL_TEXTURE_2D target
michael@0 65 */
michael@0 66 void DetachSharedHandle(GLContext* gl,
michael@0 67 SharedTextureShareType shareType,
michael@0 68 SharedTextureHandle sharedHandle);
michael@0 69
michael@0 70 }
michael@0 71 }
michael@0 72
michael@0 73 #endif

mercurial