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

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

Issue 1002103004: NOT FOR REVIEW - Slow Reports Reference Implementation Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup WIP. Created 5 years, 7 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
(Empty)
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.
4
5 #ifndef CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_MANAGER_IMPL_H_
6 #define CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_MANAGER_IMPL_H_
7
8 #include "base/lazy_instance.h"
9 #include "base/memory/ref_counted_memory.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/trace_event/trace_event_impl.h"
13 #include "content/public/browser/background_tracing_manager.h"
14
15 namespace content {
16
17 class BackgroundTracingManagerImpl : public content::BackgroundTracingManager {
18 public:
19 static BackgroundTracingManagerImpl* GetInstance();
20
21 bool SetActiveScenario(
22 scoped_refptr<content::BackgroundTracingConfig>,
23 scoped_refptr<content::BackgroundTracingManager::UploadSink>) override;
24 void WhenIdle(IdleCallback idle_callback) override;
25
26 void DidTriggerHappen(TriggerHandle, StartedFinalizingCallback) override;
27 TriggerHandle RegisterTriggerType(const char* trigger_name) override;
28 void GetTriggerNameList(std::vector<std::string>& trigger_names) override;
29 void InvalidateTriggerHandlesForTesting() override;
30
31 private:
32 BackgroundTracingManagerImpl();
33 ~BackgroundTracingManagerImpl() override;
34
35 void EnableRecording(base::trace_event::CategoryFilter);
36 void MaybeEnableRecording();
37 void OnFinalizeComplete();
38 void BeginFinalizing(StartedFinalizingCallback);
39
40 std::string GetTriggerNameFromHandle(TriggerHandle handle) const;
41 bool IsTriggerHandleValid(TriggerHandle handle) const;
42
43 bool IsAbleToStartTracing(TriggerHandle handle) const;
44
45 base::trace_event::CategoryFilter GetCategoryFilterForCategoryPreset(
46 BackgroundTracingConfig::CategoryPreset) const;
47
48 scoped_refptr<content::BackgroundTracingConfig> config_;
49 scoped_refptr<content::BackgroundTracingManager::UploadSink> upload_sink_;
50 std::vector<std::string> trigger_handles_;
51
52 bool is_idle_;
53 bool is_gathering_;
54
55 IdleCallback idle_callback_;
56
57 friend struct base::DefaultLazyInstanceTraits<BackgroundTracingManagerImpl>;
58
59 DISALLOW_COPY_AND_ASSIGN(BackgroundTracingManagerImpl);
60 };
61
62 } // namespace content
63
64 #endif // CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698