Wire up stack traces again
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1749163002
Review URL: https://codereview.chromium.org/1749163002
diff --git a/include/private/GrAuditTrail.h b/include/private/GrAuditTrail.h
index dab6fe7..f9b0091 100644
--- a/include/private/GrAuditTrail.h
+++ b/include/private/GrAuditTrail.h
@@ -79,6 +79,11 @@
GrAuditTrail* fAuditTrail;
};
+ void pushFrame(const char* framename) {
+ SkASSERT(fEnabled);
+ fCurrentStackTrace.push_back(SkString(framename));
+ }
+
void addBatch(const char* name, const SkRect& bounds);
void batchingResultCombined(GrBatch* combiner);
@@ -124,6 +129,7 @@
struct Batch {
SkString toJson() const;
SkString fName;
+ SkTArray<SkString> fStackTrace;
SkRect fBounds;
int fClientID;
int fBatchListID;
@@ -150,6 +156,7 @@
SkTHashMap<GrBatch*, int> fIDLookup;
SkTHashMap<int, Batches*> fClientIDLookup;
BatchList fBatchList;
+ SkTArray<SkString> fCurrentStackTrace;
// The client cas pass in an optional client ID which we will use to mark the batches
int fClientID;
@@ -162,11 +169,10 @@
}
#define GR_AUDIT_TRAIL_AUTO_FRAME(audit_trail, framename) \
- // TODO fill out the frame stuff
- //GrAuditTrail::AutoFrame SK_MACRO_APPEND_LINE(auto_frame)(audit_trail, framename);
+ GR_AUDIT_TRAIL_INVOKE_GUARD((audit_trail), pushFrame, framename);
#define GR_AUDIT_TRAIL_RESET(audit_trail) \
- //GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, reset);
+ //GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, fullReset);
#define GR_AUDIT_TRAIL_ADDBATCH(audit_trail, batchname, bounds) \
GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, addBatch, batchname, bounds);
diff --git a/src/gpu/GrAuditTrail.cpp b/src/gpu/GrAuditTrail.cpp
index d463873..cf5c510 100644
--- a/src/gpu/GrAuditTrail.cpp
+++ b/src/gpu/GrAuditTrail.cpp
@@ -19,6 +19,10 @@
batch->fClientID = kGrAuditTrailInvalidID;
batch->fBatchListID = kGrAuditTrailInvalidID;
batch->fChildID = kGrAuditTrailInvalidID;
+
+ // consume the current stack trace if any
+ batch->fStackTrace = fCurrentStackTrace;
+ fCurrentStackTrace.reset();
fCurrentBatch = batch;
if (fClientID != kGrAuditTrailInvalidID) {
@@ -242,6 +246,16 @@
json.appendf("\"BatchListID\": \"%d\",", fBatchListID);
json.appendf("\"ChildID\": \"%d\",", fChildID);
skrect_to_json(&json, "Bounds", fBounds);
+ if (fStackTrace.count()) {
+ json.append(",\"Stack\": [");
+ for (int i = 0; i < fStackTrace.count(); i++) {
+ json.appendf("\"%s\"", fStackTrace[i].c_str());
+ if (i < fStackTrace.count() - 1) {
+ json.append(",");
+ }
+ }
+ json.append("]");
+ }
json.append("}");
return json;
}