OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/browser/indexed_db/leveldb/leveldb_database.h" | 5 #include "content/browser/indexed_db/leveldb/leveldb_database.h" |
6 | 6 |
7 #include <inttypes.h> | 7 #include <inttypes.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <cerrno> | 10 #include <cerrno> |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 base::trace_event::ProcessMemoryDump* pmd) { | 454 base::trace_event::ProcessMemoryDump* pmd) { |
455 if (!db_) | 455 if (!db_) |
456 return false; | 456 return false; |
457 | 457 |
458 std::string value; | 458 std::string value; |
459 uint64_t size; | 459 uint64_t size; |
460 bool res = db_->GetProperty("leveldb.approximate-memory-usage", &value); | 460 bool res = db_->GetProperty("leveldb.approximate-memory-usage", &value); |
461 DCHECK(res); | 461 DCHECK(res); |
462 base::StringToUint64(value, &size); | 462 base::StringToUint64(value, &size); |
463 | 463 |
464 auto dump = pmd->CreateAllocatorDump(base::StringPrintf( | 464 auto* dump = pmd->CreateAllocatorDump(base::StringPrintf( |
465 "leveldb/index_db/0x%" PRIXPTR, reinterpret_cast<uintptr_t>(db_.get()))); | 465 "leveldb/index_db/0x%" PRIXPTR, reinterpret_cast<uintptr_t>(db_.get()))); |
466 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 466 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
467 base::trace_event::MemoryAllocatorDump::kUnitsBytes, size); | 467 base::trace_event::MemoryAllocatorDump::kUnitsBytes, size); |
468 dump->AddString("file_name", "", file_name_for_tracing); | 468 dump->AddString("file_name", "", file_name_for_tracing); |
469 | 469 |
470 // Memory is allocated from system allocator (malloc). | 470 // Memory is allocated from system allocator (malloc). |
471 pmd->AddSuballocation(dump->guid(), | 471 pmd->AddSuballocation(dump->guid(), |
472 base::trace_event::MemoryDumpManager::GetInstance() | 472 base::trace_event::MemoryDumpManager::GetInstance() |
473 ->system_allocator_pool_name()); | 473 ->system_allocator_pool_name()); |
474 return true; | 474 return true; |
475 } | 475 } |
476 | 476 |
477 } // namespace content | 477 } // namespace content |
OLD | NEW |