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.
1 //
2 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
7 // RefCountObject.h: Defines the gl::RefCountObject base class that provides
8 // lifecycle support for GL objects using the traditional BindObject scheme, but
9 // that need to be reference counted for correct cross-context deletion.
10 // (Concretely, textures, buffers and renderbuffers.)
12 #ifndef COMMON_REFCOUNTOBJECT_H_
13 #define COMMON_REFCOUNTOBJECT_H_
15 #include <cstddef>
17 #define GL_APICALL
18 #include <GLES2/gl2.h>
20 #include "common/debug.h"
22 class RefCountObject
23 {
24 public:
25 explicit RefCountObject(GLuint id);
26 virtual ~RefCountObject();
28 virtual void addRef() const;
29 virtual void release() const;
31 GLuint id() const { return mId; }
33 private:
34 GLuint mId;
36 mutable std::size_t mRefCount;
37 };
39 class RefCountObjectBindingPointer
40 {
41 protected:
42 RefCountObjectBindingPointer() : mObject(NULL) { }
43 ~RefCountObjectBindingPointer() { ASSERT(mObject == NULL); } // Objects have to be released before the resource manager is destroyed, so they must be explicitly cleaned up.
45 void set(RefCountObject *newObject);
46 RefCountObject *get() const { return mObject; }
48 public:
49 GLuint id() const { return (mObject != NULL) ? mObject->id() : 0; }
50 bool operator ! () const { return (get() == NULL); }
52 private:
53 RefCountObject *mObject;
54 };
56 template <class ObjectType>
57 class BindingPointer : public RefCountObjectBindingPointer
58 {
59 public:
60 void set(ObjectType *newObject) { RefCountObjectBindingPointer::set(newObject); }
61 ObjectType *get() const { return static_cast<ObjectType*>(RefCountObjectBindingPointer::get()); }
62 ObjectType *operator -> () const { return get(); }
63 };
65 #endif // COMMON_REFCOUNTOBJECT_H_