gfx/angle/src/common/angleutils.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 //
michael@0 2 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
michael@0 3 // Use of this source code is governed by a BSD-style license that can be
michael@0 4 // found in the LICENSE file.
michael@0 5 //
michael@0 6
michael@0 7 // angleutils.h: Common ANGLE utilities.
michael@0 8
michael@0 9 #ifndef COMMON_ANGLEUTILS_H_
michael@0 10 #define COMMON_ANGLEUTILS_H_
michael@0 11
michael@0 12 #include <stddef.h>
michael@0 13
michael@0 14 // A macro to disallow the copy constructor and operator= functions
michael@0 15 // This must be used in the private: declarations for a class
michael@0 16 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
michael@0 17 TypeName(const TypeName&); \
michael@0 18 void operator=(const TypeName&)
michael@0 19
michael@0 20 template <typename T, unsigned int N>
michael@0 21 inline unsigned int ArraySize(T(&)[N])
michael@0 22 {
michael@0 23 return N;
michael@0 24 }
michael@0 25
michael@0 26 template <typename T, unsigned int N>
michael@0 27 void SafeRelease(T (&resourceBlock)[N])
michael@0 28 {
michael@0 29 for (unsigned int i = 0; i < N; i++)
michael@0 30 {
michael@0 31 SafeRelease(resourceBlock[i]);
michael@0 32 }
michael@0 33 }
michael@0 34
michael@0 35 template <typename T>
michael@0 36 void SafeRelease(T& resource)
michael@0 37 {
michael@0 38 if (resource)
michael@0 39 {
michael@0 40 resource->Release();
michael@0 41 resource = NULL;
michael@0 42 }
michael@0 43 }
michael@0 44
michael@0 45 #if defined(_MSC_VER)
michael@0 46 #define snprintf _snprintf
michael@0 47 #endif
michael@0 48
michael@0 49 #define VENDOR_ID_AMD 0x1002
michael@0 50 #define VENDOR_ID_INTEL 0x8086
michael@0 51 #define VENDOR_ID_NVIDIA 0x10DE
michael@0 52
michael@0 53 #define GL_BGRA4_ANGLEX 0x6ABC
michael@0 54 #define GL_BGR5_A1_ANGLEX 0x6ABD
michael@0 55
michael@0 56 #endif // COMMON_ANGLEUTILS_H_

mercurial