Index: tools/skiaserve/Request.cpp |
diff --git a/tools/skiaserve/Request.cpp b/tools/skiaserve/Request.cpp |
index 4d256d56d87260af82172ad0cdeb87a408f9f278..bcaebde01f518e756c4da1a1f0be480601e4e047 100644 |
--- a/tools/skiaserve/Request.cpp |
+++ b/tools/skiaserve/Request.cpp |
@@ -138,6 +138,28 @@ bool Request::enableGPU(bool enable) { |
return true; |
} |
+GrAuditTrail* Request::getAuditTrail(SkCanvas* canvas) { |
+ GrAuditTrail* at = nullptr; |
+#if SK_SUPPORT_GPU |
+ GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget(); |
+ if (rt) { |
+ GrContext* ctx = rt->getContext(); |
+ if (ctx) { |
+ at = ctx->getAuditTrail(); |
+ } |
+ } |
+#endif |
+ return at; |
+} |
+ |
+void Request::cleanupAuditTrail(SkCanvas* canvas) { |
+ GrAuditTrail* at = this->getAuditTrail(canvas); |
+ if (at) { |
+ GrAuditTrail::AutoEnable ae(at); |
+ at->fullReset(); |
+ } |
+} |
+ |
SkData* Request::getJsonOps(int n) { |
SkCanvas* canvas = this->getCanvas(); |
Json::Value root = fDebugCanvas->toJSON(fUrlDataManager, n, canvas); |
@@ -145,6 +167,8 @@ SkData* Request::getJsonOps(int n) { |
SkDynamicMemoryWStream stream; |
stream.writeText(Json::FastWriter().write(root).c_str()); |
+ this->cleanupAuditTrail(canvas); |
+ |
return stream.copyToData(); |
} |
@@ -156,11 +180,7 @@ SkData* Request::getJsonBatchList(int n) { |
// a Json::Value and is only compiled in this file |
Json::Value parsedFromString; |
#if SK_SUPPORT_GPU |
- GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget(); |
- SkASSERT(rt); |
- GrContext* ctx = rt->getContext(); |
- SkASSERT(ctx); |
- GrAuditTrail* at = ctx->getAuditTrail(); |
+ GrAuditTrail* at = this->getAuditTrail(canvas); |
GrAuditTrail::AutoManageBatchList enable(at); |
fDebugCanvas->drawTo(canvas, n); |