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

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

Issue 418143004: Rename GrGpuObject to GrGpuResource (Closed) Base URL: https://skia.googlesource.com/skia.git@compact
Patch Set: Fix indents Created 6 years, 4 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
« no previous file with comments | « src/gpu/GrGpuObject.cpp ('k') | src/gpu/GrPath.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "GrGpuObject.h" 10 #include "GrGpuResource.h"
11 #include "GrGpu.h" 11 #include "GrGpu.h"
12 12
13 GrGpuObject::GrGpuObject(GrGpu* gpu, bool isWrapped) 13 GrGpuResource::GrGpuResource(GrGpu* gpu, bool isWrapped)
14 : fRefCnt(1) 14 : fRefCnt(1)
15 , fCacheEntry(NULL) 15 , fCacheEntry(NULL)
16 , fUniqueID(CreateUniqueID()) { 16 , fUniqueID(CreateUniqueID()) {
17 fGpu = gpu; 17 fGpu = gpu;
18 if (isWrapped) { 18 if (isWrapped) {
19 fFlags = kWrapped_FlagBit; 19 fFlags = kWrapped_FlagBit;
20 } else { 20 } else {
21 fFlags = 0; 21 fFlags = 0;
22 } 22 }
23 fGpu->insertObject(this); 23 fGpu->insertObject(this);
24 } 24 }
25 25
26 GrGpuObject::~GrGpuObject() { 26 GrGpuResource::~GrGpuResource() {
27 SkASSERT(0 == fRefCnt); 27 SkASSERT(0 == fRefCnt);
28 // subclass should have released this. 28 // subclass should have released this.
29 SkASSERT(this->wasDestroyed()); 29 SkASSERT(this->wasDestroyed());
30 } 30 }
31 31
32 void GrGpuObject::release() { 32 void GrGpuResource::release() {
33 if (NULL != fGpu) { 33 if (NULL != fGpu) {
34 this->onRelease(); 34 this->onRelease();
35 fGpu->removeObject(this); 35 fGpu->removeObject(this);
36 fGpu = NULL; 36 fGpu = NULL;
37 } 37 }
38 } 38 }
39 39
40 void GrGpuObject::abandon() { 40 void GrGpuResource::abandon() {
41 if (NULL != fGpu) { 41 if (NULL != fGpu) {
42 this->onAbandon(); 42 this->onAbandon();
43 fGpu->removeObject(this); 43 fGpu->removeObject(this);
44 fGpu = NULL; 44 fGpu = NULL;
45 } 45 }
46 } 46 }
47 47
48 const GrContext* GrGpuObject::getContext() const { 48 const GrContext* GrGpuResource::getContext() const {
49 if (NULL != fGpu) { 49 if (NULL != fGpu) {
50 return fGpu->getContext(); 50 return fGpu->getContext();
51 } else { 51 } else {
52 return NULL; 52 return NULL;
53 } 53 }
54 } 54 }
55 55
56 GrContext* GrGpuObject::getContext() { 56 GrContext* GrGpuResource::getContext() {
57 if (NULL != fGpu) { 57 if (NULL != fGpu) {
58 return fGpu->getContext(); 58 return fGpu->getContext();
59 } else { 59 } else {
60 return NULL; 60 return NULL;
61 } 61 }
62 } 62 }
63 63
64 uint32_t GrGpuObject::CreateUniqueID() { 64 uint32_t GrGpuResource::CreateUniqueID() {
65 static int32_t gUniqueID = SK_InvalidUniqueID; 65 static int32_t gUniqueID = SK_InvalidUniqueID;
66 uint32_t id; 66 uint32_t id;
67 do { 67 do {
68 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); 68 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1);
69 } while (id == SK_InvalidUniqueID); 69 } while (id == SK_InvalidUniqueID);
70 return id; 70 return id;
71 } 71 }
OLDNEW
« no previous file with comments | « src/gpu/GrGpuObject.cpp ('k') | src/gpu/GrPath.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698