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/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: '' 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
Mark Mentovai 2013/12/06 15:35:12 In your CL description, for the three cases, you s
Robert Sesek 2013/12/09 19:52:09 Done.
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"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 } 643 }
644 case TRACE_VALUE_TYPE_POINTER: 644 case TRACE_VALUE_TYPE_POINTER:
645 // JSON only supports double and int numbers. 645 // JSON only supports double and int numbers.
646 // So as not to lose bits from a 64-bit pointer, output as a hex string. 646 // So as not to lose bits from a 64-bit pointer, output as a hex string.
647 StringAppendF(out, "\"0x%" PRIx64 "\"", static_cast<uint64>( 647 StringAppendF(out, "\"0x%" PRIx64 "\"", static_cast<uint64>(
648 reinterpret_cast<intptr_t>( 648 reinterpret_cast<intptr_t>(
649 value.as_pointer))); 649 value.as_pointer)));
650 break; 650 break;
651 case TRACE_VALUE_TYPE_STRING: 651 case TRACE_VALUE_TYPE_STRING:
652 case TRACE_VALUE_TYPE_COPY_STRING: 652 case TRACE_VALUE_TYPE_COPY_STRING:
653 JsonDoubleQuote(value.as_string ? value.as_string : "NULL", true, out); 653 EscapeJSONString(value.as_string ? value.as_string : "NULL", true, out);
654 break; 654 break;
655 default: 655 default:
656 NOTREACHED() << "Don't know how to print this value"; 656 NOTREACHED() << "Don't know how to print this value";
657 break; 657 break;
658 } 658 }
659 } 659 }
660 660
661 void TraceEvent::AppendAsJSON(std::string* out) const { 661 void TraceEvent::AppendAsJSON(std::string* out) const {
662 int64 time_int64 = timestamp_.ToInternalValue(); 662 int64 time_int64 = timestamp_.ToInternalValue();
663 int process_id = TraceLog::GetInstance()->process_id(); 663 int process_id = TraceLog::GetInstance()->process_id();
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
2259 } 2259 }
2260 2260
2261 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { 2261 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() {
2262 if (*category_group_enabled_) { 2262 if (*category_group_enabled_) {
2263 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, 2263 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_,
2264 name_, event_handle_); 2264 name_, event_handle_);
2265 } 2265 }
2266 } 2266 }
2267 2267
2268 } // namespace trace_event_internal 2268 } // namespace trace_event_internal
OLDNEW
« no previous file with comments | « no previous file | base/json/json_value_serializer_unittest.cc » ('j') | base/json/json_value_serializer_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698