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

Unified Diff: include/private/GrAuditTrail.h

Issue 1581943004: Virtualize Frames in GrAuditTrail (Closed) Base URL: https://skia.googlesource.com/skia.git@audittrail-5-debugautoframes
Patch Set: nit Created 4 years, 11 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 | « no previous file | src/gpu/GrAuditTrail.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/private/GrAuditTrail.h
diff --git a/include/private/GrAuditTrail.h b/include/private/GrAuditTrail.h
index 38730ede1aa491b3e30d8dc40fbfefbda3d259f9..fbaec84bb3816f0d7d81b92090cbd7cdb6d3ec0f 100644
--- a/include/private/GrAuditTrail.h
+++ b/include/private/GrAuditTrail.h
@@ -42,11 +42,11 @@ public:
void pushFrame(const char* name) {
SkASSERT(GR_BATCH_DEBUGGING_OUTPUT);
- Frame* frame;
+ Frame* frame = new Frame;
if (fStack.empty()) {
- frame = &fFrames.push_back();
+ fFrames.emplace_back(frame);
} else {
- frame = &fStack.back()->fChildren.push_back();
+ fStack.back()->fChildren.emplace_back(frame);
}
frame->fUniqueID = fUniqueID++;
@@ -60,11 +60,11 @@ public:
}
void addBatch(const char* name, const SkRect& bounds) {
- // TODO when every internal callsite pushes a frame, we can add the assert
- SkASSERT(GR_BATCH_DEBUGGING_OUTPUT /*&& !fStack.empty()*/);
- Frame::Batch& batch = fStack.back()->fBatches.push_back();
- batch.fName = name;
- batch.fBounds = bounds;
+ SkASSERT(GR_BATCH_DEBUGGING_OUTPUT && !fStack.empty());
+ Batch* batch = new Batch;
+ fStack.back()->fChildren.emplace_back(batch);
+ batch->fName = name;
+ batch->fBounds = bounds;
}
SkString toJson() const;
@@ -72,22 +72,29 @@ public:
void reset() { SkASSERT(GR_BATCH_DEBUGGING_OUTPUT && fStack.empty()); fFrames.reset(); }
private:
- struct Frame {
- SkString toJson() const;
- struct Batch {
- SkString toJson() const;
- const char* fName;
- SkRect fBounds;
- };
+ // TODO if performance becomes an issue, we can move to using SkVarAlloc
+ struct Event {
+ virtual ~Event() {}
+ virtual SkString toJson() const=0;
const char* fName;
- // TODO combine these into a single array
- SkTArray<Batch> fBatches;
- SkTArray<Frame> fChildren;
uint64_t fUniqueID;
};
- SkTArray<Frame> fFrames;
+ typedef SkTArray<SkAutoTDelete<Event>, true> FrameArray;
+ struct Frame : public Event {
+ SkString toJson() const override;
+ FrameArray fChildren;
+ };
+
+ struct Batch : public Event {
+ SkString toJson() const override;
+ SkRect fBounds;
+ };
+
+ static void JsonifyTArray(SkString* json, const char* name, const FrameArray& array);
+
+ FrameArray fFrames;
SkTArray<Frame*> fStack;
uint64_t fUniqueID;
};
« no previous file with comments | « no previous file | src/gpu/GrAuditTrail.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698