[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / content / browser / tracing / background_tracing_config_impl.h
blobc3ff85cab1ccd3301e2e826ac7e01d9c9bb59d97
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_CONFIG_IMPL_H_
6 #define CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_CONFIG_IMPL_H_
8 #include "base/memory/scoped_vector.h"
9 #include "content/common/content_export.h"
10 #include "content/public/browser/background_tracing_config.h"
12 namespace content {
13 class BackgroundTracingRule;
15 class CONTENT_EXPORT BackgroundTracingConfigImpl
16 : public BackgroundTracingConfig {
17 public:
18 explicit BackgroundTracingConfigImpl(TracingMode tracing_mode);
20 ~BackgroundTracingConfigImpl() override;
22 // From BackgroundTracingConfig
23 void IntoDict(base::DictionaryValue* dict) const override;
25 enum CategoryPreset {
26 BENCHMARK,
27 BENCHMARK_DEEP,
28 BENCHMARK_GPU,
29 BENCHMARK_IPC,
30 BENCHMARK_STARTUP,
33 CategoryPreset category_preset() const { return category_preset_; }
34 void set_category_preset(CategoryPreset category_preset) {
35 category_preset_ = category_preset;
38 const ScopedVector<BackgroundTracingRule>& rules() const { return rules_; }
40 void AddPreemptiveRule(const base::DictionaryValue* dict);
41 void AddReactiveRule(
42 const base::DictionaryValue* dict,
43 BackgroundTracingConfigImpl::CategoryPreset category_preset);
45 static scoped_ptr<BackgroundTracingConfigImpl> PreemptiveFromDict(
46 const base::DictionaryValue* dict);
47 static scoped_ptr<BackgroundTracingConfigImpl> ReactiveFromDict(
48 const base::DictionaryValue* dict);
50 static scoped_ptr<BackgroundTracingConfigImpl> FromDict(
51 const base::DictionaryValue* dict);
53 static std::string CategoryPresetToString(
54 BackgroundTracingConfigImpl::CategoryPreset category_preset);
55 static bool StringToCategoryPreset(
56 const std::string& category_preset_string,
57 BackgroundTracingConfigImpl::CategoryPreset* category_preset);
59 private:
60 CategoryPreset category_preset_;
61 ScopedVector<BackgroundTracingRule> rules_;
63 DISALLOW_COPY_AND_ASSIGN(BackgroundTracingConfigImpl);
66 } // namespace content
68 #endif // CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_CONFIG_IMPL_H_