3 * Copyright 2011 Google Inc.
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
10 #include "GrResource.h"
13 GrResource::GrResource(GrGpu* gpu, bool isWrapped) {
16 fDeferredRefCount = 0;
18 fFlags = kWrapped_FlagBit;
22 fGpu->insertResource(this);
25 GrResource::~GrResource() {
26 // subclass should have released this.
27 SkASSERT(0 == fDeferredRefCount);
28 SkASSERT(!this->isValid());
31 void GrResource::release() {
34 fGpu->removeResource(this);
39 void GrResource::abandon() {
42 fGpu->removeResource(this);
47 const GrContext* GrResource::getContext() const {
49 return fGpu->getContext();
55 GrContext* GrResource::getContext() {
57 return fGpu->getContext();