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

Unified Diff: bench/PathBench.cpp

Issue 111283007: Cap memory usage in path_create bench. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/PathBench.cpp
diff --git a/bench/PathBench.cpp b/bench/PathBench.cpp
index 67bc901c28f9cc65dcc184dd98b324b9f8f084c9..e11aad78f0dd8281a2f687ce539659e7cce8d218 100644
--- a/bench/PathBench.cpp
+++ b/bench/PathBench.cpp
@@ -327,27 +327,24 @@ protected:
virtual void onPreDraw() SK_OVERRIDE {
this->createData(10, 100);
- fPaths.reset(kPathCnt);
}
virtual void onDraw(const int loops, SkCanvas*) SK_OVERRIDE {
for (int i = 0; i < loops; ++i) {
- this->makePath(&fPaths[i & (kPathCnt - 1)]);
+ if (i % 1000 == 0) {
+ fPath.reset(); // PathRef memory can grow without bound otherwise.
+ }
+ this->makePath(&fPath);
}
this->restartMakingPaths();
}
virtual void onPostDraw() SK_OVERRIDE {
this->finishedMakingPaths();
- fPaths.reset(0);
}
private:
- enum {
- // must be a pow 2
- kPathCnt = 1 << 5,
- };
- SkAutoTArray<SkPath> fPaths;
+ SkPath fPath;
typedef RandomPathBench INHERITED;
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698