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

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

Issue 1180693002: Update from https://crrev.com/333737 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 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
« no previous file with comments | « base/test/test_ui_thread_android.cc ('k') | base/test/trace_event_analyzer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 continue; 641 continue;
642 if (query.Evaluate(events[i])) 642 if (query.Evaluate(events[i]))
643 output->push_back(&events[i]); 643 output->push_back(&events[i]);
644 } 644 }
645 return output->size(); 645 return output->size();
646 } 646 }
647 647
648 bool ParseEventsFromJson(const std::string& json, 648 bool ParseEventsFromJson(const std::string& json,
649 std::vector<TraceEvent>* output) { 649 std::vector<TraceEvent>* output) {
650 scoped_ptr<base::Value> root; 650 scoped_ptr<base::Value> root;
651 root.reset(base::JSONReader::Read(json)); 651 root.reset(base::JSONReader::DeprecatedRead(json));
652 652
653 base::ListValue* root_list = NULL; 653 base::ListValue* root_list = NULL;
654 if (!root.get() || !root->GetAsList(&root_list)) 654 if (!root.get() || !root->GetAsList(&root_list))
655 return false; 655 return false;
656 656
657 for (size_t i = 0; i < root_list->GetSize(); ++i) { 657 for (size_t i = 0; i < root_list->GetSize(); ++i) {
658 base::Value* item = NULL; 658 base::Value* item = NULL;
659 if (root_list->Get(i, &item)) { 659 if (root_list->Get(i, &item)) {
660 TraceEvent event; 660 TraceEvent event;
661 if (event.SetFromJSON(item)) 661 if (event.SetFromJSON(item))
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 end_position = (end_position < events.size()) ? end_position : events.size(); 959 end_position = (end_position < events.size()) ? end_position : events.size();
960 size_t count = 0u; 960 size_t count = 0u;
961 for (size_t i = begin_position; i < end_position; ++i) { 961 for (size_t i = begin_position; i < end_position; ++i) {
962 if (query.Evaluate(*events.at(i))) 962 if (query.Evaluate(*events.at(i)))
963 ++count; 963 ++count;
964 } 964 }
965 return count; 965 return count;
966 } 966 }
967 967
968 } // namespace trace_analyzer 968 } // namespace trace_analyzer
OLDNEW
« no previous file with comments | « base/test/test_ui_thread_android.cc ('k') | base/test/trace_event_analyzer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698