| OLD | NEW |
| 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 |
| 11 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
| 12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/strings/pattern.h" | 14 #include "base/strings/pattern.h" |
| 15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
| 16 #include "base/strings/string_tokenizer.h" | 16 #include "base/strings/string_tokenizer.h" |
| 17 #include "base/strings/string_util.h" |
| 17 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 18 #include "base/trace_event/memory_dump_manager.h" | 19 #include "base/trace_event/memory_dump_manager.h" |
| 19 #include "base/trace_event/memory_dump_request_args.h" | 20 #include "base/trace_event/memory_dump_request_args.h" |
| 20 #include "base/trace_event/trace_event.h" | 21 #include "base/trace_event/trace_event.h" |
| 21 | 22 |
| 22 namespace base { | 23 namespace base { |
| 23 namespace trace_event { | 24 namespace trace_event { |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 std::vector<std::string> split = base::SplitString( | 405 std::vector<std::string> split = base::SplitString( |
| 405 category_filter_string, ",", base::TRIM_WHITESPACE, | 406 category_filter_string, ",", base::TRIM_WHITESPACE, |
| 406 base::SPLIT_WANT_ALL); | 407 base::SPLIT_WANT_ALL); |
| 407 std::vector<std::string>::iterator iter; | 408 std::vector<std::string>::iterator iter; |
| 408 for (iter = split.begin(); iter != split.end(); ++iter) { | 409 for (iter = split.begin(); iter != split.end(); ++iter) { |
| 409 std::string category = *iter; | 410 std::string category = *iter; |
| 410 // Ignore empty categories. | 411 // Ignore empty categories. |
| 411 if (category.empty()) | 412 if (category.empty()) |
| 412 continue; | 413 continue; |
| 413 // Synthetic delays are of the form 'DELAY(delay;option;option;...)'. | 414 // Synthetic delays are of the form 'DELAY(delay;option;option;...)'. |
| 414 if (category.find(kSyntheticDelayCategoryFilterPrefix) == 0 && | 415 if (base::StartsWith(category, kSyntheticDelayCategoryFilterPrefix, |
| 416 base::CompareCase::SENSITIVE) && |
| 415 category.at(category.size() - 1) == ')') { | 417 category.at(category.size() - 1) == ')') { |
| 416 category = category.substr( | 418 category = category.substr( |
| 417 strlen(kSyntheticDelayCategoryFilterPrefix), | 419 strlen(kSyntheticDelayCategoryFilterPrefix), |
| 418 category.size() - strlen(kSyntheticDelayCategoryFilterPrefix) - 1); | 420 category.size() - strlen(kSyntheticDelayCategoryFilterPrefix) - 1); |
| 419 size_t name_length = category.find(';'); | 421 size_t name_length = category.find(';'); |
| 420 if (name_length != std::string::npos && name_length > 0 && | 422 if (name_length != std::string::npos && name_length > 0 && |
| 421 name_length != category.size() - 1) { | 423 name_length != category.size() - 1) { |
| 422 synthetic_delays_.push_back(category); | 424 synthetic_delays_.push_back(category); |
| 423 } | 425 } |
| 424 } else if (category.at(0) == '-') { | 426 } else if (category.at(0) == '-') { |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 str.at(0) == ' ' || | 762 str.at(0) == ' ' || |
| 761 str.at(str.length() - 1) == ' '; | 763 str.at(str.length() - 1) == ' '; |
| 762 } | 764 } |
| 763 | 765 |
| 764 bool TraceConfig::HasIncludedPatterns() const { | 766 bool TraceConfig::HasIncludedPatterns() const { |
| 765 return !included_categories_.empty(); | 767 return !included_categories_.empty(); |
| 766 } | 768 } |
| 767 | 769 |
| 768 } // namespace trace_event | 770 } // namespace trace_event |
| 769 } // namespace base | 771 } // namespace base |
| OLD | NEW |