OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/dom_storage/session_storage_database.h" | 5 #include "content/browser/dom_storage/session_storage_database.h" |
6 | 6 |
| 7 #include <inttypes.h> |
7 #include <stddef.h> | 8 #include <stddef.h> |
8 | 9 |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 bool res = | 339 bool res = |
339 db_->GetProperty("leveldb.approximate-memory-usage", &db_memory_usage); | 340 db_->GetProperty("leveldb.approximate-memory-usage", &db_memory_usage); |
340 DCHECK(res); | 341 DCHECK(res); |
341 } | 342 } |
342 | 343 |
343 uint64_t size; | 344 uint64_t size; |
344 bool res = base::StringToUint64(db_memory_usage, &size); | 345 bool res = base::StringToUint64(db_memory_usage, &size); |
345 DCHECK(res); | 346 DCHECK(res); |
346 | 347 |
347 auto mad = pmd->CreateAllocatorDump( | 348 auto mad = pmd->CreateAllocatorDump( |
348 base::StringPrintf("dom_storage/session_storage_%p", this)); | 349 base::StringPrintf("dom_storage/session_storage_0x%" PRIXPTR, |
| 350 reinterpret_cast<uintptr_t>(this))); |
349 mad->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 351 mad->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
350 base::trace_event::MemoryAllocatorDump::kUnitsBytes, size); | 352 base::trace_event::MemoryAllocatorDump::kUnitsBytes, size); |
351 | 353 |
352 // Memory is allocated from system allocator (malloc). | 354 // Memory is allocated from system allocator (malloc). |
353 const char* system_allocator_name = | 355 const char* system_allocator_name = |
354 base::trace_event::MemoryDumpManager::GetInstance() | 356 base::trace_event::MemoryDumpManager::GetInstance() |
355 ->system_allocator_pool_name(); | 357 ->system_allocator_pool_name(); |
356 if (system_allocator_name) | 358 if (system_allocator_name) |
357 pmd->AddSuballocation(mad->guid(), system_allocator_name); | 359 pmd->AddSuballocation(mad->guid(), system_allocator_name); |
358 } | 360 } |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 std::string SessionStorageDatabase::MapKey(const std::string& map_id, | 762 std::string SessionStorageDatabase::MapKey(const std::string& map_id, |
761 const std::string& key) { | 763 const std::string& key) { |
762 return base::StringPrintf("map-%s-%s", map_id.c_str(), key.c_str()); | 764 return base::StringPrintf("map-%s-%s", map_id.c_str(), key.c_str()); |
763 } | 765 } |
764 | 766 |
765 const char* SessionStorageDatabase::NextMapIdKey() { | 767 const char* SessionStorageDatabase::NextMapIdKey() { |
766 return "next-map-id"; | 768 return "next-map-id"; |
767 } | 769 } |
768 | 770 |
769 } // namespace content | 771 } // namespace content |
OLD | NEW |