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

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

Issue 2876543002: memory-infra: Don't invoke all dump providers in SUMMARY_ONLY mode (Closed)
Patch Set: address comments Created 3 years, 7 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
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 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 BASE_TRACE_EVENT_MEMORY_DUMP_PROVIDER_INFO_H_ 5 #ifndef BASE_TRACE_EVENT_MEMORY_DUMP_PROVIDER_INFO_H_
6 #define BASE_TRACE_EVENT_MEMORY_DUMP_PROVIDER_INFO_H_ 6 #define BASE_TRACE_EVENT_MEMORY_DUMP_PROVIDER_INFO_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 bool operator()(const scoped_refptr<MemoryDumpProviderInfo>& a, 51 bool operator()(const scoped_refptr<MemoryDumpProviderInfo>& a,
52 const scoped_refptr<MemoryDumpProviderInfo>& b) const; 52 const scoped_refptr<MemoryDumpProviderInfo>& b) const;
53 }; 53 };
54 using OrderedSet = 54 using OrderedSet =
55 std::set<scoped_refptr<MemoryDumpProviderInfo>, Comparator>; 55 std::set<scoped_refptr<MemoryDumpProviderInfo>, Comparator>;
56 56
57 MemoryDumpProviderInfo(MemoryDumpProvider* dump_provider, 57 MemoryDumpProviderInfo(MemoryDumpProvider* dump_provider,
58 const char* name, 58 const char* name,
59 scoped_refptr<SequencedTaskRunner> task_runner, 59 scoped_refptr<SequencedTaskRunner> task_runner,
60 const MemoryDumpProvider::Options& options, 60 const MemoryDumpProvider::Options& options,
61 bool whitelisted_for_background_mode); 61 bool whitelisted_for_background_mode,
62 bool whitelisted_for_summary_mode);
62 63
63 // It is safe to access the const fields below from any thread as they are 64 // It is safe to access the const fields below from any thread as they are
64 // never mutated. 65 // never mutated.
65 66
66 MemoryDumpProvider* const dump_provider; 67 MemoryDumpProvider* const dump_provider;
67 68
68 // The |options| arg passed to MDM::RegisterDumpProvider(). 69 // The |options| arg passed to MDM::RegisterDumpProvider().
69 const MemoryDumpProvider::Options options; 70 const MemoryDumpProvider::Options options;
70 71
71 // Human readable name, not unique (distinct MDP instances might have the same 72 // Human readable name, not unique (distinct MDP instances might have the same
72 // name). Used for debugging, testing and whitelisting for BACKGROUND mode. 73 // name). Used for debugging, testing and whitelisting for BACKGROUND mode.
73 const char* const name; 74 const char* const name;
74 75
75 // The task runner on which the MDP::OnMemoryDump call should be posted onto. 76 // The task runner on which the MDP::OnMemoryDump call should be posted onto.
76 // Can be nullptr, in which case the MDP will be invoked on a background 77 // Can be nullptr, in which case the MDP will be invoked on a background
77 // thread handled by MDM. 78 // thread handled by MDM.
78 const scoped_refptr<SequencedTaskRunner> task_runner; 79 const scoped_refptr<SequencedTaskRunner> task_runner;
79 80
80 // True if the dump provider is whitelisted for background mode. 81 // True if the dump provider is whitelisted for background mode.
81 const bool whitelisted_for_background_mode; 82 const bool whitelisted_for_background_mode;
82 83
84 // True if the dump provider is whitelisted for summary mode.
85 const bool whitelisted_for_summary_mode;
86
83 // These fields below, instead, are not thread safe and can be mutated only: 87 // These fields below, instead, are not thread safe and can be mutated only:
84 // - On the |task_runner|, when not null (i.e. for thread-bound MDPS). 88 // - On the |task_runner|, when not null (i.e. for thread-bound MDPS).
85 // - By the MDM's background thread (or in any other way that guarantees 89 // - By the MDM's background thread (or in any other way that guarantees
86 // sequencing) for non-thread-bound MDPs. 90 // sequencing) for non-thread-bound MDPs.
87 91
88 // Used to transfer ownership for UnregisterAndDeleteDumpProviderSoon(). 92 // Used to transfer ownership for UnregisterAndDeleteDumpProviderSoon().
89 // nullptr in all other cases. 93 // nullptr in all other cases.
90 std::unique_ptr<MemoryDumpProvider> owned_dump_provider; 94 std::unique_ptr<MemoryDumpProvider> owned_dump_provider;
91 95
92 // For fail-safe logic (auto-disable failing MDPs). 96 // For fail-safe logic (auto-disable failing MDPs).
93 int consecutive_failures; 97 int consecutive_failures;
94 98
95 // Flagged either by the auto-disable logic or during unregistration. 99 // Flagged either by the auto-disable logic or during unregistration.
96 bool disabled; 100 bool disabled;
97 101
98 private: 102 private:
99 friend class base::RefCountedThreadSafe<MemoryDumpProviderInfo>; 103 friend class base::RefCountedThreadSafe<MemoryDumpProviderInfo>;
100 ~MemoryDumpProviderInfo(); 104 ~MemoryDumpProviderInfo();
101 105
102 DISALLOW_COPY_AND_ASSIGN(MemoryDumpProviderInfo); 106 DISALLOW_COPY_AND_ASSIGN(MemoryDumpProviderInfo);
103 }; 107 };
104 108
105 } // namespace trace_event 109 } // namespace trace_event
106 } // namespace base 110 } // namespace base
107 111
108 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_PROVIDER_INFO_H_ 112 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_PROVIDER_INFO_H_
OLDNEW
« no previous file with comments | « base/trace_event/memory_dump_manager_unittest.cc ('k') | base/trace_event/memory_dump_provider_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698