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

Unified Diff: src/gpu/GrContext.cpp

Issue 2307053002: Restructure flushing relationship between GrContext, GrDrawingManager, and GrResourceCache. (Closed)
Patch Set: cleanup Created 4 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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 015776099038649fd1134e0974329ec17028a2c1..a5007ed4f366035a680ab71c22e7683fd1c09a39 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -87,7 +87,6 @@ void GrContext::initCommon(const GrContextOptions& options) {
fCaps = SkRef(fGpu->caps());
fResourceCache = new GrResourceCache(fCaps);
- fResourceCache->setOverBudgetCallback(OverBudgetCB, this);
fResourceProvider = new GrResourceProvider(fGpu, fResourceCache, &fSingleOwner);
fDidTestPMConversions = false;
@@ -203,41 +202,21 @@ void GrContext::getResourceCacheUsage(int* resourceCount, size_t* resourceBytes)
////////////////////////////////////////////////////////////////////////////////
-void GrContext::OverBudgetCB(void* data) {
- SkASSERT(data);
-
- GrContext* context = reinterpret_cast<GrContext*>(data);
-
- // Flush the GrBufferedDrawTarget to possibly free up some textures
- context->fFlushToReduceCacheSize = true;
-}
-
void GrContext::TextBlobCacheOverBudgetCB(void* data) {
SkASSERT(data);
-
- // Unlike the GrResourceCache, TextBlobs are drawn at the SkGpuDevice level, therefore they
- // cannot use fFlushTorReduceCacheSize because it uses AutoCheckFlush. The solution is to move
- // drawText calls to below the GrContext level, but this is not trivial because they call
- // drawPath on SkGpuDevice
+ // TextBlobs are drawn at the SkGpuDevice level, therefore they cannot rely on GrDrawContext
+ // to perform a necessary flush. The solution is to move drawText calls to below the GrContext
+ // level, but this is not trivial because they call drawPath on SkGpuDevice.
GrContext* context = reinterpret_cast<GrContext*>(data);
context->flush();
}
////////////////////////////////////////////////////////////////////////////////
-void GrContext::flush(int flagsBitfield) {
+void GrContext::flush() {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
- bool flushed = false;
- if (kDiscard_FlushBit & flagsBitfield) {
- fDrawingManager->reset();
- } else {
- flushed = fDrawingManager->flush();
- }
- if (flushed) {
- fResourceCache->notifyFlushOccurred();
- }
- fFlushToReduceCacheSize = false;
+ fDrawingManager->flush();
}
bool sw_convert_to_premul(GrPixelConfig srcConfig, int width, int height, size_t inRowBytes,

Powered by Google App Engine
This is Rietveld 408576698