diff options
author | joshualitt <joshualitt@chromium.org> | 2016-02-29 05:20:38 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-29 05:20:38 -0800 |
commit | 9b48a6e3f862076018cc7d63b180b6340f4873cd (patch) | |
tree | 04e60182f7077ea7dd5c8d4ae0fd5d9dab31445a /tools/skiaserve | |
parent | 7f4b1b20b0e76a4528d1521c8b79e76bdc34e34f (diff) |
Add abilitly to query audit trail for batches by draw op
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1745513002
Review URL: https://codereview.chromium.org/1745513002
Diffstat (limited to 'tools/skiaserve')
-rw-r--r-- | tools/skiaserve/Request.cpp | 30 | ||||
-rw-r--r-- | tools/skiaserve/Request.h | 2 |
2 files changed, 27 insertions, 5 deletions
diff --git a/tools/skiaserve/Request.cpp b/tools/skiaserve/Request.cpp index 4d256d56d8..bcaebde01f 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); diff --git a/tools/skiaserve/Request.h b/tools/skiaserve/Request.h index 568518644c..bef8c4a810 100644 --- a/tools/skiaserve/Request.h +++ b/tools/skiaserve/Request.h @@ -59,6 +59,8 @@ struct Request { private: SkSurface* createCPUSurface(); SkSurface* createGPUSurface(); + GrAuditTrail* getAuditTrail(SkCanvas*); + void cleanupAuditTrail(SkCanvas*); SkAutoTDelete<GrContextFactory> fContextFactory; SkAutoTUnref<SkSurface> fSurface; |