OLD | NEW |
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 #include "base/trace_event/memory_dump_provider_info.h" | 5 #include "base/trace_event/memory_dump_provider_info.h" |
6 | 6 |
7 #include <tuple> | 7 #include <tuple> |
8 | 8 |
9 #include "base/sequenced_task_runner.h" | 9 #include "base/sequenced_task_runner.h" |
10 | 10 |
11 namespace base { | 11 namespace base { |
12 namespace trace_event { | 12 namespace trace_event { |
13 | 13 |
14 MemoryDumpProviderInfo::MemoryDumpProviderInfo( | 14 MemoryDumpProviderInfo::MemoryDumpProviderInfo( |
15 MemoryDumpProvider* dump_provider, | 15 MemoryDumpProvider* dump_provider, |
16 const char* name, | 16 const char* name, |
17 scoped_refptr<SequencedTaskRunner> task_runner, | 17 scoped_refptr<SequencedTaskRunner> task_runner, |
18 const MemoryDumpProvider::Options& options, | 18 const MemoryDumpProvider::Options& options, |
19 bool whitelisted_for_background_mode) | 19 bool whitelisted_for_background_mode, |
| 20 bool whitelisted_for_summary_mode) |
20 : dump_provider(dump_provider), | 21 : dump_provider(dump_provider), |
21 options(options), | 22 options(options), |
22 name(name), | 23 name(name), |
23 task_runner(std::move(task_runner)), | 24 task_runner(std::move(task_runner)), |
24 whitelisted_for_background_mode(whitelisted_for_background_mode), | 25 whitelisted_for_background_mode(whitelisted_for_background_mode), |
| 26 whitelisted_for_summary_mode(whitelisted_for_summary_mode), |
25 consecutive_failures(0), | 27 consecutive_failures(0), |
26 disabled(false) {} | 28 disabled(false) {} |
27 | 29 |
28 MemoryDumpProviderInfo::~MemoryDumpProviderInfo() {} | 30 MemoryDumpProviderInfo::~MemoryDumpProviderInfo() {} |
29 | 31 |
30 bool MemoryDumpProviderInfo::Comparator::operator()( | 32 bool MemoryDumpProviderInfo::Comparator::operator()( |
31 const scoped_refptr<MemoryDumpProviderInfo>& a, | 33 const scoped_refptr<MemoryDumpProviderInfo>& a, |
32 const scoped_refptr<MemoryDumpProviderInfo>& b) const { | 34 const scoped_refptr<MemoryDumpProviderInfo>& b) const { |
33 if (!a || !b) | 35 if (!a || !b) |
34 return a.get() < b.get(); | 36 return a.get() < b.get(); |
35 // Ensure that unbound providers (task_runner == nullptr) always run last. | 37 // Ensure that unbound providers (task_runner == nullptr) always run last. |
36 // Rationale: some unbound dump providers are known to be slow, keep them last | 38 // Rationale: some unbound dump providers are known to be slow, keep them last |
37 // to avoid skewing timings of the other dump providers. | 39 // to avoid skewing timings of the other dump providers. |
38 return std::tie(a->task_runner, a->dump_provider) > | 40 return std::tie(a->task_runner, a->dump_provider) > |
39 std::tie(b->task_runner, b->dump_provider); | 41 std::tie(b->task_runner, b->dump_provider); |
40 } | 42 } |
41 | 43 |
42 } // namespace trace_event | 44 } // namespace trace_event |
43 } // namespace base | 45 } // namespace base |
OLD | NEW |