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

Unified Diff: content/browser/dom_storage/dom_storage_area.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 | « no previous file | content/browser/dom_storage/dom_storage_context_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/dom_storage/dom_storage_area.cc
diff --git a/content/browser/dom_storage/dom_storage_area.cc b/content/browser/dom_storage/dom_storage_area.cc
index 26e984b0b2b19ebe9a15cd2190b5a5bad3b282be..7bb96f34564f1d9b7225d4b4b4e7bb237f4a631d 100644
--- a/content/browser/dom_storage/dom_storage_area.cc
+++ b/content/browser/dom_storage/dom_storage_area.cc
@@ -338,8 +338,7 @@ void DOMStorageArea::Shutdown() {
void DOMStorageArea::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd) {
DCHECK(task_runner_->IsRunningOnPrimarySequence());
- // Do not trace if usage is very low.
- if (map_->bytes_used() < 1024)
+ if (!is_initial_import_done_)
return;
// Limit the url length to 50 and strip special characters.
@@ -349,16 +348,30 @@ void DOMStorageArea::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd) {
url[index] = '_';
}
std::string name = StringPrintf("dom_storage/%s/%p", url.c_str(), this);
- auto mad = pmd->CreateAllocatorDump(name + "/storage_map");
- mad->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
- base::trace_event::MemoryAllocatorDump::kUnitsBytes,
- map_->bytes_used());
const char* system_allocator_name =
base::trace_event::MemoryDumpManager::GetInstance()
->system_allocator_pool_name();
+ if (commit_batch_) {
+ auto commit_batch_mad = pmd->CreateAllocatorDump(name + "/commit_batch");
+ commit_batch_mad->AddScalar(
+ base::trace_event::MemoryAllocatorDump::kNameSize,
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ commit_batch_->GetDataSize());
+ if (system_allocator_name)
+ pmd->AddSuballocation(commit_batch_mad->guid(), system_allocator_name);
+ }
+
+ // Do not add storage map usage if less than 1KB.
+ if (map_->bytes_used() < 1024)
+ return;
+
+ auto map_mad = pmd->CreateAllocatorDump(name + "/storage_map");
+ map_mad->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ map_->bytes_used());
if (system_allocator_name)
- pmd->AddSuballocation(mad->guid(), system_allocator_name);
+ pmd->AddSuballocation(map_mad->guid(), system_allocator_name);
// TODO(ssid): Add memory usage of local backing storage crbug.com/605785.
}
« no previous file with comments | « no previous file | content/browser/dom_storage/dom_storage_context_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698