diff options
author | 2015-04-10 07:01:30 -0700 | |
---|---|---|
committer | 2015-04-10 07:01:30 -0700 | |
commit | 0db6dfaeb2d1376ad393516fb22af7ecf62718fa (patch) | |
tree | bb4e19cebcedf94b9abd455c637712e5544beaa3 /src/gpu/GrContext.cpp | |
parent | c5e0891029bed0f9619d67281a81f13983a9687b (diff) |
The TextBlobCache needs the ability to trigger a flush because otherwise its entire budget can be used up, but it will not be able to free up any space due to blobs being stuck in the GrInOrderDrawBuffer. This was causing a segfault. After this CL the cache will try to purge, and then flush if it cannot purge enough. It will not purge the most recent addition to the cache.
TBR=bsalomon@google.com
BUG=skia:
Review URL: https://codereview.chromium.org/1071333002
Diffstat (limited to 'src/gpu/GrContext.cpp')
-rwxr-xr-x | src/gpu/GrContext.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 2d61f35a4f..04e3f8fa9f 100755 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -137,7 +137,7 @@ void GrContext::initCommon() { // GrBatchFontCache will eventually replace GrFontCache fBatchFontCache = SkNEW_ARGS(GrBatchFontCache, (this)); - fTextBlobCache.reset(SkNEW(GrTextBlobCache)); + fTextBlobCache.reset(SkNEW_ARGS(GrTextBlobCache, (TextBlobCacheOverBudgetCB, this))); } GrContext::~GrContext() { @@ -354,6 +354,17 @@ void GrContext::OverBudgetCB(void* data) { 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 + GrContext* context = reinterpret_cast<GrContext*>(data); + context->flush(); +} + int GrContext::getMaxTextureSize() const { return SkTMin(fGpu->caps()->maxTextureSize(), fMaxTextureSizeOverride); } |