Chromium Code Reviews| 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 7fee39c34abf0647fe6e9c329bafdf54c76fe190..cfeafa5ef69ed4024843aad00f46529a8be5d052 100644 |
| --- a/content/browser/dom_storage/dom_storage_context_impl.cc |
| +++ b/content/browser/dom_storage/dom_storage_context_impl.cc |
| @@ -14,6 +14,8 @@ |
| #include "base/guid.h" |
| #include "base/location.h" |
| #include "base/time/time.h" |
| +#include "base/trace_event/memory_dump_manager.h" |
| +#include "base/trace_event/process_memory_dump.h" |
| #include "content/browser/dom_storage/dom_storage_area.h" |
| #include "content/browser/dom_storage/dom_storage_database.h" |
| #include "content/browser/dom_storage/dom_storage_namespace.h" |
| @@ -50,6 +52,13 @@ DOMStorageContextImpl::DOMStorageContextImpl( |
| // namespace ids at one since zero is reserved for the |
| // kLocalStorageNamespaceId. |
| session_id_sequence_.GetNext(); |
| + |
| + // Registering dump provider is safe even outside the task runner. |
| + base::trace_event::MemoryDumpManager::GetInstance() |
| + ->RegisterDumpProviderWithSequencedTaskRunner( |
| + this, "DOMStorage", task_runner_->GetSequencedTaskRunner( |
| + DOMStorageTaskRunner::PRIMARY_SEQUENCE), |
| + base::trace_event::MemoryDumpProvider::Options()); |
| } |
| DOMStorageContextImpl::~DOMStorageContextImpl() { |
|
michaeln
2016/04/26 22:56:25
can you add a DCHECK(is_shutdown_) here to test ou
|
| @@ -179,6 +188,9 @@ void DOMStorageContextImpl::Shutdown() { |
| for (; it != namespaces_.end(); ++it) |
| it->second->Shutdown(); |
| + base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( |
| + this); |
| + |
| if (localstorage_directory_.empty() && !session_storage_database_.get()) |
| return; |
| @@ -357,6 +369,17 @@ void DOMStorageContextImpl::StartScavengingUnusedSessionStorage() { |
| } |
| } |
| +bool DOMStorageContextImpl::OnMemoryDump( |
| + const base::trace_event::MemoryDumpArgs& args, |
| + base::trace_event::ProcessMemoryDump* pmd) { |
| + for (const auto& it : namespaces_) { |
| + it.second->OnMemoryDump(pmd); |
| + } |
| + if (session_storage_database_) |
| + session_storage_database_->OnMemoryDump(pmd); |
| + return true; |
| +} |
| + |
| void DOMStorageContextImpl::FindUnusedNamespaces() { |
| DCHECK(session_storage_database_.get()); |
| if (scavenging_started_) |