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

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 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;
« 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