OLD | NEW |
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 10 matching lines...) Expand all Loading... |
21 * states: | 21 * states: |
22 * 1. Owns a single ref | 22 * 1. Owns a single ref |
23 * 2. Owns a single ref and a pending IO operation (read, write, or rea
d-write) | 23 * 2. Owns a single ref and a pending IO operation (read, write, or rea
d-write) |
24 * 3. Owns a single pending IO operation. | 24 * 3. Owns a single pending IO operation. |
25 * | 25 * |
26 * It is legal to destroy the GrGpuResourceRef in any of these states. It starts
in state | 26 * It is legal to destroy the GrGpuResourceRef in any of these states. It starts
in state |
27 * 1. Calling markPendingIO() converts it from state 1 to state 2. Calling remov
eRef() goes from | 27 * 1. Calling markPendingIO() converts it from state 1 to state 2. Calling remov
eRef() goes from |
28 * state 2 to state 3. Calling pendingIOComplete() moves from state 2 to state 1
. There is no | 28 * state 2 to state 3. Calling pendingIOComplete() moves from state 2 to state 1
. There is no |
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 sk_sp, 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 ~GrGpuResourceRef(); | 39 ~GrGpuResourceRef(); |
40 | 40 |
41 GrGpuResource* getResource() const { return fResource; } | 41 GrGpuResource* getResource() const { return fResource; } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 fResource->completedRead(); | 204 fResource->completedRead(); |
205 fResource->completedWrite(); | 205 fResource->completedWrite(); |
206 break; | 206 break; |
207 } | 207 } |
208 } | 208 } |
209 } | 209 } |
210 | 210 |
211 T* fResource; | 211 T* fResource; |
212 }; | 212 }; |
213 #endif | 213 #endif |
OLD | NEW |