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

Unified Diff: bench/ResultsWriter.h

Issue 286903025: PictureBenchmark JSON logging (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More style fixes 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 a9eef802bda103f2ec0341782c3fc0f68bbe6954..c66593864f832800b73bf095e2b1ecbaba088597 100644
--- a/bench/ResultsWriter.h
+++ b/bench/ResultsWriter.h
@@ -101,26 +101,9 @@ private:
* },
* ...
*/
-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;
- }
- }
+Json::Value* SkFindNamedNode(Json::Value* root, const char name[]);
+class JSONResultsWriter : public ResultsWriter {
public:
explicit JSONResultsWriter(const char filename[])
: fFilename(filename)
@@ -138,12 +121,12 @@ public:
sk_name.appendS32(x);
sk_name.append("_");
sk_name.appendS32(y);
- Json::Value* bench_node = find_named_node(&fResults, sk_name.c_str());
+ Json::Value* bench_node = SkFindNamedNode(&fResults, sk_name.c_str());
fBench = &(*bench_node)["results"];
}
virtual void config(const char name[]) {
SkASSERT(NULL != fBench);
- fConfig = find_named_node(fBench, name);
+ fConfig = SkFindNamedNode(fBench, name);
}
virtual void timer(const char name[], double ms) {
SkASSERT(NULL != fConfig);
@@ -164,6 +147,7 @@ private:
};
#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