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

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

Issue 7767014: Added support to trace_event for passing static string arguments without copy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added tests Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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.h" 5 #include "base/debug/trace_event.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include "base/debug/trace_event_win.h" 10 #include "base/debug/trace_event_win.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 *out += temp_string; 76 *out += temp_string;
77 break; 77 break;
78 case TRACE_TYPE_POINTER: 78 case TRACE_TYPE_POINTER:
79 base::snprintf(temp_string, arraysize(temp_string), "%llu", 79 base::snprintf(temp_string, arraysize(temp_string), "%llu",
80 static_cast<unsigned long long>( 80 static_cast<unsigned long long>(
81 reinterpret_cast<intptr_t>( 81 reinterpret_cast<intptr_t>(
82 as_pointer()))); 82 as_pointer())));
83 *out += temp_string; 83 *out += temp_string;
84 break; 84 break;
85 case TRACE_TYPE_STRING: 85 case TRACE_TYPE_STRING:
86 case TRACE_TYPE_STATIC_STRING:
86 *out += "\""; 87 *out += "\"";
87 start_pos = out->size(); 88 start_pos = out->size();
88 *out += as_string(); 89 *out += as_string();
89 // replace " character with ' 90 // replace " character with '
90 while ((start_pos = out->find_first_of('\"', start_pos)) != 91 while ((start_pos = out->find_first_of('\"', start_pos)) !=
91 std::string::npos) 92 std::string::npos)
92 (*out)[start_pos] = '\''; 93 (*out)[start_pos] = '\'';
93 *out += "\""; 94 *out += "\"";
94 break; 95 break;
95 default: 96 default:
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 p_data_->name, 526 p_data_->name,
526 NULL, 0, NULL, 0, 527 NULL, 0, NULL, 0,
527 p_data_->threshold_begin_id, p_data_->threshold, false); 528 p_data_->threshold_begin_id, p_data_->threshold, false);
528 } 529 }
529 } 530 }
530 531
531 } // namespace internal 532 } // namespace internal
532 533
533 } // namespace debug 534 } // namespace debug
534 } // namespace base 535 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698