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

Side by Side Diff: base/debug/trace_event_impl.cc

Issue 100823007: Stop doing unnecessary UTF-8 to UTF-16 conversions in JSONWriter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ChromeOS page encodings Created 7 years 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
« no previous file with comments | « no previous file | base/json/json_value_serializer_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/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
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
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
OLDNEW
« no previous file with comments | « no previous file | base/json/json_value_serializer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698