Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: src/gpu/GrResource.cpp

Issue 251013002: Split GrResource into GrCacheable/GrGpuObject (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrRenderTarget.cpp ('k') | src/gpu/GrResourceCache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1
2 /*
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.
7 */
8
9
10 #include "GrResource.h"
11 #include "GrGpu.h"
12
13 GrResource::GrResource(GrGpu* gpu, bool isWrapped) {
14 fGpu = gpu;
15 fCacheEntry = NULL;
16 fDeferredRefCount = 0;
17 if (isWrapped) {
18 fFlags = kWrapped_FlagBit;
19 } else {
20 fFlags = 0;
21 }
22 fGpu->insertResource(this);
23 }
24
25 GrResource::~GrResource() {
26 // subclass should have released this.
27 SkASSERT(0 == fDeferredRefCount);
28 SkASSERT(!this->isValid());
29 }
30
31 void GrResource::release() {
32 if (NULL != fGpu) {
33 this->onRelease();
34 fGpu->removeResource(this);
35 fGpu = NULL;
36 }
37 }
38
39 void GrResource::abandon() {
40 if (NULL != fGpu) {
41 this->onAbandon();
42 fGpu->removeResource(this);
43 fGpu = NULL;
44 }
45 }
46
47 const GrContext* GrResource::getContext() const {
48 if (NULL != fGpu) {
49 return fGpu->getContext();
50 } else {
51 return NULL;
52 }
53 }
54
55 GrContext* GrResource::getContext() {
56 if (NULL != fGpu) {
57 return fGpu->getContext();
58 } else {
59 return NULL;
60 }
61 }
OLDNEW
« no previous file with comments | « src/gpu/GrRenderTarget.cpp ('k') | src/gpu/GrResourceCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698