blob: 5d7375ffb9efc10de81999eae48eacd7d5aa469f [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
bsalomon@google.com8fe72472011-03-30 21:26:44 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2011 Google Inc.
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
bsalomon@google.com8fe72472011-03-30 21:26:44 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
bsalomon@google.com8fe72472011-03-30 21:26:44 +000010#include "GrResource.h"
11#include "GrGpu.h"
12
13GrResource::GrResource(GrGpu* gpu) {
14 fGpu = gpu;
15 fNext = NULL;
16 fPrevious = NULL;
17 fGpu->insertResource(this);
18}
19
20void GrResource::release() {
21 if (NULL != fGpu) {
22 this->onRelease();
23 fGpu->removeResource(this);
24 fGpu = NULL;
25 }
26}
27
28void GrResource::abandon() {
29 if (NULL != fGpu) {
30 this->onAbandon();
31 fGpu->removeResource(this);
32 fGpu = NULL;
33 }
34}