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

Side by Side Diff: include/private/GrAuditTrail.h

Issue 1749163002: Wire up stack traces again (Closed) Base URL: https://skia.googlesource.com/skia@trivialcleanup
Patch Set: remove debug print Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/gpu/GrAuditTrail.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrAuditTrail_DEFINED 8 #ifndef GrAuditTrail_DEFINED
9 #define GrAuditTrail_DEFINED 9 #define GrAuditTrail_DEFINED
10 10
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 fAuditTrail->setClientID(clientID); 72 fAuditTrail->setClientID(clientID);
73 } 73 }
74 74
75 ~AutoCollectBatches() { fAuditTrail->setClientID(kGrAuditTrailInvalidID) ; } 75 ~AutoCollectBatches() { fAuditTrail->setClientID(kGrAuditTrailInvalidID) ; }
76 76
77 private: 77 private:
78 AutoEnable fAutoEnable; 78 AutoEnable fAutoEnable;
79 GrAuditTrail* fAuditTrail; 79 GrAuditTrail* fAuditTrail;
80 }; 80 };
81 81
82 void pushFrame(const char* framename) {
83 SkASSERT(fEnabled);
84 fCurrentStackTrace.push_back(SkString(framename));
85 }
86
82 void addBatch(const char* name, const SkRect& bounds); 87 void addBatch(const char* name, const SkRect& bounds);
83 88
84 void batchingResultCombined(GrBatch* combiner); 89 void batchingResultCombined(GrBatch* combiner);
85 90
86 void batchingResultNew(GrBatch* batch); 91 void batchingResultNew(GrBatch* batch);
87 92
88 // Because batching is heavily dependent on sequence of draw calls, these ca lls will only 93 // Because batching is heavily dependent on sequence of draw calls, these ca lls will only
89 // produce valid information for the given draw sequence which preceeded the m. 94 // produce valid information for the given draw sequence which preceeded the m.
90 // Specifically, future draw calls may change the batching and thus would in validate 95 // Specifically, future draw calls may change the batching and thus would in validate
91 // the json. What this means is that for some sequence of draw calls N, the below toJson 96 // the json. What this means is that for some sequence of draw calls N, the below toJson
(...skipping 25 matching lines...) Expand all
117 122
118 void fullReset(); 123 void fullReset();
119 124
120 static const int kGrAuditTrailInvalidID; 125 static const int kGrAuditTrailInvalidID;
121 126
122 private: 127 private:
123 // TODO if performance becomes an issue, we can move to using SkVarAlloc 128 // TODO if performance becomes an issue, we can move to using SkVarAlloc
124 struct Batch { 129 struct Batch {
125 SkString toJson() const; 130 SkString toJson() const;
126 SkString fName; 131 SkString fName;
132 SkTArray<SkString> fStackTrace;
127 SkRect fBounds; 133 SkRect fBounds;
128 int fClientID; 134 int fClientID;
129 int fBatchListID; 135 int fBatchListID;
130 int fChildID; 136 int fChildID;
131 }; 137 };
132 typedef SkTArray<SkAutoTDelete<Batch>, true> BatchPool; 138 typedef SkTArray<SkAutoTDelete<Batch>, true> BatchPool;
133 139
134 typedef SkTArray<Batch*> Batches; 140 typedef SkTArray<Batch*> Batches;
135 141
136 struct BatchNode { 142 struct BatchNode {
137 SkString toJson() const; 143 SkString toJson() const;
138 SkRect fBounds; 144 SkRect fBounds;
139 Batches fChildren; 145 Batches fChildren;
140 uint32_t fRenderTargetUniqueID; 146 uint32_t fRenderTargetUniqueID;
141 }; 147 };
142 typedef SkTArray<SkAutoTDelete<BatchNode>, true> BatchList; 148 typedef SkTArray<SkAutoTDelete<BatchNode>, true> BatchList;
143 149
144 template <typename T> 150 template <typename T>
145 static void JsonifyTArray(SkString* json, const char* name, const T& array, 151 static void JsonifyTArray(SkString* json, const char* name, const T& array,
146 bool addComma); 152 bool addComma);
147 153
148 Batch* fCurrentBatch; 154 Batch* fCurrentBatch;
149 BatchPool fBatchPool; 155 BatchPool fBatchPool;
150 SkTHashMap<GrBatch*, int> fIDLookup; 156 SkTHashMap<GrBatch*, int> fIDLookup;
151 SkTHashMap<int, Batches*> fClientIDLookup; 157 SkTHashMap<int, Batches*> fClientIDLookup;
152 BatchList fBatchList; 158 BatchList fBatchList;
159 SkTArray<SkString> fCurrentStackTrace;
153 160
154 // The client cas pass in an optional client ID which we will use to mark th e batches 161 // The client cas pass in an optional client ID which we will use to mark th e batches
155 int fClientID; 162 int fClientID;
156 bool fEnabled; 163 bool fEnabled;
157 }; 164 };
158 165
159 #define GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, invoke, ...) \ 166 #define GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, invoke, ...) \
160 if (audit_trail->isEnabled()) { \ 167 if (audit_trail->isEnabled()) { \
161 audit_trail->invoke(__VA_ARGS__); \ 168 audit_trail->invoke(__VA_ARGS__); \
162 } 169 }
163 170
164 #define GR_AUDIT_TRAIL_AUTO_FRAME(audit_trail, framename) \ 171 #define GR_AUDIT_TRAIL_AUTO_FRAME(audit_trail, framename) \
165 // TODO fill out the frame stuff 172 GR_AUDIT_TRAIL_INVOKE_GUARD((audit_trail), pushFrame, framename);
166 //GrAuditTrail::AutoFrame SK_MACRO_APPEND_LINE(auto_frame)(audit_trail, fram ename);
167 173
168 #define GR_AUDIT_TRAIL_RESET(audit_trail) \ 174 #define GR_AUDIT_TRAIL_RESET(audit_trail) \
169 //GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, reset); 175 //GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, fullReset);
170 176
171 #define GR_AUDIT_TRAIL_ADDBATCH(audit_trail, batchname, bounds) \ 177 #define GR_AUDIT_TRAIL_ADDBATCH(audit_trail, batchname, bounds) \
172 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, addBatch, batchname, bounds); 178 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, addBatch, batchname, bounds);
173 179
174 #define GR_AUDIT_TRAIL_BATCHING_RESULT_COMBINED(audit_trail, combiner) \ 180 #define GR_AUDIT_TRAIL_BATCHING_RESULT_COMBINED(audit_trail, combiner) \
175 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, batchingResultCombined, combiner); 181 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, batchingResultCombined, combiner);
176 182
177 #define GR_AUDIT_TRAIL_BATCHING_RESULT_NEW(audit_trail, batch) \ 183 #define GR_AUDIT_TRAIL_BATCHING_RESULT_NEW(audit_trail, batch) \
178 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, batchingResultNew, batch); 184 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, batchingResultNew, batch);
179 185
180 #endif 186 #endif
OLDNEW
« 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