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

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

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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/GrGpuResource.cpp ('k') | src/gpu/GrInOrderCommandBuilder.cpp » ('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 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrGpuResourceRef.h" 8 #include "GrGpuResourceRef.h"
9 9
10 GrGpuResourceRef::GrGpuResourceRef() { 10 GrGpuResourceRef::GrGpuResourceRef() {
11 fResource = NULL; 11 fResource = nullptr;
12 fOwnRef = false; 12 fOwnRef = false;
13 fPendingIO = false; 13 fPendingIO = false;
14 } 14 }
15 15
16 GrGpuResourceRef::GrGpuResourceRef(GrGpuResource* resource, GrIOType ioType) { 16 GrGpuResourceRef::GrGpuResourceRef(GrGpuResource* resource, GrIOType ioType) {
17 fResource = NULL; 17 fResource = nullptr;
18 fOwnRef = false; 18 fOwnRef = false;
19 fPendingIO = false; 19 fPendingIO = false;
20 this->setResource(resource, ioType); 20 this->setResource(resource, ioType);
21 } 21 }
22 22
23 GrGpuResourceRef::~GrGpuResourceRef() { 23 GrGpuResourceRef::~GrGpuResourceRef() {
24 if (fOwnRef) { 24 if (fOwnRef) {
25 SkASSERT(fResource); 25 SkASSERT(fResource);
26 fResource->unref(); 26 fResource->unref();
27 } 27 }
(...skipping 12 matching lines...) Expand all
40 } 40 }
41 } 41 }
42 } 42 }
43 43
44 void GrGpuResourceRef::reset() { 44 void GrGpuResourceRef::reset() {
45 SkASSERT(!fPendingIO); 45 SkASSERT(!fPendingIO);
46 SkASSERT(SkToBool(fResource) == fOwnRef); 46 SkASSERT(SkToBool(fResource) == fOwnRef);
47 if (fOwnRef) { 47 if (fOwnRef) {
48 fResource->unref(); 48 fResource->unref();
49 fOwnRef = false; 49 fOwnRef = false;
50 fResource = NULL; 50 fResource = nullptr;
51 } 51 }
52 } 52 }
53 53
54 void GrGpuResourceRef::setResource(GrGpuResource* resource, GrIOType ioType) { 54 void GrGpuResourceRef::setResource(GrGpuResource* resource, GrIOType ioType) {
55 SkASSERT(!fPendingIO); 55 SkASSERT(!fPendingIO);
56 SkASSERT(SkToBool(fResource) == fOwnRef); 56 SkASSERT(SkToBool(fResource) == fOwnRef);
57 SkSafeUnref(fResource); 57 SkSafeUnref(fResource);
58 if (NULL == resource) { 58 if (nullptr == resource) {
59 fResource = NULL; 59 fResource = nullptr;
60 fOwnRef = false; 60 fOwnRef = false;
61 } else { 61 } else {
62 fResource = resource; 62 fResource = resource;
63 fOwnRef = true; 63 fOwnRef = true;
64 fIOType = ioType; 64 fIOType = ioType;
65 } 65 }
66 } 66 }
67 67
68 void GrGpuResourceRef::markPendingIO() const { 68 void GrGpuResourceRef::markPendingIO() const {
69 // This should only be called when the owning GrProgramElement gets its firs t 69 // This should only be called when the owning GrProgramElement gets its firs t
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 void GrGpuResourceRef::removeRef() const { 109 void GrGpuResourceRef::removeRef() const {
110 // This should only be called once, when the owners last ref goes away and 110 // This should only be called once, when the owners last ref goes away and
111 // there is a pending execution. 111 // there is a pending execution.
112 SkASSERT(fOwnRef); 112 SkASSERT(fOwnRef);
113 SkASSERT(fPendingIO); 113 SkASSERT(fPendingIO);
114 SkASSERT(fResource); 114 SkASSERT(fResource);
115 fResource->unref(); 115 fResource->unref();
116 fOwnRef = false; 116 fOwnRef = false;
117 } 117 }
OLDNEW
« no previous file with comments | « src/gpu/GrGpuResource.cpp ('k') | src/gpu/GrInOrderCommandBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698