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

Unified Diff: third_party/WebKit/Source/platform/exported/Platform.cpp

Issue 1773273004: Move code to register/unregister memory dump provider from blink::initialize/shutdown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months 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 | « third_party/WebKit/Source/core/Init.cpp ('k') | third_party/WebKit/Source/web/WebKit.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ff4f19ed56f0c3557394c67d827752d57b02fe08..ff29254cbb7c40ab8966bea597129860fddbff5a 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"
@@ -64,8 +65,10 @@ void Platform::initialize(Platform* platform)
s_platform->m_mainThread = platform->currentThread();
// TODO(ssid): remove this check after fixing crbug.com/486782.
- if (s_platform->m_mainThread)
+ if (s_platform->m_mainThread) {
s_platform->registerMemoryDumpProvider(PartitionAllocMemoryDumpProvider::instance(), "PartitionAlloc");
+ s_platform->registerMemoryDumpProvider(FontCacheMemoryDumpProvider::instance(), "FontCaches");
+ }
CompositorFactory::initializeDefault();
}
@@ -74,8 +77,10 @@ void Platform::shutdown()
{
CompositorFactory::shutdown();
- if (s_platform->m_mainThread)
+ if (s_platform->m_mainThread) {
+ s_platform->unregisterMemoryDumpProvider(FontCacheMemoryDumpProvider::instance());
s_platform->unregisterMemoryDumpProvider(PartitionAllocMemoryDumpProvider::instance());
+ }
s_platform->m_mainThread = nullptr;
s_platform = nullptr;
@@ -100,6 +105,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)
@@ -110,6 +119,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;
« no previous file with comments | « third_party/WebKit/Source/core/Init.cpp ('k') | third_party/WebKit/Source/web/WebKit.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698