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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 const uint32_t kNumInitialThreads = 8; | 466 const uint32_t kNumInitialThreads = 8; |
467 | 467 |
468 std::vector<std::unique_ptr<Thread>> threads; | 468 std::vector<std::unique_ptr<Thread>> threads; |
469 std::vector<std::unique_ptr<MockMemoryDumpProvider>> mdps; | 469 std::vector<std::unique_ptr<MockMemoryDumpProvider>> mdps; |
470 | 470 |
471 // Create the threads and setup the expectations. Given that at each iteration | 471 // Create the threads and setup the expectations. Given that at each iteration |
472 // we will pop out one thread/MemoryDumpProvider, each MDP is supposed to be | 472 // we will pop out one thread/MemoryDumpProvider, each MDP is supposed to be |
473 // invoked a number of times equal to its index. | 473 // invoked a number of times equal to its index. |
474 for (uint32_t i = kNumInitialThreads; i > 0; --i) { | 474 for (uint32_t i = kNumInitialThreads; i > 0; --i) { |
475 threads.push_back(WrapUnique(new Thread("test thread"))); | 475 threads.push_back(WrapUnique(new Thread("test thread"))); |
476 auto thread = threads.back().get(); | 476 auto* thread = threads.back().get(); |
477 thread->Start(); | 477 thread->Start(); |
478 scoped_refptr<SingleThreadTaskRunner> task_runner = thread->task_runner(); | 478 scoped_refptr<SingleThreadTaskRunner> task_runner = thread->task_runner(); |
479 mdps.push_back(WrapUnique(new MockMemoryDumpProvider())); | 479 mdps.push_back(WrapUnique(new MockMemoryDumpProvider())); |
480 auto mdp = mdps.back().get(); | 480 auto* mdp = mdps.back().get(); |
481 RegisterDumpProvider(mdp, task_runner, kDefaultOptions); | 481 RegisterDumpProvider(mdp, task_runner, kDefaultOptions); |
482 EXPECT_CALL(*mdp, OnMemoryDump(_, _)) | 482 EXPECT_CALL(*mdp, OnMemoryDump(_, _)) |
483 .Times(i) | 483 .Times(i) |
484 .WillRepeatedly(Invoke( | 484 .WillRepeatedly(Invoke( |
485 [task_runner](const MemoryDumpArgs&, ProcessMemoryDump*) -> bool { | 485 [task_runner](const MemoryDumpArgs&, ProcessMemoryDump*) -> bool { |
486 EXPECT_TRUE(task_runner->RunsTasksOnCurrentThread()); | 486 EXPECT_TRUE(task_runner->RunsTasksOnCurrentThread()); |
487 return true; | 487 return true; |
488 })); | 488 })); |
489 } | 489 } |
490 EnableTracingWithLegacyCategories(MemoryDumpManager::kTraceCategory); | 490 EnableTracingWithLegacyCategories(MemoryDumpManager::kTraceCategory); |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 MemoryDumpLevelOfDetail::DETAILED); | 1162 MemoryDumpLevelOfDetail::DETAILED); |
1163 EXPECT_FALSE(last_callback_success_); | 1163 EXPECT_FALSE(last_callback_success_); |
1164 | 1164 |
1165 ASSERT_TRUE(IsPeriodicDumpingEnabled()); | 1165 ASSERT_TRUE(IsPeriodicDumpingEnabled()); |
1166 run_loop.Run(); | 1166 run_loop.Run(); |
1167 DisableTracing(); | 1167 DisableTracing(); |
1168 } | 1168 } |
1169 | 1169 |
1170 } // namespace trace_event | 1170 } // namespace trace_event |
1171 } // namespace base | 1171 } // namespace base |
OLD | NEW |