gfx/skia/trunk/include/gpu/gl/SkNativeGLContext.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.

     2 /*
     3  * Copyright 2011 Google Inc.
     4  *
     5  * Use of this source code is governed by a BSD-style license that can be
     6  * found in the LICENSE file.
     7  */
     8 #ifndef SkNativeGLContext_DEFINED
     9 #define SkNativeGLContext_DEFINED
    11 #include "SkGLContextHelper.h"
    13 #if defined(SK_BUILD_FOR_MAC)
    14     #include <OpenGL/OpenGL.h>
    15 #elif defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_NACL)
    16     #include <GLES2/gl2.h>
    17     #include <EGL/egl.h>
    18 #elif defined(SK_BUILD_FOR_UNIX)
    19     #include <X11/Xlib.h>
    20     #include <GL/glx.h>
    21 #elif defined(SK_BUILD_FOR_WIN32)
    22     #include <windows.h>
    23     #include <GL/GL.h>
    24 #endif
    26 class SkNativeGLContext : public SkGLContextHelper {
    27 public:
    28     SkNativeGLContext();
    30     virtual ~SkNativeGLContext();
    32     virtual void makeCurrent() const SK_OVERRIDE;
    33     virtual void swapBuffers() const SK_OVERRIDE;
    35     class AutoContextRestore {
    36     public:
    37         AutoContextRestore();
    38         ~AutoContextRestore();
    40     private:
    41     #if defined(SK_BUILD_FOR_MAC)
    42         CGLContextObj fOldCGLContext;
    43     #elif defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_NACL)
    44         EGLContext fOldEGLContext;
    45         EGLDisplay fOldDisplay;
    46         EGLSurface fOldSurface;
    47     #elif defined(SK_BUILD_FOR_UNIX)
    48         GLXContext fOldGLXContext;
    49         Display* fOldDisplay;
    50         GLXDrawable fOldDrawable;
    51     #elif defined(SK_BUILD_FOR_WIN32)
    52         HDC fOldHDC;
    53         HGLRC fOldHGLRC;
    55     #elif defined(SK_BUILD_FOR_IOS)
    56         void* fEAGLContext;
    57     #endif
    58     };
    60 protected:
    61     virtual const GrGLInterface* createGLContext() SK_OVERRIDE;
    62     virtual void destroyGLContext() SK_OVERRIDE;
    64 private:
    65 #if defined(SK_BUILD_FOR_MAC)
    66     CGLContextObj fContext;
    67 #elif defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_NACL)
    68     EGLContext fContext;
    69     EGLDisplay fDisplay;
    70     EGLSurface fSurface;
    71 #elif defined(SK_BUILD_FOR_UNIX)
    72     GLXContext fContext;
    73     Display* fDisplay;
    74     Pixmap fPixmap;
    75     GLXPixmap fGlxPixmap;
    76 #elif defined(SK_BUILD_FOR_WIN32)
    77     HWND fWindow;
    78     HDC fDeviceContext;
    79     HGLRC fGlRenderContext;
    80     static ATOM gWC;
    81 #elif defined(SK_BUILD_FOR_IOS)
    82     void* fEAGLContext;
    83 #endif
    84 };
    86 #endif

mercurial