Chromium Code Reviews| Index: third_party/WebKit/Source/platform/exported/Platform.cpp |
| diff --git a/third_party/WebKit/Source/platform/exported/Platform.cpp b/third_party/WebKit/Source/platform/exported/Platform.cpp |
| index 72904f70552b179fefbf22415ce953f662f5ff87..942608a37996b91fd376e6b1795acd56a6e425c3 100644 |
| --- a/third_party/WebKit/Source/platform/exported/Platform.cpp |
| +++ b/third_party/WebKit/Source/platform/exported/Platform.cpp |
| @@ -31,6 +31,7 @@ |
| #include "base/thread_task_runner_handle.h" |
| #include "base/trace_event/memory_dump_manager.h" |
| #include "platform/PartitionAllocMemoryDumpProvider.h" |
| +#include "platform/fonts/FontCacheMemoryDumpProvider.h" |
| #include "platform/graphics/CompositorFactory.h" |
| #include "platform/web_memory_dump_provider_adapter.h" |
| #include "public/platform/Platform.h" |
| @@ -68,10 +69,12 @@ void Platform::initialize(Platform* platform) |
| s_platform->registerMemoryDumpProvider(PartitionAllocMemoryDumpProvider::instance(), "PartitionAlloc"); |
| CompositorFactory::initializeDefault(); |
| + platform->registerMemoryDumpProvider(FontCacheMemoryDumpProvider::instance(), "FontCaches"); |
|
sof
2016/03/10 07:40:12
So what is the status of |platform|, can it be non
|
| } |
| void Platform::shutdown() |
| { |
| + s_platform->unregisterMemoryDumpProvider(FontCacheMemoryDumpProvider::instance()); |
| CompositorFactory::shutdown(); |
| if (s_platform->m_mainThread) |
| @@ -94,6 +97,10 @@ WebThread* Platform::mainThread() const |
| void Platform::registerMemoryDumpProvider(WebMemoryDumpProvider* provider, const char* name) |
| { |
| + // MemoryDumpProvider needs a message loop. |
| + if (!Platform::current()->currentThread()) |
| + return; |
| + |
| WebMemoryDumpProviderAdapter* adapter = new WebMemoryDumpProviderAdapter(provider); |
| ProviderToAdapterMap::AddResult result = memoryDumpProviders().add(provider, adoptPtr(adapter)); |
| if (!result.isNewEntry) |
| @@ -104,6 +111,10 @@ void Platform::registerMemoryDumpProvider(WebMemoryDumpProvider* provider, const |
| void Platform::unregisterMemoryDumpProvider(WebMemoryDumpProvider* provider) |
| { |
| + // MemoryDumpProvider needs a message loop. |
| + if (!Platform::current()->currentThread()) |
| + return; |
| + |
| ProviderToAdapterMap::iterator it = memoryDumpProviders().find(provider); |
| if (it == memoryDumpProviders().end()) |
| return; |