epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame^] | 1 | |
bsalomon@google.com | 8fe7247 | 2011-03-30 21:26:44 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame^] | 3 | * 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.com | 8fe7247 | 2011-03-30 21:26:44 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame^] | 9 | |
bsalomon@google.com | 8fe7247 | 2011-03-30 21:26:44 +0000 | [diff] [blame] | 10 | #include "GrResource.h" |
| 11 | #include "GrGpu.h" |
| 12 | |
| 13 | GrResource::GrResource(GrGpu* gpu) { |
| 14 | fGpu = gpu; |
| 15 | fNext = NULL; |
| 16 | fPrevious = NULL; |
| 17 | fGpu->insertResource(this); |
| 18 | } |
| 19 | |
| 20 | void GrResource::release() { |
| 21 | if (NULL != fGpu) { |
| 22 | this->onRelease(); |
| 23 | fGpu->removeResource(this); |
| 24 | fGpu = NULL; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | void GrResource::abandon() { |
| 29 | if (NULL != fGpu) { |
| 30 | this->onAbandon(); |
| 31 | fGpu->removeResource(this); |
| 32 | fGpu = NULL; |
| 33 | } |
| 34 | } |