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

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

Issue 2777203004: Avoid calling strlen() where possible in base/trace_config (Closed)
Patch Set: Keep DCHECKs. Created 3 years, 8 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
« no previous file with comments | « base/trace_event/trace_config.h ('k') | base/trace_event/trace_config_category_filter.h » ('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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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_config.h" 5 #include "base/trace_event/trace_config.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 return false; 179 return false;
180 for (size_t i = 0; i < list->GetSize(); ++i) { 180 for (size_t i = 0; i < list->GetSize(); ++i) {
181 std::string value; 181 std::string value;
182 if (list->GetString(i, &value)) 182 if (list->GetString(i, &value))
183 out_set->insert(value); 183 out_set->insert(value);
184 } 184 }
185 return true; 185 return true;
186 } 186 }
187 187
188 bool TraceConfig::EventFilterConfig::IsCategoryGroupEnabled( 188 bool TraceConfig::EventFilterConfig::IsCategoryGroupEnabled(
189 const char* category_group_name) const { 189 const StringPiece& category_group_name) const {
190 return category_filter_.IsCategoryGroupEnabled(category_group_name); 190 return category_filter_.IsCategoryGroupEnabled(category_group_name);
191 } 191 }
192 192
193 TraceConfig::TraceConfig() { 193 TraceConfig::TraceConfig() {
194 InitializeDefault(); 194 InitializeDefault();
195 } 195 }
196 196
197 TraceConfig::TraceConfig(StringPiece category_filter_string, 197 TraceConfig::TraceConfig(StringPiece category_filter_string,
198 StringPiece trace_options_string) { 198 StringPiece trace_options_string) {
199 InitializeFromStrings(category_filter_string, trace_options_string); 199 InitializeFromStrings(category_filter_string, trace_options_string);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 std::unique_ptr<ConvertableToTraceFormat> 270 std::unique_ptr<ConvertableToTraceFormat>
271 TraceConfig::AsConvertableToTraceFormat() const { 271 TraceConfig::AsConvertableToTraceFormat() const {
272 return MakeUnique<ConvertableTraceConfigToTraceFormat>(*this); 272 return MakeUnique<ConvertableTraceConfigToTraceFormat>(*this);
273 } 273 }
274 274
275 std::string TraceConfig::ToCategoryFilterString() const { 275 std::string TraceConfig::ToCategoryFilterString() const {
276 return category_filter_.ToFilterString(); 276 return category_filter_.ToFilterString();
277 } 277 }
278 278
279 bool TraceConfig::IsCategoryGroupEnabled( 279 bool TraceConfig::IsCategoryGroupEnabled(
280 const char* category_group_name) const { 280 const StringPiece& category_group_name) const {
281 // TraceLog should call this method only as part of enabling/disabling 281 // TraceLog should call this method only as part of enabling/disabling
282 // categories. 282 // categories.
283 return category_filter_.IsCategoryGroupEnabled(category_group_name); 283 return category_filter_.IsCategoryGroupEnabled(category_group_name);
284 } 284 }
285 285
286 void TraceConfig::Merge(const TraceConfig& config) { 286 void TraceConfig::Merge(const TraceConfig& config) {
287 if (record_mode_ != config.record_mode_ 287 if (record_mode_ != config.record_mode_
288 || enable_systrace_ != config.enable_systrace_ 288 || enable_systrace_ != config.enable_systrace_
289 || enable_argument_filter_ != config.enable_argument_filter_) { 289 || enable_argument_filter_ != config.enable_argument_filter_) {
290 DLOG(ERROR) << "Attempting to merge trace config with a different " 290 DLOG(ERROR) << "Attempting to merge trace config with a different "
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 } 583 }
584 if (enable_systrace_) 584 if (enable_systrace_)
585 ret = ret + "," + kEnableSystrace; 585 ret = ret + "," + kEnableSystrace;
586 if (enable_argument_filter_) 586 if (enable_argument_filter_)
587 ret = ret + "," + kEnableArgumentFilter; 587 ret = ret + "," + kEnableArgumentFilter;
588 return ret; 588 return ret;
589 } 589 }
590 590
591 } // namespace trace_event 591 } // namespace trace_event
592 } // namespace base 592 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/trace_config.h ('k') | base/trace_event/trace_config_category_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698