| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "base/threading/thread_task_runner_handle.h" | 31 #include "base/threading/thread_task_runner_handle.h" |
| 32 #include "base/trace_event/memory_dump_manager.h" | 32 #include "base/trace_event/memory_dump_manager.h" |
| 33 #include "platform/Histogram.h" | 33 #include "platform/Histogram.h" |
| 34 #include "platform/PartitionAllocMemoryDumpProvider.h" | 34 #include "platform/PartitionAllocMemoryDumpProvider.h" |
| 35 #include "platform/fonts/FontCacheMemoryDumpProvider.h" | 35 #include "platform/fonts/FontCacheMemoryDumpProvider.h" |
| 36 #include "platform/graphics/CompositorFactory.h" | 36 #include "platform/graphics/CompositorFactory.h" |
| 37 #include "platform/heap/BlinkGCMemoryDumpProvider.h" |
| 37 #include "platform/heap/GCTaskRunner.h" | 38 #include "platform/heap/GCTaskRunner.h" |
| 38 #include "platform/web_memory_dump_provider_adapter.h" | 39 #include "platform/web_memory_dump_provider_adapter.h" |
| 39 #include "public/platform/Platform.h" | 40 #include "public/platform/Platform.h" |
| 40 #include "public/platform/ServiceRegistry.h" | 41 #include "public/platform/ServiceRegistry.h" |
| 41 #include "public/platform/WebPrerenderingSupport.h" | 42 #include "public/platform/WebPrerenderingSupport.h" |
| 42 #include "wtf/HashMap.h" | 43 #include "wtf/HashMap.h" |
| 43 #include "wtf/OwnPtr.h" | 44 #include "wtf/OwnPtr.h" |
| 44 | 45 |
| 45 namespace blink { | 46 namespace blink { |
| 46 | 47 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 { | 86 { |
| 86 ASSERT(!s_platform); | 87 ASSERT(!s_platform); |
| 87 ASSERT(platform); | 88 ASSERT(platform); |
| 88 s_platform = platform; | 89 s_platform = platform; |
| 89 s_platform->m_mainThread = platform->currentThread(); | 90 s_platform->m_mainThread = platform->currentThread(); |
| 90 | 91 |
| 91 WTF::Partitions::initialize(maxObservedSizeFunction); | 92 WTF::Partitions::initialize(maxObservedSizeFunction); |
| 92 WTF::initialize(callOnMainThreadFunction); | 93 WTF::initialize(callOnMainThreadFunction); |
| 93 | 94 |
| 94 ProcessHeap::init(); | 95 ProcessHeap::init(); |
| 96 if (base::ThreadTaskRunnerHandle::IsSet()) |
| 97 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvide
r(BlinkGCMemoryDumpProvider::instance(), "BlinkGC", base::ThreadTaskRunnerHandle
::Get()); |
| 95 | 98 |
| 96 ThreadState::attachMainThread(); | 99 ThreadState::attachMainThread(); |
| 97 | 100 |
| 98 // TODO(ssid): remove this check after fixing crbug.com/486782. | 101 // TODO(ssid): remove this check after fixing crbug.com/486782. |
| 99 if (s_platform->m_mainThread) { | 102 if (s_platform->m_mainThread) { |
| 100 ASSERT(!s_gcTaskRunner); | 103 ASSERT(!s_gcTaskRunner); |
| 101 s_gcTaskRunner = new GCTaskRunner(s_platform->m_mainThread); | 104 s_gcTaskRunner = new GCTaskRunner(s_platform->m_mainThread); |
| 102 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvide
r(PartitionAllocMemoryDumpProvider::instance(), "PartitionAlloc", base::ThreadTa
skRunnerHandle::Get()); | 105 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvide
r(PartitionAllocMemoryDumpProvider::instance(), "PartitionAlloc", base::ThreadTa
skRunnerHandle::Get()); |
| 103 s_platform->registerMemoryDumpProvider(FontCacheMemoryDumpProvider::inst
ance(), "FontCaches"); | 106 s_platform->registerMemoryDumpProvider(FontCacheMemoryDumpProvider::inst
ance(), "FontCaches"); |
| 104 } | 107 } |
| 105 | 108 |
| 106 CompositorFactory::initializeDefault(); | 109 CompositorFactory::initializeDefault(); |
| 107 } | 110 } |
| 108 | 111 |
| 109 void Platform::shutdown() | 112 void Platform::shutdown() |
| 110 { | 113 { |
| 111 ASSERT(isMainThread()); | 114 ASSERT(isMainThread()); |
| 112 CompositorFactory::shutdown(); | 115 CompositorFactory::shutdown(); |
| 113 | 116 |
| 114 if (s_platform->m_mainThread) { | 117 if (s_platform->m_mainThread) { |
| 115 s_platform->unregisterMemoryDumpProvider(FontCacheMemoryDumpProvider::in
stance()); | 118 s_platform->unregisterMemoryDumpProvider(FontCacheMemoryDumpProvider::in
stance()); |
| 116 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvi
der(PartitionAllocMemoryDumpProvider::instance()); | 119 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvi
der(PartitionAllocMemoryDumpProvider::instance()); |
| 120 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvi
der(BlinkGCMemoryDumpProvider::instance()); |
| 121 |
| 117 ASSERT(s_gcTaskRunner); | 122 ASSERT(s_gcTaskRunner); |
| 118 delete s_gcTaskRunner; | 123 delete s_gcTaskRunner; |
| 119 s_gcTaskRunner = nullptr; | 124 s_gcTaskRunner = nullptr; |
| 120 } | 125 } |
| 121 | 126 |
| 122 // Detach the main thread before starting the shutdown sequence | 127 // Detach the main thread before starting the shutdown sequence |
| 123 // so that the main thread won't get involved in a GC during the shutdown. | 128 // so that the main thread won't get involved in a GC during the shutdown. |
| 124 ThreadState::detachMainThread(); | 129 ThreadState::detachMainThread(); |
| 125 | 130 |
| 126 ProcessHeap::shutdown(); | 131 ProcessHeap::shutdown(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 adapter->set_is_registered(false); | 182 adapter->set_is_registered(false); |
| 178 memoryDumpProviders().remove(it); | 183 memoryDumpProviders().remove(it); |
| 179 } | 184 } |
| 180 | 185 |
| 181 ServiceRegistry* Platform::serviceRegistry() | 186 ServiceRegistry* Platform::serviceRegistry() |
| 182 { | 187 { |
| 183 return ServiceRegistry::getEmptyServiceRegistry(); | 188 return ServiceRegistry::getEmptyServiceRegistry(); |
| 184 } | 189 } |
| 185 | 190 |
| 186 } // namespace blink | 191 } // namespace blink |
| OLD | NEW |