Chromium Code Reviews| Index: base/trace_event/memory_dump_manager.cc |
| diff --git a/base/trace_event/memory_dump_manager.cc b/base/trace_event/memory_dump_manager.cc |
| index 096eaf88487828c43ca9748182282eeed73df80a..092043deb61e4f24b98c74d25e8077965a91407d 100644 |
| --- a/base/trace_event/memory_dump_manager.cc |
| +++ b/base/trace_event/memory_dump_manager.cc |
| @@ -277,6 +277,11 @@ void MemoryDumpManager::RegisterDumpProviderInternal( |
| new MemoryDumpProviderInfo(mdp, name, std::move(task_runner), options, |
| whitelisted_for_background_mode); |
| + if (options.is_fast_polling_supported) { |
| + DCHECK(!mdpinfo->task_runner) << "MemoryDumpProviders capable of fast " |
| + "polling must NOT be thread bound."; |
| + } |
| + |
| { |
| AutoLock lock(lock_); |
| bool already_registered = !dump_providers_.insert(mdpinfo).second; |
| @@ -334,7 +339,7 @@ void MemoryDumpManager::UnregisterDumpProviderInternal( |
| // - When the provider is removed from |dump_providers_for_polling_|. |
| DCHECK(!(*mdp_iter)->owned_dump_provider); |
| (*mdp_iter)->owned_dump_provider = std::move(owned_mdp); |
| - } else if (subtle::NoBarrier_Load(&memory_tracing_enabled_)) { |
| + } else { |
| // If you hit this DCHECK, your dump provider has a bug. |
| // Unregistration of a MemoryDumpProvider is safe only if: |
| // - The MDP has specified a sequenced task runner affinity AND the |
| @@ -351,10 +356,6 @@ void MemoryDumpManager::UnregisterDumpProviderInternal( |
| } |
| if ((*mdp_iter)->options.is_fast_polling_supported && dump_thread_) { |
| - DCHECK(take_mdp_ownership_and_delete_async) |
|
Primiano Tucci (use gerrit)
2016/12/21 11:44:25
I'd still kjeep the DCHECK here, without the strin
ssid
2016/12/21 19:55:03
Done.
|
| - << "MemoryDumpProviders capable of fast polling must NOT be thread " |
| - "bound and hence must be destroyed using " |
| - "UnregisterAndDeleteDumpProviderSoon()"; |
| dump_thread_->task_runner()->PostTask( |
| FROM_HERE, Bind(&MemoryDumpManager::UnregisterPollingMDPOnDumpThread, |
| Unretained(this), *mdp_iter)); |
| @@ -371,7 +372,6 @@ void MemoryDumpManager::UnregisterDumpProviderInternal( |
| void MemoryDumpManager::RegisterPollingMDPOnDumpThread( |
| scoped_refptr<MemoryDumpManager::MemoryDumpProviderInfo> mdpinfo) { |
| - DCHECK(!mdpinfo->task_runner); |
| AutoLock lock(lock_); |
| dump_providers_for_polling_.insert(mdpinfo); |
| } |