OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_RULE_H_ | 5 #ifndef CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_RULE_H_ |
6 #define CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_RULE_H_ | 6 #define CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_RULE_H_ |
7 | 7 |
8 #include "content/browser/tracing/background_tracing_config_impl.h" | 8 #include "content/browser/tracing/background_tracing_config_impl.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 | 10 |
11 namespace base { | 11 namespace base { |
12 class DictionaryValue; | 12 class DictionaryValue; |
13 } // namespace base | 13 } // namespace base |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 class CONTENT_EXPORT BackgroundTracingRule { | 17 class CONTENT_EXPORT BackgroundTracingRule { |
18 public: | 18 public: |
19 BackgroundTracingRule(); | 19 BackgroundTracingRule(); |
20 virtual ~BackgroundTracingRule(); | 20 virtual ~BackgroundTracingRule(); |
21 | 21 |
22 virtual void Install() {} | 22 virtual void Install() {} |
23 virtual void IntoDict(base::DictionaryValue* dict) const = 0; | 23 virtual void IntoDict(base::DictionaryValue* dict) const; |
24 virtual void FromDict(const base::DictionaryValue* dict); | |
shatch
2015/10/30 15:50:28
Does this need to be virtual?
oystein (OOO til 10th of July)
2015/10/30 19:11:43
Done.
| |
24 virtual bool ShouldTriggerNamedEvent(const std::string& named_event) const; | 25 virtual bool ShouldTriggerNamedEvent(const std::string& named_event) const; |
25 virtual BackgroundTracingConfigImpl::CategoryPreset GetCategoryPreset() const; | 26 virtual BackgroundTracingConfigImpl::CategoryPreset GetCategoryPreset() const; |
26 virtual void OnHistogramTrigger(const std::string& histogram_name) const {} | 27 virtual void OnHistogramTrigger(const std::string& histogram_name) const {} |
27 | 28 |
28 // Seconds from the rule is triggered to finalization should start. | 29 // Seconds from the rule is triggered to finalization should start. |
29 virtual int GetTraceTimeout() const; | 30 virtual int GetTraceTimeout() const; |
30 | 31 |
32 // Probability that we should allow a tigger to happen. | |
33 double trigger_chance() const { return trigger_chance_; } | |
34 | |
31 static scoped_ptr<BackgroundTracingRule> PreemptiveRuleFromDict( | 35 static scoped_ptr<BackgroundTracingRule> PreemptiveRuleFromDict( |
32 const base::DictionaryValue* dict); | 36 const base::DictionaryValue* dict); |
33 | 37 |
34 static scoped_ptr<BackgroundTracingRule> ReactiveRuleFromDict( | 38 static scoped_ptr<BackgroundTracingRule> ReactiveRuleFromDict( |
35 const base::DictionaryValue* dict, | 39 const base::DictionaryValue* dict, |
36 BackgroundTracingConfigImpl::CategoryPreset category_preset); | 40 BackgroundTracingConfigImpl::CategoryPreset category_preset); |
37 | 41 |
38 private: | 42 private: |
39 DISALLOW_COPY_AND_ASSIGN(BackgroundTracingRule); | 43 DISALLOW_COPY_AND_ASSIGN(BackgroundTracingRule); |
44 | |
45 double trigger_chance_; | |
40 }; | 46 }; |
41 | 47 |
42 } // namespace content | 48 } // namespace content |
43 | 49 |
44 #endif // CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_RULE_H_ | 50 #endif // CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_RULE_H_ |
OLD | NEW |