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

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

Issue 1274123003: Update SplitString calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no media changes Created 5 years, 4 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
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 "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/strings/pattern.h" 9 #include "base/strings/pattern.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 if (dict->GetList(kExcludedCategoriesParam, &category_list)) 286 if (dict->GetList(kExcludedCategoriesParam, &category_list))
287 SetCategoriesFromExcludedList(*category_list); 287 SetCategoriesFromExcludedList(*category_list);
288 if (dict->GetList(kSyntheticDelaysParam, &category_list)) 288 if (dict->GetList(kSyntheticDelaysParam, &category_list))
289 SetSyntheticDelaysFromList(*category_list); 289 SetSyntheticDelaysFromList(*category_list);
290 } 290 }
291 291
292 void TraceConfig::InitializeFromStrings( 292 void TraceConfig::InitializeFromStrings(
293 const std::string& category_filter_string, 293 const std::string& category_filter_string,
294 const std::string& trace_options_string) { 294 const std::string& trace_options_string) {
295 if (!category_filter_string.empty()) { 295 if (!category_filter_string.empty()) {
296 std::vector<std::string> split; 296 std::vector<std::string> split = base::SplitString(
297 category_filter_string, ",", base::TRIM_WHITESPACE,
298 base::SPLIT_WANT_ALL);
297 std::vector<std::string>::iterator iter; 299 std::vector<std::string>::iterator iter;
298 base::SplitString(category_filter_string, ',', &split);
299 for (iter = split.begin(); iter != split.end(); ++iter) { 300 for (iter = split.begin(); iter != split.end(); ++iter) {
300 std::string category = *iter; 301 std::string category = *iter;
301 // Ignore empty categories. 302 // Ignore empty categories.
302 if (category.empty()) 303 if (category.empty())
303 continue; 304 continue;
304 // Synthetic delays are of the form 'DELAY(delay;option;option;...)'. 305 // Synthetic delays are of the form 'DELAY(delay;option;option;...)'.
305 if (category.find(kSyntheticDelayCategoryFilterPrefix) == 0 && 306 if (category.find(kSyntheticDelayCategoryFilterPrefix) == 0 &&
306 category.at(category.size() - 1) == ')') { 307 category.at(category.size() - 1) == ')') {
307 category = category.substr( 308 category = category.substr(
308 strlen(kSyntheticDelayCategoryFilterPrefix), 309 strlen(kSyntheticDelayCategoryFilterPrefix),
(...skipping 15 matching lines...) Expand all
324 included_categories_.push_back(category); 325 included_categories_.push_back(category);
325 } 326 }
326 } 327 }
327 } 328 }
328 329
329 record_mode_ = RECORD_UNTIL_FULL; 330 record_mode_ = RECORD_UNTIL_FULL;
330 enable_sampling_ = false; 331 enable_sampling_ = false;
331 enable_systrace_ = false; 332 enable_systrace_ = false;
332 enable_argument_filter_ = false; 333 enable_argument_filter_ = false;
333 if(!trace_options_string.empty()) { 334 if(!trace_options_string.empty()) {
334 std::vector<std::string> split; 335 std::vector<std::string> split = base::SplitString(
336 trace_options_string, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
335 std::vector<std::string>::iterator iter; 337 std::vector<std::string>::iterator iter;
336 base::SplitString(trace_options_string, ',', &split);
337 for (iter = split.begin(); iter != split.end(); ++iter) { 338 for (iter = split.begin(); iter != split.end(); ++iter) {
338 if (*iter == kRecordUntilFull) { 339 if (*iter == kRecordUntilFull) {
339 record_mode_ = RECORD_UNTIL_FULL; 340 record_mode_ = RECORD_UNTIL_FULL;
340 } else if (*iter == kRecordContinuously) { 341 } else if (*iter == kRecordContinuously) {
341 record_mode_ = RECORD_CONTINUOUSLY; 342 record_mode_ = RECORD_CONTINUOUSLY;
342 } else if (*iter == kTraceToConsole) { 343 } else if (*iter == kTraceToConsole) {
343 record_mode_ = ECHO_TO_CONSOLE; 344 record_mode_ = ECHO_TO_CONSOLE;
344 } else if (*iter == kRecordAsMuchAsPossible) { 345 } else if (*iter == kRecordAsMuchAsPossible) {
345 record_mode_ = RECORD_AS_MUCH_AS_POSSIBLE; 346 record_mode_ = RECORD_AS_MUCH_AS_POSSIBLE;
346 } else if (*iter == kEnableSampling) { 347 } else if (*iter == kEnableSampling) {
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 str.at(0) == ' ' || 540 str.at(0) == ' ' ||
540 str.at(str.length() - 1) == ' '; 541 str.at(str.length() - 1) == ' ';
541 } 542 }
542 543
543 bool TraceConfig::HasIncludedPatterns() const { 544 bool TraceConfig::HasIncludedPatterns() const {
544 return !included_categories_.empty(); 545 return !included_categories_.empty();
545 } 546 }
546 547
547 } // namespace trace_event 548 } // namespace trace_event
548 } // namespace base 549 } // namespace base
OLDNEW
« no previous file with comments | « base/test/launcher/test_launcher.cc ('k') | content/browser/accessibility/browser_accessibility_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698