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

Side by Side Diff: include/gpu/GrGpuResourceRef.h

Issue 841263004: Simplify SkInstCnt (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: T:: Created 5 years, 11 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 | « include/gpu/GrGpuResource.h ('k') | include/gpu/GrProgramElement.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 * 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 #ifndef GrGpuResourceRef_DEFINED 8 #ifndef GrGpuResourceRef_DEFINED
9 #define GrGpuResourceRef_DEFINED 9 #define GrGpuResourceRef_DEFINED
10 10
(...skipping 18 matching lines...) Expand all
29 * valid way of going from state 3 back to 2 or 1. 29 * valid way of going from state 3 back to 2 or 1.
30 * 30 *
31 * Like SkAutoTUnref, its constructor and setter adopt a ref from their caller. 31 * Like SkAutoTUnref, its constructor and setter adopt a ref from their caller.
32 * 32 *
33 * TODO: Once GrDODrawState no longer exists and therefore GrDrawState and GrOpt DrawState no 33 * TODO: Once GrDODrawState no longer exists and therefore GrDrawState and GrOpt DrawState no
34 * longer share an instance of this class, attempt to make the resource owned by GrGpuResourceRef 34 * longer share an instance of this class, attempt to make the resource owned by GrGpuResourceRef
35 * only settable via the constructor. 35 * only settable via the constructor.
36 */ 36 */
37 class GrGpuResourceRef : SkNoncopyable { 37 class GrGpuResourceRef : SkNoncopyable {
38 public: 38 public:
39 SK_DECLARE_INST_COUNT_ROOT(GrGpuResourceRef); 39 SK_DECLARE_INST_COUNT(GrGpuResourceRef);
40 40
41 ~GrGpuResourceRef(); 41 ~GrGpuResourceRef();
42 42
43 GrGpuResource* getResource() const { return fResource; } 43 GrGpuResource* getResource() const { return fResource; }
44 44
45 /** Does this object own a pending read or write on the resource it is wrapp ing. */ 45 /** Does this object own a pending read or write on the resource it is wrapp ing. */
46 bool ownsPendingIO() const { return fPendingIO; } 46 bool ownsPendingIO() const { return fPendingIO; }
47 47
48 /** Shortcut for calling setResource() with NULL. It cannot be called after markingPendingIO 48 /** Shortcut for calling setResource() with NULL. It cannot be called after markingPendingIO
49 is called. */ 49 is called. */
(...skipping 30 matching lines...) Expand all
80 friend class GrProgramElement; 80 friend class GrProgramElement;
81 81
82 GrGpuResource* fResource; 82 GrGpuResource* fResource;
83 mutable bool fOwnRef; 83 mutable bool fOwnRef;
84 mutable bool fPendingIO; 84 mutable bool fPendingIO;
85 GrIOType fIOType; 85 GrIOType fIOType;
86 86
87 typedef SkNoncopyable INHERITED; 87 typedef SkNoncopyable INHERITED;
88 }; 88 };
89 89
90 /** 90 /**
91 * Templated version of GrGpuResourceRef to enforce type safety. 91 * Templated version of GrGpuResourceRef to enforce type safety.
92 */ 92 */
93 template <typename T> class GrTGpuResourceRef : public GrGpuResourceRef { 93 template <typename T> class GrTGpuResourceRef : public GrGpuResourceRef {
94 public: 94 public:
95 GrTGpuResourceRef() {} 95 GrTGpuResourceRef() {}
96 96
97 /** Adopts a ref from the caller. ioType expresses what type of IO operation s will be marked as 97 /** Adopts a ref from the caller. ioType expresses what type of IO operation s will be marked as
98 pending on the resource when markPendingIO is called. */ 98 pending on the resource when markPendingIO is called. */
99 GrTGpuResourceRef(T* resource, GrIOType ioType) : INHERITED(resource, ioType ) { } 99 GrTGpuResourceRef(T* resource, GrIOType ioType) : INHERITED(resource, ioType ) { }
100 100
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 fResource->completedRead(); 202 fResource->completedRead();
203 fResource->completedWrite(); 203 fResource->completedWrite();
204 break; 204 break;
205 } 205 }
206 } 206 }
207 } 207 }
208 208
209 T* fResource; 209 T* fResource;
210 }; 210 };
211 #endif 211 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrGpuResource.h ('k') | include/gpu/GrProgramElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698