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

Side by Side Diff: base/trace_event/memory_tracing_observer.h

Issue 2820433005: memory-infra: Start disentangling tracing from memory-infra (Closed)
Patch Set: pass config in Created 3 years, 8 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 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/trace_event/memory_dump_manager.h"
9 #include "base/trace_event/trace_event.h"
10
11 namespace base {
12
13 namespace trace_event {
14
15 // Observes TraceLog for Enable/Disable events and sets the correct state in
16 // MemoryDumpManager to handle XXX.
Primiano Tucci (use gerrit) 2017/04/21 10:10:27 xxx? :)
hjd 2017/04/21 11:51:58 Done.
17 class BASE_EXPORT MemoryTracingObserver
18 : public TraceLog::EnabledStateObserver {
19 public:
20 static const char* const kTraceCategory;
21 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.
22 const ProcessId,
23 const ProcessMemoryDump*);
24
25 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
26 ~MemoryTracingObserver() override;
27
28 // TraceLog::EnabledStateObserver implementation.
29 void OnTraceLogEnabled() override;
30 void OnTraceLogDisabled() override;
31
32 private:
33 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.
34 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.
35 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,
36 TraceLog* trace_log_;
37 };
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.
38
39 } // namespace trace_event
40 } // namespace base
41
42 #endif // BASE_TRACE_EVENT_MEMORY_TRACING_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698