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" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 void(scoped_refptr<base::RefCountedString>)> done_callback); | 56 void(scoped_refptr<base::RefCountedString>)> done_callback); |
57 | 57 |
58 void ReceiveTraceFinalContents(const std::string& file_contents) override; | 58 void ReceiveTraceFinalContents(const std::string& file_contents) override; |
59 | 59 |
60 private: | 60 private: |
61 ~TraceDataEndpointWrapper() override; | 61 ~TraceDataEndpointWrapper() override; |
62 | 62 |
63 base::Callback<void(scoped_refptr<base::RefCountedString>)> done_callback_; | 63 base::Callback<void(scoped_refptr<base::RefCountedString>)> done_callback_; |
64 }; | 64 }; |
65 | 65 |
| 66 class TracingTimer { |
| 67 public: |
| 68 TracingTimer(StartedFinalizingCallback); |
| 69 ~TracingTimer(); |
| 70 |
| 71 void StartTimer(); |
| 72 void CancelTimer(); |
| 73 |
| 74 private: |
| 75 void TracingTimerFired(); |
| 76 |
| 77 base::OneShotTimer<TracingTimer> tracing_timer_; |
| 78 BackgroundTracingManager::StartedFinalizingCallback callback_; |
| 79 }; |
| 80 |
66 scoped_ptr<content::BackgroundTracingConfig> config_; | 81 scoped_ptr<content::BackgroundTracingConfig> config_; |
67 scoped_refptr<TraceDataEndpointWrapper> data_endpoint_wrapper_; | 82 scoped_refptr<TraceDataEndpointWrapper> data_endpoint_wrapper_; |
68 std::map<TriggerHandle, std::string> trigger_handles_; | 83 std::map<TriggerHandle, std::string> trigger_handles_; |
| 84 scoped_ptr<TracingTimer> tracing_timer_; |
69 ReceiveCallback receive_callback_; | 85 ReceiveCallback receive_callback_; |
70 | 86 |
71 bool is_gathering_; | 87 bool is_gathering_; |
72 bool is_tracing_; | 88 bool is_tracing_; |
73 bool requires_anonymized_data_; | 89 bool requires_anonymized_data_; |
74 int trigger_handle_ids_; | 90 int trigger_handle_ids_; |
75 | 91 |
76 IdleCallback idle_callback_; | 92 IdleCallback idle_callback_; |
77 | 93 |
78 friend struct base::DefaultLazyInstanceTraits<BackgroundTracingManagerImpl>; | 94 friend struct base::DefaultLazyInstanceTraits<BackgroundTracingManagerImpl>; |
79 | 95 |
80 DISALLOW_COPY_AND_ASSIGN(BackgroundTracingManagerImpl); | 96 DISALLOW_COPY_AND_ASSIGN(BackgroundTracingManagerImpl); |
81 }; | 97 }; |
82 | 98 |
83 } // namespace content | 99 } // namespace content |
84 | 100 |
85 #endif // CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_MANAGER_IMPL_H_ | 101 #endif // CONTENT_BROWSER_TRACING_BACKGROUND_TRACING_MANAGER_IMPL_H_ |
OLD | NEW |