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

Side by Side Diff: content/browser/tracing/background_tracing_rule.h

Issue 1427873003: Background tracing: Added trace_chance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review fixes Created 5 years, 1 month 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 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 void Setup(const base::DictionaryValue* dict);
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698