gfx/gl/GLLibraryLoader.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 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef GLLIBRARYLOADER_H_
     6 #define GLLIBRARYLOADER_H_
     8 #include <stdio.h>
    10 #ifdef WIN32
    11 #include <windows.h>
    12 #endif
    14 #include "GLDefs.h"
    15 #include "nscore.h"
    16 #include "prlink.h"
    18 namespace mozilla {
    19 namespace gl {
    21 class GLLibraryLoader
    22 {
    23 public:
    24     bool OpenLibrary(const char *library);
    26     typedef PRFuncPtr (GLAPIENTRY * PlatformLookupFunction) (const char *);
    28     enum {
    29         MAX_SYMBOL_NAMES = 6,
    30         MAX_SYMBOL_LENGTH = 128
    31     };
    33     typedef struct {
    34         PRFuncPtr *symPointer;
    35         const char *symNames[MAX_SYMBOL_NAMES];
    36     } SymLoadStruct;
    38     bool LoadSymbols(SymLoadStruct *firstStruct,
    39                      bool tryplatform = false,
    40                      const char *prefix = nullptr,
    41                      bool warnOnFailure = true);
    43     /*
    44      * Static version of the functions in this class
    45      */
    46     static PRFuncPtr LookupSymbol(PRLibrary *lib,
    47                                   const char *symname,
    48                                   PlatformLookupFunction lookupFunction = nullptr);
    49     static bool LoadSymbols(PRLibrary *lib,
    50                             SymLoadStruct *firstStruct,
    51                             PlatformLookupFunction lookupFunction = nullptr,
    52                             const char *prefix = nullptr,
    53                             bool warnOnFailure = true);
    54 protected:
    55     GLLibraryLoader() {
    56         mLibrary = nullptr;
    57         mLookupFunc = nullptr;
    58     }
    60     PRLibrary *mLibrary;
    61     PlatformLookupFunction mLookupFunc;
    62 };
    64 } /* namespace gl */
    65 } /* namespace mozilla */
    67 #endif /* GLLIBRARYLOADER_H_ */

mercurial