OLD | NEW |
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/trace_event/trace_event_impl.h" | 5 #include "base/trace_event/trace_event_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/json/string_escape.h" | 10 #include "base/json/string_escape.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 } else { | 286 } else { |
287 process_id = TraceLog::GetInstance()->process_id(); | 287 process_id = TraceLog::GetInstance()->process_id(); |
288 thread_id = thread_id_; | 288 thread_id = thread_id_; |
289 } | 289 } |
290 const char* category_group_name = | 290 const char* category_group_name = |
291 TraceLog::GetCategoryGroupName(category_group_enabled_); | 291 TraceLog::GetCategoryGroupName(category_group_enabled_); |
292 | 292 |
293 // Category group checked at category creation time. | 293 // Category group checked at category creation time. |
294 DCHECK(!strchr(name_, '"')); | 294 DCHECK(!strchr(name_, '"')); |
295 StringAppendF(out, "{\"pid\":%i,\"tid\":%i,\"ts\":%" PRId64 | 295 StringAppendF(out, "{\"pid\":%i,\"tid\":%i,\"ts\":%" PRId64 |
296 "," | 296 ",\"ph\":\"%c\",\"cat\":\"%s\",\"name\":", |
297 "\"ph\":\"%c\",\"cat\":\"%s\",\"name\":\"%s\",\"args\":", | 297 process_id, thread_id, time_int64, phase_, category_group_name); |
298 process_id, thread_id, time_int64, phase_, category_group_name, | 298 EscapeJSONString(name_, true, out); |
299 name_); | 299 *out += ",\"args\":"; |
300 | 300 |
301 // Output argument names and values, stop at first NULL argument name. | 301 // Output argument names and values, stop at first NULL argument name. |
302 // TODO(oysteine): The dual predicates here is a bit ugly; if the filtering | 302 // TODO(oysteine): The dual predicates here is a bit ugly; if the filtering |
303 // capabilities need to grow even more precise we should rethink this | 303 // capabilities need to grow even more precise we should rethink this |
304 // approach | 304 // approach |
305 ArgumentNameFilterPredicate argument_name_filter_predicate; | 305 ArgumentNameFilterPredicate argument_name_filter_predicate; |
306 bool strip_args = | 306 bool strip_args = |
307 arg_names_[0] && !argument_filter_predicate.is_null() && | 307 arg_names_[0] && !argument_filter_predicate.is_null() && |
308 !argument_filter_predicate.Run(category_group_name, name_, | 308 !argument_filter_predicate.Run(category_group_name, name_, |
309 &argument_name_filter_predicate); | 309 &argument_name_filter_predicate); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 AppendValueAsJSON(arg_types_[i], arg_values_[i], &value_as_text); | 417 AppendValueAsJSON(arg_types_[i], arg_values_[i], &value_as_text); |
418 | 418 |
419 *out << value_as_text; | 419 *out << value_as_text; |
420 } | 420 } |
421 *out << "}"; | 421 *out << "}"; |
422 } | 422 } |
423 } | 423 } |
424 | 424 |
425 } // namespace trace_event | 425 } // namespace trace_event |
426 } // namespace base | 426 } // namespace base |
OLD | NEW |