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

Unified Diff: tools/skiaserve/Request.cpp

Issue 1745513002: Add abilitly to query audit trail for batches by draw op (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: tweaks Created 4 years, 10 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
« no previous file with comments | « tools/skiaserve/Request.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « tools/skiaserve/Request.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698