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