| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/leveldb_proto/proto_database_impl.h" | 5 #include "components/leveldb_proto/proto_database_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 KeyValueVector save_entries(1, std::make_pair("foo", "bar")); | 640 KeyValueVector save_entries(1, std::make_pair("foo", "bar")); |
| 641 KeyVector remove_keys; | 641 KeyVector remove_keys; |
| 642 ASSERT_TRUE(db->Save(save_entries, remove_keys)); | 642 ASSERT_TRUE(db->Save(save_entries, remove_keys)); |
| 643 | 643 |
| 644 base::trace_event::MemoryDumpArgs dump_args = { | 644 base::trace_event::MemoryDumpArgs dump_args = { |
| 645 base::trace_event::MemoryDumpLevelOfDetail::DETAILED}; | 645 base::trace_event::MemoryDumpLevelOfDetail::DETAILED}; |
| 646 std::unique_ptr<base::trace_event::ProcessMemoryDump> process_memory_dump( | 646 std::unique_ptr<base::trace_event::ProcessMemoryDump> process_memory_dump( |
| 647 new base::trace_event::ProcessMemoryDump(nullptr, dump_args)); | 647 new base::trace_event::ProcessMemoryDump(nullptr, dump_args)); |
| 648 db->OnMemoryDump(dump_args, process_memory_dump.get()); | 648 db->OnMemoryDump(dump_args, process_memory_dump.get()); |
| 649 | 649 |
| 650 const auto& allocator_dumps = process_memory_dump->allocator_dumps(); | 650 size_t leveldb_dump_count = 0; |
| 651 const char* system_allocator_pool_name = | 651 for (const auto& dump : process_memory_dump->allocator_dumps()) { |
| 652 base::trace_event::MemoryDumpManager::GetInstance() | 652 if (dump.first.find("leveldb/leveldb_proto/") == 0) { |
| 653 ->system_allocator_pool_name(); | 653 leveldb_dump_count++; |
| 654 size_t expected_dump_count = system_allocator_pool_name ? 2 : 1; | 654 } |
| 655 EXPECT_EQ(expected_dump_count, allocator_dumps.size()); | |
| 656 for (const auto& dump : allocator_dumps) { | |
| 657 ASSERT_TRUE(dump.first.find("leveldb/leveldb_proto/") == 0 || | |
| 658 dump.first.find(system_allocator_pool_name) == 0); | |
| 659 } | 655 } |
| 656 ASSERT_EQ(1u, leveldb_dump_count); |
| 660 } | 657 } |
| 661 | 658 |
| 662 } // namespace leveldb_proto | 659 } // namespace leveldb_proto |
| OLD | NEW |