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 dd67c3155d99c73b07a26bc348eaabdbd7d3afd4..503c836676d756395984fcaa66b4ddefd447fec2 100644 |
--- a/base/trace_event/memory_dump_manager.cc |
+++ b/base/trace_event/memory_dump_manager.cc |
@@ -47,6 +47,54 @@ const unsigned char kTraceEventArgTypes[] = {TRACE_VALUE_TYPE_CONVERTABLE}; |
StaticAtomicSequenceNumber g_next_guid; |
MemoryDumpManager* g_instance_for_testing = nullptr; |
+// The list of dump providers that are blacklisted from strict checks when |
+// unregistration. These providers could potentially cause crashes on build bots |
Primiano Tucci (use gerrit)
2017/01/06 14:00:39
either "checks on unregistration" or "checks when
ssid
2017/01/10 23:59:38
Done.
|
+// if they do not unregister on right thread. |
+// TODO(ssid): Fix all the dump providers to unregister if needed and clear the |
+// blacklist, crbug.com/643438. |
+const char* kStrictThreadCheckBlacklist[] = { |
Primiano Tucci (use gerrit)
2017/01/06 14:00:39
+const (consts are never enough), i.e.
const char*
ssid
2017/01/10 23:59:38
Sorry forgot const here.
|
+ "android::ResourceManagerImpl", |
+ "AndroidGraphics", |
+ "BrowserGpuMemoryBufferManager", |
+ "ClientDiscardableSharedMemoryManager", |
+ "ContextProviderCommandBuffer", |
+ "DOMStorage", |
+ "DiscardableSharedMemoryManager", |
+ "FontCaches", |
+ "GpuMemoryBufferVideoFramePool", |
+ "IndexedDBBackingStore", |
+ "LeveldbValueStore", |
+ "MemoryCache", |
+ "Skia", |
+ "Sql", |
+ "ThreadLocalEventBuffer", |
+ "TraceLog", |
+ "URLRequestContext", |
+ "V8Isolate", |
+ "VpxVideoDecoder", |
+ "cc::ResourcePool", |
+ "cc::ResourceProvider", |
+ "cc::SoftwareImageDecodeCache", |
+ "cc::StagingBufferPool", |
+ "gpu::BufferManager", |
+ "gpu::MappedMemoryManager", |
+ "gpu::RenderbufferManager", |
+ "gpu::TextureManager", |
+ "gpu::TransferBufferManager", |
+ "sql::Connection", |
+ "SyncDirectory", |
+ "BlacklistTestDumpProvider" // for testing |
+}; |
+ |
+// Returns true if the name is present in the blacklist. |
+bool IsDumpproviderBlackListedForStrictThreadCheck(const char* name) { |
Primiano Tucci (use gerrit)
2017/01/06 14:00:39
my suggestion is that you keep the array above and
ssid
2017/01/10 23:59:38
Done.
|
+ for (auto* str : kStrictThreadCheckBlacklist) { |
+ if (strcmp(name, str) == 0) |
+ return true; |
+ } |
+ return false; |
+} |
+ |
// Callback wrapper to hook upon the completion of RequestGlobalDump() and |
// inject trace markers. |
void OnGlobalDumpDone(MemoryDumpCallback wrapped_callback, |
@@ -339,7 +387,16 @@ 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 (!IsDumpproviderBlackListedForStrictThreadCheck( |
+ (*mdp_iter)->name) || |
+ subtle::NoBarrier_Load(&memory_tracing_enabled_)) { |
+ // If IsDumpproviderBlackListedForStrictThreadCheck() is true, then the |
+ // DCHECK is fired only when tracing is enabled. Otherwise the DCHECK is |
+ // fired even when tracing is not enabled (stricter). |
+ // TODO(ssid): Remove this condition after removing all the dump providers |
+ // in the blacklist and the buildbots are no longer flakily hitting the |
+ // DCHECK, crbug.com/643438. |
+ |
// 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 |