Home | History | Annotate | Download | only in bench
      1 /*
      2  * Copyright 2014 Google Inc.
      3  *
      4  * Use of this source code is governed by a BSD-style license that can be
      5  * found in the LICENSE file.
      6  *
      7  * Helper functions for result writing operations.
      8  */
      9 
     10 #include "ResultsWriter.h"
     11 
     12 Json::Value* SkFindNamedNode(Json::Value* root, const char name[]) {
     13     Json::Value* search_results = NULL;
     14     for(Json::Value::iterator iter = root->begin();
     15             iter!= root->end(); ++iter) {
     16         if(SkString(name).equals((*iter)["name"].asCString())) {
     17             search_results = &(*iter);
     18             break;
     19         }
     20     }
     21 
     22     if(search_results != NULL) {
     23         return search_results;
     24     } else {
     25         Json::Value* new_val = &(root->append(Json::Value()));
     26         (*new_val)["name"] = name;
     27         return new_val;
     28     }
     29 }
     30 
     31