Chromium Code Reviews| Index: base/trace_event/memory_tracing_observer.h |
| diff --git a/base/trace_event/memory_tracing_observer.h b/base/trace_event/memory_tracing_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..65135ecb5b6da90c547151b92dd3c031f5c4287d |
| --- /dev/null |
| +++ b/base/trace_event/memory_tracing_observer.h |
| @@ -0,0 +1,42 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef BASE_TRACE_EVENT_MEMORY_TRACING_OBSERVER_H_ |
| +#define BASE_TRACE_EVENT_MEMORY_TRACING_OBSERVER_H_ |
| + |
| +#include "base/trace_event/memory_dump_manager.h" |
| +#include "base/trace_event/trace_event.h" |
| + |
| +namespace base { |
| + |
| +namespace trace_event { |
| + |
| +// Observes TraceLog for Enable/Disable events and sets the correct state in |
| +// MemoryDumpManager to handle XXX. |
|
Primiano Tucci (use gerrit)
2017/04/21 10:10:27
xxx? :)
hjd
2017/04/21 11:51:58
Done.
|
| +class BASE_EXPORT MemoryTracingObserver |
| + : public TraceLog::EnabledStateObserver { |
| + public: |
| + static const char* const kTraceCategory; |
| + static void MaybeAddDumpToTrace(const MemoryDumpRequestArgs*, |
|
Primiano Tucci (use gerrit)
2017/04/21 10:10:27
plz make this non-static. It's always weird to see
hjd
2017/04/21 11:51:58
Done.
|
| + const ProcessId, |
| + const ProcessMemoryDump*); |
| + |
| + MemoryTracingObserver(TraceLog*, MemoryDumpManager*); |
|
Primiano Tucci (use gerrit)
2017/04/21 10:10:27
since we don't have any testing need, I'd just use
hjd
2017/04/21 11:51:58
It seems to me that using the singletons directly
Primiano Tucci (use gerrit)
2017/04/21 13:14:16
I might be overlooking some future plan, but is th
|
| + ~MemoryTracingObserver() override; |
| + |
| + // TraceLog::EnabledStateObserver implementation. |
| + void OnTraceLogEnabled() override; |
| + void OnTraceLogDisabled() override; |
| + |
| + private: |
| + static bool IsMemoryInfraTracingEnabled(); |
|
Primiano Tucci (use gerrit)
2017/04/21 10:10:27
I think this can be just a method in the anonymous
hjd
2017/04/21 11:51:58
Done.
|
| + bool enabled_; |
|
Primiano Tucci (use gerrit)
2017/04/21 10:10:27
nit: add a blank line between functions and var de
hjd
2017/04/21 11:51:58
Done.
|
| + MemoryDumpManager* memory_dump_manager_; |
|
Primiano Tucci (use gerrit)
2017/04/21 10:10:27
make both const variables (not pointers), as they
hjd
2017/04/21 11:51:58
See comment above,
|
| + TraceLog* trace_log_; |
| +}; |
|
Primiano Tucci (use gerrit)
2017/04/21 10:10:27
DISALLOW_COPY_AND_ASSIGN ( +include base/macros.h)
hjd
2017/04/21 11:51:58
Done.
|
| + |
| +} // namespace trace_event |
| +} // namespace base |
| + |
| +#endif // BASE_TRACE_EVENT_MEMORY_TRACING_OBSERVER_H_ |