| 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/dom_storage_area.h" | 5 #include "content/browser/dom_storage/dom_storage_area.h" |
| 6 | 6 |
| 7 #include <inttypes.h> | 7 #include <inttypes.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cctype> // for std::isalnum | 10 #include <cctype> // for std::isalnum |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 url[index] = '_'; | 350 url[index] = '_'; |
| 351 } | 351 } |
| 352 std::string name = | 352 std::string name = |
| 353 base::StringPrintf("dom_storage/%s/0x%" PRIXPTR, url.c_str(), | 353 base::StringPrintf("dom_storage/%s/0x%" PRIXPTR, url.c_str(), |
| 354 reinterpret_cast<uintptr_t>(this)); | 354 reinterpret_cast<uintptr_t>(this)); |
| 355 | 355 |
| 356 const char* system_allocator_name = | 356 const char* system_allocator_name = |
| 357 base::trace_event::MemoryDumpManager::GetInstance() | 357 base::trace_event::MemoryDumpManager::GetInstance() |
| 358 ->system_allocator_pool_name(); | 358 ->system_allocator_pool_name(); |
| 359 if (commit_batch_) { | 359 if (commit_batch_) { |
| 360 auto commit_batch_mad = pmd->CreateAllocatorDump(name + "/commit_batch"); | 360 auto* commit_batch_mad = pmd->CreateAllocatorDump(name + "/commit_batch"); |
| 361 commit_batch_mad->AddScalar( | 361 commit_batch_mad->AddScalar( |
| 362 base::trace_event::MemoryAllocatorDump::kNameSize, | 362 base::trace_event::MemoryAllocatorDump::kNameSize, |
| 363 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 363 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 364 commit_batch_->GetDataSize()); | 364 commit_batch_->GetDataSize()); |
| 365 if (system_allocator_name) | 365 if (system_allocator_name) |
| 366 pmd->AddSuballocation(commit_batch_mad->guid(), system_allocator_name); | 366 pmd->AddSuballocation(commit_batch_mad->guid(), system_allocator_name); |
| 367 } | 367 } |
| 368 | 368 |
| 369 // Do not add storage map usage if less than 1KB. | 369 // Do not add storage map usage if less than 1KB. |
| 370 if (map_->bytes_used() < 1024) | 370 if (map_->bytes_used() < 1024) |
| 371 return; | 371 return; |
| 372 | 372 |
| 373 auto map_mad = pmd->CreateAllocatorDump(name + "/storage_map"); | 373 auto* map_mad = pmd->CreateAllocatorDump(name + "/storage_map"); |
| 374 map_mad->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 374 map_mad->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
| 375 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 375 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 376 map_->bytes_used()); | 376 map_->bytes_used()); |
| 377 if (system_allocator_name) | 377 if (system_allocator_name) |
| 378 pmd->AddSuballocation(map_mad->guid(), system_allocator_name); | 378 pmd->AddSuballocation(map_mad->guid(), system_allocator_name); |
| 379 // TODO(ssid): Add memory usage of local backing storage crbug.com/605785. | 379 // TODO(ssid): Add memory usage of local backing storage crbug.com/605785. |
| 380 } | 380 } |
| 381 | 381 |
| 382 void DOMStorageArea::InitialImportIfNeeded() { | 382 void DOMStorageArea::InitialImportIfNeeded() { |
| 383 if (is_initial_import_done_) | 383 if (is_initial_import_done_) |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 commit_batch_->clear_all_first, | 524 commit_batch_->clear_all_first, |
| 525 commit_batch_->changed_values); | 525 commit_batch_->changed_values); |
| 526 DCHECK(success); | 526 DCHECK(success); |
| 527 } | 527 } |
| 528 commit_batch_.reset(); | 528 commit_batch_.reset(); |
| 529 backing_.reset(); | 529 backing_.reset(); |
| 530 session_storage_backing_ = NULL; | 530 session_storage_backing_ = NULL; |
| 531 } | 531 } |
| 532 | 532 |
| 533 } // namespace content | 533 } // namespace content |
| OLD | NEW |