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

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

Issue 2253973003: Add an explicit way of making IDs local or global (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lints Created 4 years, 3 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
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 <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 return false; 84 return false;
85 } 85 }
86 if (!dictionary->GetString("name", &name)) { 86 if (!dictionary->GetString("name", &name)) {
87 LOG(ERROR) << "name is missing from TraceEvent JSON"; 87 LOG(ERROR) << "name is missing from TraceEvent JSON";
88 return false; 88 return false;
89 } 89 }
90 if (!dictionary->GetDictionary("args", &args)) { 90 if (!dictionary->GetDictionary("args", &args)) {
91 LOG(ERROR) << "args is missing from TraceEvent JSON"; 91 LOG(ERROR) << "args is missing from TraceEvent JSON";
92 return false; 92 return false;
93 } 93 }
94 if (require_id && !dictionary->GetString("id", &id)) { 94 if (require_id && !dictionary->GetString("id", &id) &&
95 !dictionary->GetString("local_id", &local_id) &&
96 !dictionary->GetString("global_id", &global_id)) {
95 LOG(ERROR) << "id is missing from ASYNC_BEGIN/ASYNC_END TraceEvent JSON"; 97 LOG(ERROR) << "id is missing from ASYNC_BEGIN/ASYNC_END TraceEvent JSON";
96 return false; 98 return false;
97 } 99 }
98 100
99 // For each argument, copy the type and create a trace_analyzer::TraceValue. 101 // For each argument, copy the type and create a trace_analyzer::TraceValue.
100 for (base::DictionaryValue::Iterator it(*args); !it.IsAtEnd(); 102 for (base::DictionaryValue::Iterator it(*args); !it.IsAtEnd();
101 it.Advance()) { 103 it.Advance()) {
102 std::string str; 104 std::string str;
103 bool boolean = false; 105 bool boolean = false;
104 int int_num = 0; 106 int int_num = 0;
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 end_position = (end_position < events.size()) ? end_position : events.size(); 992 end_position = (end_position < events.size()) ? end_position : events.size();
991 size_t count = 0u; 993 size_t count = 0u;
992 for (size_t i = begin_position; i < end_position; ++i) { 994 for (size_t i = begin_position; i < end_position; ++i) {
993 if (query.Evaluate(*events.at(i))) 995 if (query.Evaluate(*events.at(i)))
994 ++count; 996 ++count;
995 } 997 }
996 return count; 998 return count;
997 } 999 }
998 1000
999 } // namespace trace_analyzer 1001 } // namespace trace_analyzer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698