Index: include/private/GrAuditTrail.h |
diff --git a/include/private/GrAuditTrail.h b/include/private/GrAuditTrail.h |
index 02b971ef448c0fe4fa82a3c2cf8747f796717550..bcd85e221cb1efd6649bc9510658aacc8ba9d5b9 100644 |
--- a/include/private/GrAuditTrail.h |
+++ b/include/private/GrAuditTrail.h |
@@ -8,6 +8,7 @@ |
#ifndef GrAuditTrail_DEFINED |
#define GrAuditTrail_DEFINED |
+#include "GrConfig.h" |
#include "SkString.h" |
#include "SkTArray.h" |
@@ -18,12 +19,13 @@ |
class GrAuditTrail { |
public: |
void addOp(SkString name) { |
+ SkASSERT(GR_BATCH_DEBUGGING_OUTPUT); |
fOps.push_back().fName = name; |
} |
SkString toJson() const; |
- void reset() { fOps.reset(); } |
+ void reset() { SkASSERT(GR_BATCH_DEBUGGING_OUTPUT); fOps.reset(); } |
private: |
struct Op { |
@@ -34,4 +36,16 @@ private: |
SkTArray<Op> fOps; |
}; |
+#define GR_AUDIT_TRAIL_INVOKE_GUARD(invoke, ...) \ |
+ if (GR_BATCH_DEBUGGING_OUTPUT) { \ |
+ invoke(__VA_ARGS__); \ |
+ } |
+ |
+ |
+#define GR_AUDIT_TRAIL_ADDOP(audit_trail, opname) \ |
+ GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail->addOp, opname); |
+ |
+#define GR_AUDIT_TRAIL_RESET(audit_trail) \ |
+ GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail->reset); |
+ |
#endif |