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

Unified Diff: base/trace_event/memory_dump_manager.cc

Issue 2592543002: Make memory-infra tests register / unregister with thread safety (Closed)
Patch Set: Just fix tests. Created 4 years 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 | base/trace_event/memory_dump_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..dd67c3155d99c73b07a26bc348eaabdbd7d3afd4 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;
@@ -351,10 +356,7 @@ void MemoryDumpManager::UnregisterDumpProviderInternal(
}
if ((*mdp_iter)->options.is_fast_polling_supported && dump_thread_) {
- DCHECK(take_mdp_ownership_and_delete_async)
- << "MemoryDumpProviders capable of fast polling must NOT be thread "
- "bound and hence must be destroyed using "
- "UnregisterAndDeleteDumpProviderSoon()";
+ DCHECK(take_mdp_ownership_and_delete_async);
dump_thread_->task_runner()->PostTask(
FROM_HERE, Bind(&MemoryDumpManager::UnregisterPollingMDPOnDumpThread,
Unretained(this), *mdp_iter));
@@ -371,7 +373,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);
}
« no previous file with comments | « no previous file | base/trace_event/memory_dump_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698