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

Unified Diff: src/gpu/GrAuditTrail.cpp

Issue 1753753002: Move some GrAuditTrail fuctions to cpp file (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 years, 10 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 | « include/private/GrAuditTrail.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAuditTrail.cpp
diff --git a/src/gpu/GrAuditTrail.cpp b/src/gpu/GrAuditTrail.cpp
index 6b20876807406a42e8c47cc2e7823f98dd599c1c..d46387315eba1f0dbbeaab7f28a6700a2593653e 100644
--- a/src/gpu/GrAuditTrail.cpp
+++ b/src/gpu/GrAuditTrail.cpp
@@ -10,6 +10,32 @@
const int GrAuditTrail::kGrAuditTrailInvalidID = -1;
+void GrAuditTrail::addBatch(const char* name, const SkRect& bounds) {
+ SkASSERT(fEnabled);
+ Batch* batch = new Batch;
+ fBatchPool.emplace_back(batch);
+ batch->fName = name;
+ batch->fBounds = bounds;
+ batch->fClientID = kGrAuditTrailInvalidID;
+ batch->fBatchListID = kGrAuditTrailInvalidID;
+ batch->fChildID = kGrAuditTrailInvalidID;
+ fCurrentBatch = batch;
+
+ if (fClientID != kGrAuditTrailInvalidID) {
+ batch->fClientID = fClientID;
+ Batches** batchesLookup = fClientIDLookup.find(fClientID);
+ Batches* batches = nullptr;
+ if (!batchesLookup) {
+ batches = new Batches;
+ fClientIDLookup.set(fClientID, batches);
+ } else {
+ batches = *batchesLookup;
+ }
+
+ batches->push_back(fCurrentBatch);
+ }
+}
+
void GrAuditTrail::batchingResultCombined(GrBatch* combiner) {
int* indexPtr = fIDLookup.find(combiner);
SkASSERT(indexPtr);
@@ -75,6 +101,15 @@ void GrAuditTrail::getBoundsByClientID(SkTArray<BatchInfo>* outInfo, int clientI
}
}
+void GrAuditTrail::fullReset() {
+ SkASSERT(fEnabled);
+ fBatchList.reset();
+ fIDLookup.reset();
+ // free all client batches
+ fClientIDLookup.foreach([](const int&, Batches** batches) { delete *batches; });
+ fClientIDLookup.reset();
+ fBatchPool.reset(); // must be last, frees all of the memory
+}
template <typename T>
void GrAuditTrail::JsonifyTArray(SkString* json, const char* name, const T& array,
« no previous file with comments | « include/private/GrAuditTrail.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698