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.
7
// RefCountObject.cpp: 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
#include "RefCountObject.h"
14
RefCountObject::RefCountObject(GLuint id)
20
RefCountObject::~RefCountObject()
22
ASSERT(mRefCount == 0);
25
void RefCountObject::addRef() const
30
void RefCountObject::release() const
32
ASSERT(mRefCount > 0);
40
void RefCountObjectBindingPointer::set(RefCountObject *newObject)
42
// addRef first in case newObject == mObject and this is the last reference to it.
43
if (newObject != NULL) newObject->addRef();
44
if (mObject != NULL) mObject->release();