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_MANAGER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_MANAGER_IMPL_H_ |
6 #define CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_MANAGER_IMPL_H_ | 6 #define CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_MANAGER_IMPL_H_ |
7 | 7 |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "content/browser/tracing/tracing_controller_impl.h" | 12 #include "content/browser/tracing/tracing_controller_impl.h" |
13 #include "content/public/browser/background_tracing_config.h" | 13 #include "content/public/browser/background_tracing_config.h" |
14 #include "content/public/browser/background_tracing_manager.h" | 14 #include "content/public/browser/background_tracing_manager.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
| 18 class TracingDelegate; |
| 19 |
18 class BackgroundTracingManagerImpl : public content::BackgroundTracingManager { | 20 class BackgroundTracingManagerImpl : public content::BackgroundTracingManager { |
19 public: | 21 public: |
20 static BackgroundTracingManagerImpl* GetInstance(); | 22 static BackgroundTracingManagerImpl* GetInstance(); |
21 | 23 |
22 bool SetActiveScenario(scoped_ptr<BackgroundTracingConfig>, | 24 bool SetActiveScenario(scoped_ptr<BackgroundTracingConfig>, |
23 const ReceiveCallback&, | 25 const ReceiveCallback&, |
24 bool) override; | 26 bool) override; |
25 void WhenIdle(IdleCallback idle_callback) override; | 27 void WhenIdle(IdleCallback idle_callback) override; |
26 | 28 |
27 void TriggerNamedEvent(TriggerHandle, StartedFinalizingCallback) override; | 29 void TriggerNamedEvent(TriggerHandle, StartedFinalizingCallback) override; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 77 |
76 void FireTimerForTesting(); | 78 void FireTimerForTesting(); |
77 | 79 |
78 private: | 80 private: |
79 void TracingTimerFired(); | 81 void TracingTimerFired(); |
80 | 82 |
81 base::OneShotTimer<TracingTimer> tracing_timer_; | 83 base::OneShotTimer<TracingTimer> tracing_timer_; |
82 StartedFinalizingCallback callback_; | 84 StartedFinalizingCallback callback_; |
83 }; | 85 }; |
84 | 86 |
| 87 scoped_ptr<TracingDelegate> delegate_; |
85 scoped_ptr<content::BackgroundTracingConfig> config_; | 88 scoped_ptr<content::BackgroundTracingConfig> config_; |
86 scoped_refptr<TraceDataEndpointWrapper> data_endpoint_wrapper_; | 89 scoped_refptr<TraceDataEndpointWrapper> data_endpoint_wrapper_; |
87 std::map<TriggerHandle, std::string> trigger_handles_; | 90 std::map<TriggerHandle, std::string> trigger_handles_; |
88 scoped_ptr<TracingTimer> tracing_timer_; | 91 scoped_ptr<TracingTimer> tracing_timer_; |
89 ReceiveCallback receive_callback_; | 92 ReceiveCallback receive_callback_; |
90 | 93 |
91 bool is_gathering_; | 94 bool is_gathering_; |
92 bool is_tracing_; | 95 bool is_tracing_; |
93 bool requires_anonymized_data_; | 96 bool requires_anonymized_data_; |
94 int trigger_handle_ids_; | 97 int trigger_handle_ids_; |
95 | 98 |
96 IdleCallback idle_callback_; | 99 IdleCallback idle_callback_; |
97 | 100 |
98 friend struct base::DefaultLazyInstanceTraits<BackgroundTracingManagerImpl>; | 101 friend struct base::DefaultLazyInstanceTraits<BackgroundTracingManagerImpl>; |
99 | 102 |
100 DISALLOW_COPY_AND_ASSIGN(BackgroundTracingManagerImpl); | 103 DISALLOW_COPY_AND_ASSIGN(BackgroundTracingManagerImpl); |
101 }; | 104 }; |
102 | 105 |
103 } // namespace content | 106 } // namespace content |
104 | 107 |
105 #endif // CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_MANAGER_IMPL_H_ | 108 #endif // CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_MANAGER_IMPL_H_ |
OLD | NEW |