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_peak_detector.h" | 5 #include "base/trace_event/memory_peak_detector.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 uint32_t GetNumGetDumpProvidersCalls() { | 170 uint32_t GetNumGetDumpProvidersCalls() { |
171 bg_thread_->FlushForTesting(); | 171 bg_thread_->FlushForTesting(); |
172 return get_mdp_call_count_; | 172 return get_mdp_call_count_; |
173 } | 173 } |
174 | 174 |
175 scoped_refptr<MemoryDumpProviderInfo> CreateMockDumpProvider() { | 175 scoped_refptr<MemoryDumpProviderInfo> CreateMockDumpProvider() { |
176 std::unique_ptr<MockMemoryDumpProvider> mdp(new MockMemoryDumpProvider()); | 176 std::unique_ptr<MockMemoryDumpProvider> mdp(new MockMemoryDumpProvider()); |
177 MemoryDumpProvider::Options opt; | 177 MemoryDumpProvider::Options opt; |
178 opt.is_fast_polling_supported = true; | 178 opt.is_fast_polling_supported = true; |
179 scoped_refptr<MemoryDumpProviderInfo> mdp_info( | 179 scoped_refptr<MemoryDumpProviderInfo> mdp_info( |
180 new MemoryDumpProviderInfo(mdp.get(), "Mock MDP", nullptr, opt, false)); | 180 new MemoryDumpProviderInfo(mdp.get(), "Mock MDP", nullptr, opt, |
| 181 false /* whitelisted_for_background_mode */, |
| 182 false /* whitelisted_for_summary_mode */)); |
181 | 183 |
182 // The |mdp| instance will be destroyed together with the |mdp_info|. | 184 // The |mdp| instance will be destroyed together with the |mdp_info|. |
183 mdp_info->owned_dump_provider = std::move(mdp); | 185 mdp_info->owned_dump_provider = std::move(mdp); |
184 return mdp_info; | 186 return mdp_info; |
185 } | 187 } |
186 | 188 |
187 static MockMemoryDumpProvider& GetMockMDP( | 189 static MockMemoryDumpProvider& GetMockMDP( |
188 const scoped_refptr<MemoryDumpProviderInfo>& mdp_info) { | 190 const scoped_refptr<MemoryDumpProviderInfo>& mdp_info) { |
189 return *static_cast<MockMemoryDumpProvider*>(mdp_info->dump_provider); | 191 return *static_cast<MockMemoryDumpProvider*>(mdp_info->dump_provider); |
190 } | 192 } |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 } | 551 } |
550 return PollFunctionThatCausesPeakViaStdDev(sample_idx); | 552 return PollFunctionThatCausesPeakViaStdDev(sample_idx); |
551 }, | 553 }, |
552 Unretained(&*peak_detector_), kSlidingWindowNumSamples, kConfig); | 554 Unretained(&*peak_detector_), kSlidingWindowNumSamples, kConfig); |
553 uint32_t num_peaks = RunWithCustomPollFunction(kConfig, kNumSamples, poll_fn); | 555 uint32_t num_peaks = RunWithCustomPollFunction(kConfig, kNumSamples, poll_fn); |
554 EXPECT_EQ(0u, num_peaks); | 556 EXPECT_EQ(0u, num_peaks); |
555 } | 557 } |
556 | 558 |
557 } // namespace trace_event | 559 } // namespace trace_event |
558 } // namespace base | 560 } // namespace base |
OLD | NEW |