Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Unified Diff: content/browser/dom_storage/dom_storage_context_impl.cc

Issue 1950893003: [tracing] Support background mode in dom storage memory dumps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dom_storage
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/dom_storage/dom_storage_area.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/dom_storage/dom_storage_context_impl.cc
diff --git a/content/browser/dom_storage/dom_storage_context_impl.cc b/content/browser/dom_storage/dom_storage_context_impl.cc
index c1fc1db24f079b0e85cbd10020e0a1943f0b3879..e4ccfe0dec5f62f9f7117751b5856eee252c91e0 100644
--- a/content/browser/dom_storage/dom_storage_context_impl.cc
+++ b/content/browser/dom_storage/dom_storage_context_impl.cc
@@ -14,6 +14,7 @@
#include "base/guid.h"
#include "base/location.h"
#include "base/metrics/histogram.h"
+#include "base/strings/stringprintf.h"
#include "base/sys_info.h"
#include "base/time/time.h"
#include "base/trace_event/memory_dump_manager.h"
@@ -468,11 +469,28 @@ void DOMStorageContextImpl::PurgeMemory(PurgeOption purge_option) {
bool DOMStorageContextImpl::OnMemoryDump(
const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* pmd) {
+ if (session_storage_database_)
+ session_storage_database_->OnMemoryDump(pmd);
+ if (args.level_of_detail ==
+ base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND) {
+ DOMStorageNamespace::UsageStatistics total_stats =
+ GetTotalNamespaceStatistics(namespaces_);
+ auto mad = pmd->CreateAllocatorDump(
+ StringPrintf("dom_storage/%p/cache_size", this));
+ mad->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ total_stats.total_cache_size);
+ mad->AddScalar("inactive_areas",
+ base::trace_event::MemoryAllocatorDump::kUnitsObjects,
+ total_stats.inactive_area_count);
+ mad->AddScalar("total_areas",
+ base::trace_event::MemoryAllocatorDump::kUnitsObjects,
+ total_stats.total_area_count);
+ return true;
+ }
for (const auto& it : namespaces_) {
it.second->OnMemoryDump(pmd);
}
- if (session_storage_database_)
- session_storage_database_->OnMemoryDump(pmd);
return true;
}
« no previous file with comments | « content/browser/dom_storage/dom_storage_area.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698