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

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

Issue 848903004: Require budget decision when creating a RenderTarget SkSurface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make compatible with chrome 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
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
10 #include "GrGpuResource.h" 9 #include "GrGpuResource.h"
11 #include "GrResourceCache2.h" 10 #include "GrResourceCache2.h"
12 #include "GrGpu.h" 11 #include "GrGpu.h"
13 12
14 static inline GrResourceCache2* get_resource_cache2(GrGpu* gpu) { 13 static inline GrResourceCache2* get_resource_cache2(GrGpu* gpu) {
15 SkASSERT(gpu); 14 SkASSERT(gpu);
16 SkASSERT(gpu->getContext()); 15 SkASSERT(gpu->getContext());
17 SkASSERT(gpu->getContext()->getResourceCache2()); 16 SkASSERT(gpu->getContext()->getResourceCache2());
18 return gpu->getContext()->getResourceCache2(); 17 return gpu->getContext()->getResourceCache2();
19 } 18 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 fScratchKey = scratchKey; 126 fScratchKey = scratchKey;
128 } 127 }
129 128
130 void GrGpuResource::removeScratchKey() { 129 void GrGpuResource::removeScratchKey() {
131 if (!this->wasDestroyed() && fScratchKey.isValid()) { 130 if (!this->wasDestroyed() && fScratchKey.isValid()) {
132 get_resource_cache2(fGpu)->resourceAccess().willRemoveScratchKey(this); 131 get_resource_cache2(fGpu)->resourceAccess().willRemoveScratchKey(this);
133 fScratchKey.reset(); 132 fScratchKey.reset();
134 } 133 }
135 } 134 }
136 135
136 void GrGpuResource::makeBudgeted() {
robertphillips 2015/01/15 20:48:17 Should we add an assert that we're not trying to m
bsalomon 2015/01/15 21:14:05 Seems ok to just ignore the request to me...
137 if (GrGpuResource::kUncached_LifeCycle == fLifeCycle) {
138 fLifeCycle = kCached_LifeCycle;
139 get_resource_cache2(fGpu)->resourceAccess().didChangeBudgetStatus(this);
140 }
141 }
142
137 uint32_t GrGpuResource::CreateUniqueID() { 143 uint32_t GrGpuResource::CreateUniqueID() {
138 static int32_t gUniqueID = SK_InvalidUniqueID; 144 static int32_t gUniqueID = SK_InvalidUniqueID;
139 uint32_t id; 145 uint32_t id;
140 do { 146 do {
141 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1); 147 id = static_cast<uint32_t>(sk_atomic_inc(&gUniqueID) + 1);
142 } while (id == SK_InvalidUniqueID); 148 } while (id == SK_InvalidUniqueID);
143 return id; 149 return id;
144 } 150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698