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

Unified Diff: bench/ResultsWriter.h

Issue 306483010: Revert of PictureBenchmark JSON logging (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 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 | bench/ResultsWriter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/ResultsWriter.h
diff --git a/bench/ResultsWriter.h b/bench/ResultsWriter.h
index c66593864f832800b73bf095e2b1ecbaba088597..a9eef802bda103f2ec0341782c3fc0f68bbe6954 100644
--- a/bench/ResultsWriter.h
+++ b/bench/ResultsWriter.h
@@ -101,9 +101,26 @@
* },
* ...
*/
-
-Json::Value* SkFindNamedNode(Json::Value* root, const char name[]);
class JSONResultsWriter : public ResultsWriter {
+private:
+ Json::Value* find_named_node(Json::Value* root, const char name[]) {
+ Json::Value* search_results = NULL;
+ for(Json::Value::iterator iter = root->begin();
+ iter!= root->end(); ++iter) {
+ if(SkString(name).equals((*iter)["name"].asCString())) {
+ search_results = &(*iter);
+ break;
+ }
+ }
+
+ if(search_results != NULL) {
+ return search_results;
+ } else {
+ Json::Value* new_val = &(root->append(Json::Value()));
+ (*new_val)["name"] = name;
+ return new_val;
+ }
+ }
public:
explicit JSONResultsWriter(const char filename[])
: fFilename(filename)
@@ -121,12 +138,12 @@
sk_name.appendS32(x);
sk_name.append("_");
sk_name.appendS32(y);
- Json::Value* bench_node = SkFindNamedNode(&fResults, sk_name.c_str());
+ Json::Value* bench_node = find_named_node(&fResults, sk_name.c_str());
fBench = &(*bench_node)["results"];
}
virtual void config(const char name[]) {
SkASSERT(NULL != fBench);
- fConfig = SkFindNamedNode(fBench, name);
+ fConfig = find_named_node(fBench, name);
}
virtual void timer(const char name[], double ms) {
SkASSERT(NULL != fConfig);
@@ -147,7 +164,6 @@
};
#endif // SK_BUILD_JSON_WRITER
-
/**
* This ResultsWriter writes out to multiple ResultsWriters.
*/
« no previous file with comments | « no previous file | bench/ResultsWriter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698