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

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

Issue 542723004: Make GrDrawState and GrEffectStage use the pending io/exec ref mechanisms. (Closed) Base URL: https://skia.googlesource.com/skia.git@complete
Patch Set: rebase again Created 6 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 | « include/gpu/GrEffectStage.h ('k') | include/gpu/GrTextureAccess.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 GrProgramElementRef_DEFINED 8 #ifndef GrProgramElementRef_DEFINED
9 #define GrProgramElementRef_DEFINED 9 #define GrProgramElementRef_DEFINED
10 10
(...skipping 24 matching lines...) Expand all
35 void convertToPendingExec() { 35 void convertToPendingExec() {
36 SkASSERT(!fOwnPendingExec); 36 SkASSERT(!fOwnPendingExec);
37 fObj->convertRefToPendingExecution(); 37 fObj->convertRefToPendingExecution();
38 fOwnPendingExec = true; 38 fOwnPendingExec = true;
39 } 39 }
40 40
41 T* get() const { return fObj; } 41 T* get() const { return fObj; }
42 operator T*() { return fObj; } 42 operator T*() { return fObj; }
43 43
44 /** If T is const, the type returned from operator-> will also be const. */ 44 /** If T is const, the type returned from operator-> will also be const. */
45 typedef typename SkTConstType<typename SkAutoTUnref<T>::BlockRef<T>, 45 typedef typename SkTConstType<typename SkAutoTUnref<T>::template BlockRef<T> ,
46 SkTIsConst<T>::value>::type BlockRefType; 46 SkTIsConst<T>::value>::type BlockRefType;
47 47
48 /** 48 /**
49 * GrProgramElementRef assumes ownership of the ref and manages converting t he ref to a 49 * GrProgramElementRef assumes ownership of the ref and manages converting t he ref to a
50 * pending execution. As a result, it is an error for the user to ref or unr ef through 50 * pending execution. As a result, it is an error for the user to ref or unr ef through
51 * GrProgramElementRef. Therefore operator-> returns BlockRef<T>*. 51 * GrProgramElementRef. Therefore operator-> returns BlockRef<T>*.
52 */ 52 */
53 BlockRefType *operator->() const { 53 BlockRefType *operator->() const {
54 return static_cast<BlockRefType*>(fObj); 54 return static_cast<BlockRefType*>(fObj);
55 } 55 }
56 56
57 ~GrProgramElementRef() { 57 ~GrProgramElementRef() {
58 if (fObj) { 58 if (fObj) {
59 if (fOwnPendingExec) { 59 if (fOwnPendingExec) {
60 fObj->completedExecution(); 60 fObj->completedExecution();
61 } else { 61 } else {
62 fObj->unref(); 62 fObj->unref();
63 } 63 }
64 } 64 }
65 } 65 }
66 66
67 private: 67 private:
68 bool fOwnPendingExec; 68 bool fOwnPendingExec;
69 T* fObj; 69 T* fObj;
70 70
71 typedef SkNoncopyable INHERITED; 71 typedef SkNoncopyable INHERITED;
72 }; 72 };
73 #endif 73 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrEffectStage.h ('k') | include/gpu/GrTextureAccess.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698