Sat, 03 Jan 2015 20:18:00 +0100
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 | // RefCountObject.h: Defines the gl::RefCountObject base class that provides |
michael@0 | 8 | // lifecycle support for GL objects using the traditional BindObject scheme, but |
michael@0 | 9 | // that need to be reference counted for correct cross-context deletion. |
michael@0 | 10 | // (Concretely, textures, buffers and renderbuffers.) |
michael@0 | 11 | |
michael@0 | 12 | #ifndef COMMON_REFCOUNTOBJECT_H_ |
michael@0 | 13 | #define COMMON_REFCOUNTOBJECT_H_ |
michael@0 | 14 | |
michael@0 | 15 | #include <cstddef> |
michael@0 | 16 | |
michael@0 | 17 | #define GL_APICALL |
michael@0 | 18 | #include <GLES2/gl2.h> |
michael@0 | 19 | |
michael@0 | 20 | #include "common/debug.h" |
michael@0 | 21 | |
michael@0 | 22 | class RefCountObject |
michael@0 | 23 | { |
michael@0 | 24 | public: |
michael@0 | 25 | explicit RefCountObject(GLuint id); |
michael@0 | 26 | virtual ~RefCountObject(); |
michael@0 | 27 | |
michael@0 | 28 | virtual void addRef() const; |
michael@0 | 29 | virtual void release() const; |
michael@0 | 30 | |
michael@0 | 31 | GLuint id() const { return mId; } |
michael@0 | 32 | |
michael@0 | 33 | private: |
michael@0 | 34 | GLuint mId; |
michael@0 | 35 | |
michael@0 | 36 | mutable std::size_t mRefCount; |
michael@0 | 37 | }; |
michael@0 | 38 | |
michael@0 | 39 | class RefCountObjectBindingPointer |
michael@0 | 40 | { |
michael@0 | 41 | protected: |
michael@0 | 42 | RefCountObjectBindingPointer() : mObject(NULL) { } |
michael@0 | 43 | ~RefCountObjectBindingPointer() { ASSERT(mObject == NULL); } // Objects have to be released before the resource manager is destroyed, so they must be explicitly cleaned up. |
michael@0 | 44 | |
michael@0 | 45 | void set(RefCountObject *newObject); |
michael@0 | 46 | RefCountObject *get() const { return mObject; } |
michael@0 | 47 | |
michael@0 | 48 | public: |
michael@0 | 49 | GLuint id() const { return (mObject != NULL) ? mObject->id() : 0; } |
michael@0 | 50 | bool operator ! () const { return (get() == NULL); } |
michael@0 | 51 | |
michael@0 | 52 | private: |
michael@0 | 53 | RefCountObject *mObject; |
michael@0 | 54 | }; |
michael@0 | 55 | |
michael@0 | 56 | template <class ObjectType> |
michael@0 | 57 | class BindingPointer : public RefCountObjectBindingPointer |
michael@0 | 58 | { |
michael@0 | 59 | public: |
michael@0 | 60 | void set(ObjectType *newObject) { RefCountObjectBindingPointer::set(newObject); } |
michael@0 | 61 | ObjectType *get() const { return static_cast<ObjectType*>(RefCountObjectBindingPointer::get()); } |
michael@0 | 62 | ObjectType *operator -> () const { return get(); } |
michael@0 | 63 | }; |
michael@0 | 64 | |
michael@0 | 65 | #endif // COMMON_REFCOUNTOBJECT_H_ |