gfx/angle/src/common/RefCountObject.cpp

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 #include "precompiled.h"
michael@0 2 //
michael@0 3 // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
michael@0 4 // Use of this source code is governed by a BSD-style license that can be
michael@0 5 // found in the LICENSE file.
michael@0 6 //
michael@0 7
michael@0 8 // RefCountObject.cpp: Defines the gl::RefCountObject base class that provides
michael@0 9 // lifecycle support for GL objects using the traditional BindObject scheme, but
michael@0 10 // that need to be reference counted for correct cross-context deletion.
michael@0 11 // (Concretely, textures, buffers and renderbuffers.)
michael@0 12
michael@0 13 #include "RefCountObject.h"
michael@0 14
michael@0 15 RefCountObject::RefCountObject(GLuint id)
michael@0 16 {
michael@0 17 mId = id;
michael@0 18 mRefCount = 0;
michael@0 19 }
michael@0 20
michael@0 21 RefCountObject::~RefCountObject()
michael@0 22 {
michael@0 23 ASSERT(mRefCount == 0);
michael@0 24 }
michael@0 25
michael@0 26 void RefCountObject::addRef() const
michael@0 27 {
michael@0 28 mRefCount++;
michael@0 29 }
michael@0 30
michael@0 31 void RefCountObject::release() const
michael@0 32 {
michael@0 33 ASSERT(mRefCount > 0);
michael@0 34
michael@0 35 if (--mRefCount == 0)
michael@0 36 {
michael@0 37 delete this;
michael@0 38 }
michael@0 39 }
michael@0 40
michael@0 41 void RefCountObjectBindingPointer::set(RefCountObject *newObject)
michael@0 42 {
michael@0 43 // addRef first in case newObject == mObject and this is the last reference to it.
michael@0 44 if (newObject != NULL) newObject->addRef();
michael@0 45 if (mObject != NULL) mObject->release();
michael@0 46
michael@0 47 mObject = newObject;
michael@0 48 }

mercurial