OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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 BASE_TRACE_EVENT_MEMORY_TRACING_OBSERVER_H_ | |
6 #define BASE_TRACE_EVENT_MEMORY_TRACING_OBSERVER_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "base/trace_event/memory_dump_manager.h" | |
10 #include "base/trace_event/trace_event.h" | |
11 | |
12 namespace base { | |
13 | |
14 namespace trace_event { | |
15 | |
16 // Observes TraceLog for Enable/Disable events and when they occur Enables and | |
17 // Disables the MemoryDumpManager with the correct state based on reading the | |
18 // trace log. Also provides a method for adding a dump to the trace. | |
19 class BASE_EXPORT MemoryTracingObserver | |
20 : public TraceLog::EnabledStateObserver { | |
21 public: | |
22 static const char* const kTraceCategory; | |
23 bool AddDumpToTraceIfEnabled(const MemoryDumpRequestArgs*, | |
Primiano Tucci (use gerrit)
2017/04/21 13:14:17
nit: now that is not a static move this down, ctor
hjd
2017/04/21 13:42:32
Done.
| |
24 const ProcessId, | |
25 const ProcessMemoryDump*); | |
26 | |
27 MemoryTracingObserver(TraceLog*, MemoryDumpManager*); | |
28 ~MemoryTracingObserver() override; | |
29 | |
30 // TraceLog::EnabledStateObserver implementation. | |
31 void OnTraceLogEnabled() override; | |
32 void OnTraceLogDisabled() override; | |
33 | |
34 private: | |
35 bool enabled_; | |
36 MemoryDumpManager* const memory_dump_manager_; | |
37 TraceLog* const trace_log_; | |
38 | |
39 DISALLOW_COPY_AND_ASSIGN(MemoryTracingObserver); | |
40 }; | |
41 | |
42 } // namespace trace_event | |
43 } // namespace base | |
44 | |
45 #endif // BASE_TRACE_EVENT_MEMORY_TRACING_OBSERVER_H_ | |
OLD | NEW |