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

Side by Side Diff: base/trace_event/memory_peak_detector_unittest.cc

Issue 2876543002: memory-infra: Don't invoke all dump providers in SUMMARY_ONLY mode (Closed)
Patch Set: fix comment 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 #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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 169
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(new MemoryDumpProviderInfo(
180 new MemoryDumpProviderInfo(mdp.get(), "Mock MDP", nullptr, opt, false)); 180 mdp.get(), "Mock MDP", nullptr, opt, false, false));
ssid 2017/05/10 17:43:08 nit: can you make it false /* whitelisted_for_bac
hjd 2017/05/15 12:02:27 Done.
181 181
182 // The |mdp| instance will be destroyed together with the |mdp_info|. 182 // The |mdp| instance will be destroyed together with the |mdp_info|.
183 mdp_info->owned_dump_provider = std::move(mdp); 183 mdp_info->owned_dump_provider = std::move(mdp);
184 return mdp_info; 184 return mdp_info;
185 } 185 }
186 186
187 static MockMemoryDumpProvider& GetMockMDP( 187 static MockMemoryDumpProvider& GetMockMDP(
188 const scoped_refptr<MemoryDumpProviderInfo>& mdp_info) { 188 const scoped_refptr<MemoryDumpProviderInfo>& mdp_info) {
189 return *static_cast<MockMemoryDumpProvider*>(mdp_info->dump_provider); 189 return *static_cast<MockMemoryDumpProvider*>(mdp_info->dump_provider);
190 } 190 }
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 } 549 }
550 return PollFunctionThatCausesPeakViaStdDev(sample_idx); 550 return PollFunctionThatCausesPeakViaStdDev(sample_idx);
551 }, 551 },
552 Unretained(&*peak_detector_), kSlidingWindowNumSamples, kConfig); 552 Unretained(&*peak_detector_), kSlidingWindowNumSamples, kConfig);
553 uint32_t num_peaks = RunWithCustomPollFunction(kConfig, kNumSamples, poll_fn); 553 uint32_t num_peaks = RunWithCustomPollFunction(kConfig, kNumSamples, poll_fn);
554 EXPECT_EQ(0u, num_peaks); 554 EXPECT_EQ(0u, num_peaks);
555 } 555 }
556 556
557 } // namespace trace_event 557 } // namespace trace_event
558 } // namespace base 558 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698