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/debug/trace_event_impl.h" | 5 #include "base/debug/trace_event_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 } | 655 } |
656 case TRACE_VALUE_TYPE_POINTER: | 656 case TRACE_VALUE_TYPE_POINTER: |
657 // JSON only supports double and int numbers. | 657 // JSON only supports double and int numbers. |
658 // So as not to lose bits from a 64-bit pointer, output as a hex string. | 658 // So as not to lose bits from a 64-bit pointer, output as a hex string. |
659 StringAppendF(out, "\"0x%" PRIx64 "\"", static_cast<uint64>( | 659 StringAppendF(out, "\"0x%" PRIx64 "\"", static_cast<uint64>( |
660 reinterpret_cast<intptr_t>( | 660 reinterpret_cast<intptr_t>( |
661 value.as_pointer))); | 661 value.as_pointer))); |
662 break; | 662 break; |
663 case TRACE_VALUE_TYPE_STRING: | 663 case TRACE_VALUE_TYPE_STRING: |
664 case TRACE_VALUE_TYPE_COPY_STRING: | 664 case TRACE_VALUE_TYPE_COPY_STRING: |
665 JsonDoubleQuote(value.as_string ? value.as_string : "NULL", true, out); | 665 EscapeJSONString(value.as_string ? value.as_string : "NULL", true, out); |
666 break; | 666 break; |
667 default: | 667 default: |
668 NOTREACHED() << "Don't know how to print this value"; | 668 NOTREACHED() << "Don't know how to print this value"; |
669 break; | 669 break; |
670 } | 670 } |
671 } | 671 } |
672 | 672 |
673 void TraceEvent::AppendAsJSON(std::string* out) const { | 673 void TraceEvent::AppendAsJSON(std::string* out) const { |
674 int64 time_int64 = timestamp_.ToInternalValue(); | 674 int64 time_int64 = timestamp_.ToInternalValue(); |
675 int process_id = TraceLog::GetInstance()->process_id(); | 675 int process_id = TraceLog::GetInstance()->process_id(); |
(...skipping 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2302 } | 2302 } |
2303 | 2303 |
2304 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 2304 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
2305 if (*category_group_enabled_) { | 2305 if (*category_group_enabled_) { |
2306 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, | 2306 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, |
2307 name_, event_handle_); | 2307 name_, event_handle_); |
2308 } | 2308 } |
2309 } | 2309 } |
2310 | 2310 |
2311 } // namespace trace_event_internal | 2311 } // namespace trace_event_internal |
OLD | NEW |