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

Side by Side Diff: base/test/trace_event_analyzer.cc

Issue 16797003: Make base use the proper Value namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iwarnings fixed Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/test/trace_event_analyzer.h" 5 #include "base/test/trace_event_analyzer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <math.h> 8 #include <math.h>
9 #include <set> 9 #include <set>
10 10
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 output->push_back(&events[i]); 636 output->push_back(&events[i]);
637 } 637 }
638 return output->size(); 638 return output->size();
639 } 639 }
640 640
641 bool ParseEventsFromJson(const std::string& json, 641 bool ParseEventsFromJson(const std::string& json,
642 std::vector<TraceEvent>* output) { 642 std::vector<TraceEvent>* output) {
643 scoped_ptr<base::Value> root; 643 scoped_ptr<base::Value> root;
644 root.reset(base::JSONReader::Read(json)); 644 root.reset(base::JSONReader::Read(json));
645 645
646 ListValue* root_list = NULL; 646 base::ListValue* root_list = NULL;
647 if (!root.get() || !root->GetAsList(&root_list)) 647 if (!root.get() || !root->GetAsList(&root_list))
648 return false; 648 return false;
649 649
650 for (size_t i = 0; i < root_list->GetSize(); ++i) { 650 for (size_t i = 0; i < root_list->GetSize(); ++i) {
651 Value* item = NULL; 651 base::Value* item = NULL;
652 if (root_list->Get(i, &item)) { 652 if (root_list->Get(i, &item)) {
653 TraceEvent event; 653 TraceEvent event;
654 if (event.SetFromJSON(item)) 654 if (event.SetFromJSON(item))
655 output->push_back(event); 655 output->push_back(event);
656 else 656 else
657 return false; 657 return false;
658 } 658 }
659 } 659 }
660 660
661 return true; 661 return true;
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 end_position = (end_position < events.size()) ? end_position : events.size(); 954 end_position = (end_position < events.size()) ? end_position : events.size();
955 size_t count = 0u; 955 size_t count = 0u;
956 for (size_t i = begin_position; i < end_position; ++i) { 956 for (size_t i = begin_position; i < end_position; ++i) {
957 if (query.Evaluate(*events.at(i))) 957 if (query.Evaluate(*events.at(i)))
958 ++count; 958 ++count;
959 } 959 }
960 return count; 960 return count;
961 } 961 }
962 962
963 } // namespace trace_analyzer 963 } // namespace trace_analyzer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698