OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_manager.h" | 5 #include "base/trace_event/memory_dump_manager.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 | 767 |
768 RunLoop run_loop; | 768 RunLoop run_loop; |
769 scoped_refptr<SingleThreadTaskRunner> test_task_runner = | 769 scoped_refptr<SingleThreadTaskRunner> test_task_runner = |
770 ThreadTaskRunnerHandle::Get(); | 770 ThreadTaskRunnerHandle::Get(); |
771 auto quit_closure = run_loop.QuitClosure(); | 771 auto quit_closure = run_loop.QuitClosure(); |
772 | 772 |
773 const int kPollsToQuit = 10; | 773 const int kPollsToQuit = 10; |
774 int call_count = 0; | 774 int call_count = 0; |
775 MemoryDumpManager* mdm = mdm_.get(); | 775 MemoryDumpManager* mdm = mdm_.get(); |
776 const auto poll_function1 = [&call_count, &test_task_runner, quit_closure, | 776 const auto poll_function1 = [&call_count, &test_task_runner, quit_closure, |
777 &mdp2, mdm, &options, kPollsToQuit, | 777 &mdp2, mdm, &options](uint64_t* total) -> void { |
778 this](uint64_t* total) -> void { | |
779 ++call_count; | 778 ++call_count; |
780 if (call_count == 1) | 779 if (call_count == 1) |
781 RegisterDumpProvider(mdp2.get(), nullptr, options, kMDPName); | 780 RegisterDumpProvider(mdp2.get(), nullptr, options, kMDPName); |
782 else if (call_count == 4) | 781 else if (call_count == 4) |
783 mdm->UnregisterAndDeleteDumpProviderSoon(std::move(mdp2)); | 782 mdm->UnregisterAndDeleteDumpProviderSoon(std::move(mdp2)); |
784 else if (call_count == kPollsToQuit) | 783 else if (call_count == kPollsToQuit) |
785 test_task_runner->PostTask(FROM_HERE, quit_closure); | 784 test_task_runner->PostTask(FROM_HERE, quit_closure); |
786 | 785 |
787 // Record increase of 1 GiB of memory at each call. | 786 // Record increase of 1 GiB of memory at each call. |
788 *total = static_cast<uint64_t>(call_count) * 1024 * 1024 * 1024; | 787 *total = static_cast<uint64_t>(call_count) * 1024 * 1024 * 1024; |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 thread.Start(); | 1285 thread.Start(); |
1287 RegisterDumpProvider(&mdp1, thread.task_runner(), kDefaultOptions, | 1286 RegisterDumpProvider(&mdp1, thread.task_runner(), kDefaultOptions, |
1288 "BlacklistTestDumpProvider"); | 1287 "BlacklistTestDumpProvider"); |
1289 // Unregistering on wrong thread should not crash. | 1288 // Unregistering on wrong thread should not crash. |
1290 mdm_->UnregisterDumpProvider(&mdp1); | 1289 mdm_->UnregisterDumpProvider(&mdp1); |
1291 thread.Stop(); | 1290 thread.Stop(); |
1292 } | 1291 } |
1293 | 1292 |
1294 } // namespace trace_event | 1293 } // namespace trace_event |
1295 } // namespace base | 1294 } // namespace base |
OLD | NEW |