gfx/gl/GLXLibrary.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 #ifndef GFX_GLXLIBRARY_H
     7 #define GFX_GLXLIBRARY_H
     9 #include "GLContextTypes.h"
    10 typedef realGLboolean GLboolean;
    12 // stuff from glx.h
    13 #include "X11/Xlib.h"
    14 typedef struct __GLXcontextRec *GLXContext;
    15 typedef XID GLXPixmap;
    16 typedef XID GLXDrawable;
    17 /* GLX 1.3 and later */
    18 typedef struct __GLXFBConfigRec *GLXFBConfig;
    19 typedef XID GLXFBConfigID;
    20 typedef XID GLXContextID;
    21 typedef XID GLXWindow;
    22 typedef XID GLXPbuffer;
    23 // end of stuff from glx.h
    25 struct PRLibrary;
    26 class gfxASurface;
    28 namespace mozilla {
    29 namespace gl {
    31 class GLXLibrary
    32 {
    33 public:
    34     GLXLibrary() : mInitialized(false), mTriedInitializing(false),
    35                    mUseTextureFromPixmap(false), mDebug(false),
    36                    mHasRobustness(false), mIsATI(false), mIsNVIDIA(false),
    37                    mClientIsMesa(false), mGLXMajorVersion(0),
    38                    mGLXMinorVersion(0),
    39                    mOGLLibrary(nullptr) {}
    41     void xDestroyContext(Display* display, GLXContext context);
    42     Bool xMakeCurrent(Display* display, 
    43                       GLXDrawable drawable, 
    44                       GLXContext context);
    46     GLXContext xGetCurrentContext();
    47     static void* xGetProcAddress(const char *procName);
    48     GLXFBConfig* xChooseFBConfig(Display* display, 
    49                                  int screen, 
    50                                  const int *attrib_list, 
    51                                  int *nelements);
    52     GLXFBConfig* xGetFBConfigs(Display* display, 
    53                                int screen, 
    54                                int *nelements);
    55     GLXContext xCreateNewContext(Display* display, 
    56                                  GLXFBConfig config, 
    57                                  int render_type, 
    58                                  GLXContext share_list, 
    59                                  Bool direct);
    60     int xGetFBConfigAttrib(Display *display,
    61                            GLXFBConfig config,
    62                            int attribute,
    63                            int *value);
    64     void xSwapBuffers(Display *display, GLXDrawable drawable);
    65     const char * xQueryExtensionsString(Display *display,
    66                                         int screen);
    67     const char * xGetClientString(Display *display,
    68                                   int screen);
    69     const char * xQueryServerString(Display *display,
    70                                     int screen, int name);
    71     GLXPixmap xCreatePixmap(Display *display, 
    72                             GLXFBConfig config,
    73                             Pixmap pixmap,
    74                             const int *attrib_list);
    75     GLXPixmap xCreateGLXPixmapWithConfig(Display *display,
    76                                          GLXFBConfig config,
    77                                          Pixmap pixmap);
    78     void xDestroyPixmap(Display *display, GLXPixmap pixmap);
    79     Bool xQueryVersion(Display *display,
    80                        int *major,
    81                        int *minor);
    82     void xBindTexImage(Display *display,
    83                        GLXDrawable drawable,
    84                        int buffer,
    85                        const int *attrib_list);
    86     void xReleaseTexImage(Display *display,
    87                           GLXDrawable drawable,
    88                           int buffer);
    89     void xWaitGL();
    90     void xWaitX();
    92     GLXContext xCreateContextAttribs(Display* display, 
    93                                      GLXFBConfig config, 
    94                                      GLXContext share_list, 
    95                                      Bool direct,
    96                                      const int* attrib_list);
    98     bool EnsureInitialized();
   100     GLXPixmap CreatePixmap(gfxASurface* aSurface);
   101     void DestroyPixmap(Display* aDisplay, GLXPixmap aPixmap);
   102     void BindTexImage(Display* aDisplay, GLXPixmap aPixmap);
   103     void ReleaseTexImage(Display* aDisplay, GLXPixmap aPixmap);
   104     void UpdateTexImage(Display* aDisplay, GLXPixmap aPixmap);
   106     bool UseTextureFromPixmap() { return mUseTextureFromPixmap; }
   107     bool HasRobustness() { return mHasRobustness; }
   108     bool SupportsTextureFromPixmap(gfxASurface* aSurface);
   109     bool IsATI() { return mIsATI; }
   110     bool GLXVersionCheck(int aMajor, int aMinor);
   112 private:
   114     typedef void (GLAPIENTRY * PFNGLXDESTROYCONTEXTPROC) (Display*,
   115                                                           GLXContext);
   116     PFNGLXDESTROYCONTEXTPROC xDestroyContextInternal;
   117     typedef Bool (GLAPIENTRY * PFNGLXMAKECURRENTPROC) (Display*,
   118                                                        GLXDrawable,
   119                                                        GLXContext);
   120     PFNGLXMAKECURRENTPROC xMakeCurrentInternal;
   121     typedef GLXContext (GLAPIENTRY * PFNGLXGETCURRENTCONTEXT) ();
   122     PFNGLXGETCURRENTCONTEXT xGetCurrentContextInternal;
   123     typedef void* (GLAPIENTRY * PFNGLXGETPROCADDRESSPROC) (const char *);
   124     PFNGLXGETPROCADDRESSPROC xGetProcAddressInternal;
   125     typedef GLXFBConfig* (GLAPIENTRY * PFNGLXCHOOSEFBCONFIG) (Display *,
   126                                                               int,
   127                                                               const int *,
   128                                                               int *);
   129     PFNGLXCHOOSEFBCONFIG xChooseFBConfigInternal;
   130     typedef GLXFBConfig* (GLAPIENTRY * PFNGLXGETFBCONFIGS) (Display *,
   131                                                             int,
   132                                                             int *);
   133     PFNGLXGETFBCONFIGS xGetFBConfigsInternal;
   134     typedef GLXContext (GLAPIENTRY * PFNGLXCREATENEWCONTEXT) (Display *,
   135                                                               GLXFBConfig,
   136                                                               int,
   137                                                               GLXContext,
   138                                                               Bool);
   139     PFNGLXCREATENEWCONTEXT xCreateNewContextInternal;
   140     typedef int (GLAPIENTRY * PFNGLXGETFBCONFIGATTRIB) (Display *, 
   141                                                         GLXFBConfig,
   142                                                         int,
   143                                                         int *);
   144     PFNGLXGETFBCONFIGATTRIB xGetFBConfigAttribInternal;
   146     typedef void (GLAPIENTRY * PFNGLXSWAPBUFFERS) (Display *,
   147                                                    GLXDrawable);
   148     PFNGLXSWAPBUFFERS xSwapBuffersInternal;
   149     typedef const char * (GLAPIENTRY * PFNGLXQUERYEXTENSIONSSTRING) (Display *,
   150                                                                      int);
   151     PFNGLXQUERYEXTENSIONSSTRING xQueryExtensionsStringInternal;
   152     typedef const char * (GLAPIENTRY * PFNGLXGETCLIENTSTRING) (Display *,
   153                                                                int);
   154     PFNGLXGETCLIENTSTRING xGetClientStringInternal;
   155     typedef const char * (GLAPIENTRY * PFNGLXQUERYSERVERSTRING) (Display *,
   156                                                                  int,
   157                                                                  int);
   158     PFNGLXQUERYSERVERSTRING xQueryServerStringInternal;
   160     typedef GLXPixmap (GLAPIENTRY * PFNGLXCREATEPIXMAP) (Display *,
   161                                                          GLXFBConfig,
   162                                                          Pixmap,
   163                                                          const int *);
   164     PFNGLXCREATEPIXMAP xCreatePixmapInternal;
   165     typedef GLXPixmap (GLAPIENTRY * PFNGLXCREATEGLXPIXMAPWITHCONFIG)
   166                                                         (Display *,
   167                                                          GLXFBConfig,
   168                                                          Pixmap);
   169     PFNGLXCREATEGLXPIXMAPWITHCONFIG xCreateGLXPixmapWithConfigInternal;
   170     typedef void (GLAPIENTRY * PFNGLXDESTROYPIXMAP) (Display *,
   171                                                      GLXPixmap);
   172     PFNGLXDESTROYPIXMAP xDestroyPixmapInternal;
   173     typedef Bool (GLAPIENTRY * PFNGLXQUERYVERSION) (Display *,
   174                                                     int *,
   175                                                     int *);
   176     PFNGLXQUERYVERSION xQueryVersionInternal;
   178     typedef void (GLAPIENTRY * PFNGLXBINDTEXIMAGE) (Display *,
   179                                                     GLXDrawable,
   180                                                     int,
   181                                                     const int *);
   182     PFNGLXBINDTEXIMAGE xBindTexImageInternal;
   184     typedef void (GLAPIENTRY * PFNGLXRELEASETEXIMAGE) (Display *,
   185                                                        GLXDrawable,
   186                                                        int);
   187     PFNGLXRELEASETEXIMAGE xReleaseTexImageInternal;
   189     typedef void (GLAPIENTRY * PFNGLXWAITGL) ();
   190     PFNGLXWAITGL xWaitGLInternal;
   192     typedef void (GLAPIENTRY * PFNGLXWAITX) ();
   193     PFNGLXWAITGL xWaitXInternal;
   195     typedef GLXContext (GLAPIENTRY * PFNGLXCREATECONTEXTATTRIBS) (Display *,
   196                                                                   GLXFBConfig,
   197                                                                   GLXContext,
   198                                                                   Bool,
   199                                                                   const int *);
   200     PFNGLXCREATECONTEXTATTRIBS xCreateContextAttribsInternal;
   202 #ifdef DEBUG
   203     void BeforeGLXCall();
   204     void AfterGLXCall();
   205 #endif
   207     bool mInitialized;
   208     bool mTriedInitializing;
   209     bool mUseTextureFromPixmap;
   210     bool mDebug;
   211     bool mHasRobustness;
   212     bool mIsATI;
   213     bool mIsNVIDIA;
   214     bool mClientIsMesa;
   215     int mGLXMajorVersion;
   216     int mGLXMinorVersion;
   217     PRLibrary *mOGLLibrary;
   218 };
   220 // a global GLXLibrary instance
   221 extern GLXLibrary sGLXLibrary;
   223 } /* namespace gl */
   224 } /* namespace mozilla */
   225 #endif /* GFX_GLXLIBRARY_H */

mercurial