gfx/gl/WGLLibrary.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++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     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 #include "GLContextTypes.h"
     7 #include <windows.h>
     9 struct PRLibrary;
    11 namespace mozilla {
    12 namespace gl {
    14 class WGLLibrary
    15 {
    16 public:
    17     WGLLibrary() 
    18       : mInitialized(false), 
    19         mOGLLibrary(nullptr),
    20         mHasRobustness(false), 
    21         mWindow (0),
    22         mWindowDC(0),
    23         mWindowGLContext(0),
    24         mWindowPixelFormat (0)
    25     {}
    27     typedef HGLRC (GLAPIENTRY * PFNWGLCREATECONTEXTPROC) (HDC);
    28     PFNWGLCREATECONTEXTPROC fCreateContext;
    29     typedef BOOL (GLAPIENTRY * PFNWGLDELETECONTEXTPROC) (HGLRC);
    30     PFNWGLDELETECONTEXTPROC fDeleteContext;
    31     typedef BOOL (GLAPIENTRY * PFNWGLMAKECURRENTPROC) (HDC, HGLRC);
    32     PFNWGLMAKECURRENTPROC fMakeCurrent;
    33     typedef PROC (GLAPIENTRY * PFNWGLGETPROCADDRESSPROC) (LPCSTR);
    34     PFNWGLGETPROCADDRESSPROC fGetProcAddress;
    35     typedef HGLRC (GLAPIENTRY * PFNWGLGETCURRENTCONTEXT) (void);
    36     PFNWGLGETCURRENTCONTEXT fGetCurrentContext;
    37     typedef HDC (GLAPIENTRY * PFNWGLGETCURRENTDC) (void);
    38     PFNWGLGETCURRENTDC fGetCurrentDC;
    39     typedef BOOL (GLAPIENTRY * PFNWGLSHARELISTS) (HGLRC oldContext, HGLRC newContext);
    40     PFNWGLSHARELISTS fShareLists;
    42     typedef HANDLE (WINAPI * PFNWGLCREATEPBUFFERPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int* piAttribList);
    43     PFNWGLCREATEPBUFFERPROC fCreatePbuffer;
    44     typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERPROC) (HANDLE hPbuffer);
    45     PFNWGLDESTROYPBUFFERPROC fDestroyPbuffer;
    46     typedef HDC (WINAPI * PFNWGLGETPBUFFERDCPROC) (HANDLE hPbuffer);
    47     PFNWGLGETPBUFFERDCPROC fGetPbufferDC;
    49     typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEPROC) (HANDLE hPbuffer, int iBuffer);
    50     PFNWGLBINDTEXIMAGEPROC fBindTexImage;
    51     typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEPROC) (HANDLE hPbuffer, int iBuffer);
    52     PFNWGLRELEASETEXIMAGEPROC fReleaseTexImage;
    54     typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATPROC) (HDC hdc, const int* piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
    55     PFNWGLCHOOSEPIXELFORMATPROC fChoosePixelFormat;
    56     typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int* piAttributes, int *piValues);
    57     PFNWGLGETPIXELFORMATATTRIBIVPROC fGetPixelFormatAttribiv;
    59     typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGPROC) (HDC hdc);
    60     PFNWGLGETEXTENSIONSSTRINGPROC fGetExtensionsString;
    62     typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSPROC) (HDC hdc, HGLRC hShareContext, const int *attribList);
    63     PFNWGLCREATECONTEXTATTRIBSPROC fCreateContextAttribs;
    65     bool EnsureInitialized();
    66     HWND CreateDummyWindow(HDC *aWindowDC = nullptr);
    68     bool HasRobustness() const { return mHasRobustness; }
    69     bool IsInitialized() const { return mInitialized; }
    70     HWND GetWindow() const { return mWindow; }
    71     HDC GetWindowDC() const {return mWindowDC; }
    72     HGLRC GetWindowGLContext() const {return mWindowGLContext; }
    73     int GetWindowPixelFormat() const { return mWindowPixelFormat; }
    74     PRLibrary *GetOGLLibrary() { return mOGLLibrary; }
    76 private:
    77     bool mInitialized;
    78     PRLibrary *mOGLLibrary;
    79     bool mHasRobustness;
    81     HWND mWindow;
    82     HDC mWindowDC;
    83     HGLRC mWindowGLContext;
    84     int mWindowPixelFormat;
    86 };
    88 // a global WGLLibrary instance
    89 extern WGLLibrary sWGLLibrary;
    91 } /* namespace gl */
    92 } /* namespace mozilla */

mercurial