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

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

Issue 642493003: Revert of Use presence of a content key as non-scratch indicator (Closed) Base URL: https://skia.googlesource.com/skia.git@pp
Patch Set: Created 6 years, 2 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/GrResourceCache.cpp ('k') | no next file » | 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 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 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 9
10 #include "GrResourceCache2.h" 10 #include "GrResourceCache2.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 class GrResourceCache2::AvailableForScratchUse { 60 class GrResourceCache2::AvailableForScratchUse {
61 public: 61 public:
62 AvailableForScratchUse(bool calledDuringFlush) : fFlushing(calledDuringFlush ) { } 62 AvailableForScratchUse(bool calledDuringFlush) : fFlushing(calledDuringFlush ) { }
63 63
64 bool operator()(const GrGpuResource* resource) const { 64 bool operator()(const GrGpuResource* resource) const {
65 if (fFlushing) { 65 if (fFlushing) {
66 // If this request is coming during draw buffer flush then no refs a re allowed 66 // If this request is coming during draw buffer flush then no refs a re allowed
67 // either by drawing code or for pending io operations. 67 // either by drawing code or for pending io operations.
68 // This will be removed when flush no longer creates resources. 68 // This will be removed when flush no longer creates resources.
69 return resource->reffedOnlyByCache() && !resource->internalHasPendin gIO() && 69 return resource->reffedOnlyByCache() && !resource->internalHasPendin gIO() &&
70 (NULL == resource->getContentKey()); 70 GrGpuResource::kYes_IsScratch == resource->fIsScratch;
71 } else { 71 } else {
72 // Because duties are currently shared between GrResourceCache and G rResourceCache2, the 72 // Because duties are currently shared between GrResourceCache and G rResourceCache2, the
73 // current interpretation of this rule is that only GrResourceCache has a ref but that 73 // current interpretation of this rule is that only GrResourceCache has a ref but that
74 // it has been marked as a scratch resource. 74 // it has been marked as a scratch resource.
75 return resource->reffedOnlyByCache() && (NULL == resource->getConten tKey()); 75 return resource->reffedOnlyByCache() &&
76 GrGpuResource::kYes_IsScratch == resource->fIsScratch;
76 } 77 }
77 } 78 }
78
79 private: 79 private:
80 bool fFlushing; 80 bool fFlushing;
81 }; 81 };
82 82
83 GrGpuResource* GrResourceCache2::findAndRefScratchResource(const GrResourceKey& scratchKey, 83 GrGpuResource* GrResourceCache2::findAndRefScratchResource(const GrResourceKey& scratchKey,
84 bool calledDuringFlus h) { 84 bool calledDuringFlus h) {
85 SkASSERT(scratchKey.isScratch()); 85 SkASSERT(scratchKey.isScratch());
86 return SkSafeRef(fScratchMap.find(scratchKey, AvailableForScratchUse(calledD uringFlush))); 86 return SkSafeRef(fScratchMap.find(scratchKey, AvailableForScratchUse(calledD uringFlush)));
87 } 87 }
OLDNEW
« no previous file with comments | « src/gpu/GrResourceCache.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698