| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_context_impl.h" | 5 #include "content/browser/dom_storage/dom_storage_context_impl.h" |
| 6 | 6 |
| 7 #include <inttypes.h> |
| 7 #include <stddef.h> | 8 #include <stddef.h> |
| 8 #include <stdlib.h> | 9 #include <stdlib.h> |
| 9 | 10 |
| 10 #include "base/bind.h" | 11 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 12 #include "base/files/file_enumerator.h" | 13 #include "base/files/file_enumerator.h" |
| 13 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
| 14 #include "base/guid.h" | 15 #include "base/guid.h" |
| 15 #include "base/location.h" | 16 #include "base/location.h" |
| 16 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 bool DOMStorageContextImpl::OnMemoryDump( | 470 bool DOMStorageContextImpl::OnMemoryDump( |
| 470 const base::trace_event::MemoryDumpArgs& args, | 471 const base::trace_event::MemoryDumpArgs& args, |
| 471 base::trace_event::ProcessMemoryDump* pmd) { | 472 base::trace_event::ProcessMemoryDump* pmd) { |
| 472 if (session_storage_database_) | 473 if (session_storage_database_) |
| 473 session_storage_database_->OnMemoryDump(pmd); | 474 session_storage_database_->OnMemoryDump(pmd); |
| 474 if (args.level_of_detail == | 475 if (args.level_of_detail == |
| 475 base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND) { | 476 base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND) { |
| 476 DOMStorageNamespace::UsageStatistics total_stats = | 477 DOMStorageNamespace::UsageStatistics total_stats = |
| 477 GetTotalNamespaceStatistics(namespaces_); | 478 GetTotalNamespaceStatistics(namespaces_); |
| 478 auto mad = pmd->CreateAllocatorDump( | 479 auto mad = pmd->CreateAllocatorDump( |
| 479 StringPrintf("dom_storage/%p/cache_size", this)); | 480 base::StringPrintf("dom_storage/0x%" PRIXPTR "/cache_size", |
| 481 reinterpret_cast<uintptr_t>(this))); |
| 480 mad->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 482 mad->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
| 481 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 483 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 482 total_stats.total_cache_size); | 484 total_stats.total_cache_size); |
| 483 mad->AddScalar("inactive_areas", | 485 mad->AddScalar("inactive_areas", |
| 484 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | 486 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
| 485 total_stats.inactive_area_count); | 487 total_stats.inactive_area_count); |
| 486 mad->AddScalar("total_areas", | 488 mad->AddScalar("total_areas", |
| 487 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | 489 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
| 488 total_stats.total_area_count); | 490 total_stats.total_area_count); |
| 489 return true; | 491 return true; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 if (!deletable_persistent_namespace_ids_.empty()) { | 559 if (!deletable_persistent_namespace_ids_.empty()) { |
| 558 task_runner_->PostDelayedTask( | 560 task_runner_->PostDelayedTask( |
| 559 FROM_HERE, base::Bind( | 561 FROM_HERE, base::Bind( |
| 560 &DOMStorageContextImpl::DeleteNextUnusedNamespace, | 562 &DOMStorageContextImpl::DeleteNextUnusedNamespace, |
| 561 this), | 563 this), |
| 562 base::TimeDelta::FromSeconds(kSessionStoraceScavengingSeconds)); | 564 base::TimeDelta::FromSeconds(kSessionStoraceScavengingSeconds)); |
| 563 } | 565 } |
| 564 } | 566 } |
| 565 | 567 |
| 566 } // namespace content | 568 } // namespace content |
| OLD | NEW |