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

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

Issue 1717283003: tracing: Make ConvertableToTraceFormat move-only scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 MemoryDumpLevelOfDetail::DETAILED}; 56 MemoryDumpLevelOfDetail::DETAILED};
57 const TraceConfig::MemoryDumpTriggerConfig kDefaultLightMemoryDumpTrigger = { 57 const TraceConfig::MemoryDumpTriggerConfig kDefaultLightMemoryDumpTrigger = {
58 250, // periodic_interval_ms 58 250, // periodic_interval_ms
59 MemoryDumpLevelOfDetail::LIGHT}; 59 MemoryDumpLevelOfDetail::LIGHT};
60 60
61 class ConvertableTraceConfigToTraceFormat 61 class ConvertableTraceConfigToTraceFormat
62 : public base::trace_event::ConvertableToTraceFormat { 62 : public base::trace_event::ConvertableToTraceFormat {
63 public: 63 public:
64 explicit ConvertableTraceConfigToTraceFormat(const TraceConfig& trace_config) 64 explicit ConvertableTraceConfigToTraceFormat(const TraceConfig& trace_config)
65 : trace_config_(trace_config) {} 65 : trace_config_(trace_config) {}
66 ~ConvertableTraceConfigToTraceFormat() override {}
66 void AppendAsTraceFormat(std::string* out) const override { 67 void AppendAsTraceFormat(std::string* out) const override {
67 out->append(trace_config_.ToString()); 68 out->append(trace_config_.ToString());
68 } 69 }
69 70
70 protected:
71 ~ConvertableTraceConfigToTraceFormat() override {}
72
73 private: 71 private:
74 const TraceConfig trace_config_; 72 const TraceConfig trace_config_;
75 }; 73 };
76 74
77 } // namespace 75 } // namespace
78 76
79 TraceConfig::TraceConfig() { 77 TraceConfig::TraceConfig() {
80 InitializeDefault(); 78 InitializeDefault();
81 } 79 }
82 80
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 std::string TraceConfig::ToString() const { 149 std::string TraceConfig::ToString() const {
152 base::DictionaryValue dict; 150 base::DictionaryValue dict;
153 ToDict(dict); 151 ToDict(dict);
154 152
155 std::string json; 153 std::string json;
156 base::JSONWriter::Write(dict, &json); 154 base::JSONWriter::Write(dict, &json);
157 155
158 return json; 156 return json;
159 } 157 }
160 158
161 scoped_refptr<ConvertableToTraceFormat> 159 scoped_ptr<ConvertableToTraceFormat> TraceConfig::AsConvertableToTraceFormat()
162 TraceConfig::AsConvertableToTraceFormat() const { 160 const {
163 return new ConvertableTraceConfigToTraceFormat(*this); 161 return make_scoped_ptr(new ConvertableTraceConfigToTraceFormat(*this));
164 } 162 }
165 163
166 std::string TraceConfig::ToCategoryFilterString() const { 164 std::string TraceConfig::ToCategoryFilterString() const {
167 std::string filter_string; 165 std::string filter_string;
168 WriteCategoryFilterString(included_categories_, &filter_string, true); 166 WriteCategoryFilterString(included_categories_, &filter_string, true);
169 WriteCategoryFilterString(disabled_categories_, &filter_string, true); 167 WriteCategoryFilterString(disabled_categories_, &filter_string, true);
170 WriteCategoryFilterString(excluded_categories_, &filter_string, false); 168 WriteCategoryFilterString(excluded_categories_, &filter_string, false);
171 WriteCategoryFilterString(synthetic_delays_, &filter_string); 169 WriteCategoryFilterString(synthetic_delays_, &filter_string);
172 return filter_string; 170 return filter_string;
173 } 171 }
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 str.at(0) == ' ' || 660 str.at(0) == ' ' ||
663 str.at(str.length() - 1) == ' '; 661 str.at(str.length() - 1) == ' ';
664 } 662 }
665 663
666 bool TraceConfig::HasIncludedPatterns() const { 664 bool TraceConfig::HasIncludedPatterns() const {
667 return !included_categories_.empty(); 665 return !included_categories_.empty();
668 } 666 }
669 667
670 } // namespace trace_event 668 } // namespace trace_event
671 } // namespace base 669 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698