Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 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/thread_task_runner_handle.h" | 31 #include "base/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/PartitionAllocMemoryDumpProvider.h" | 33 #include "platform/PartitionAllocMemoryDumpProvider.h" |
| 34 #include "platform/fonts/FontCacheMemoryDumpProvider.h" | |
| 34 #include "platform/graphics/CompositorFactory.h" | 35 #include "platform/graphics/CompositorFactory.h" |
| 35 #include "platform/web_memory_dump_provider_adapter.h" | 36 #include "platform/web_memory_dump_provider_adapter.h" |
| 36 #include "public/platform/Platform.h" | 37 #include "public/platform/Platform.h" |
| 37 #include "wtf/HashMap.h" | 38 #include "wtf/HashMap.h" |
| 38 #include "wtf/OwnPtr.h" | 39 #include "wtf/OwnPtr.h" |
| 39 | 40 |
| 40 namespace blink { | 41 namespace blink { |
| 41 | 42 |
| 42 static Platform* s_platform = 0; | 43 static Platform* s_platform = 0; |
| 43 using ProviderToAdapterMap = HashMap<WebMemoryDumpProvider*, OwnPtr<WebMemoryDum pProviderAdapter>>; | 44 using ProviderToAdapterMap = HashMap<WebMemoryDumpProvider*, OwnPtr<WebMemoryDum pProviderAdapter>>; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 61 { | 62 { |
| 62 s_platform = platform; | 63 s_platform = platform; |
| 63 if (s_platform) | 64 if (s_platform) |
| 64 s_platform->m_mainThread = platform->currentThread(); | 65 s_platform->m_mainThread = platform->currentThread(); |
| 65 | 66 |
| 66 // TODO(ssid): remove this check after fixing crbug.com/486782. | 67 // TODO(ssid): remove this check after fixing crbug.com/486782. |
| 67 if (s_platform && s_platform->m_mainThread) | 68 if (s_platform && s_platform->m_mainThread) |
| 68 s_platform->registerMemoryDumpProvider(PartitionAllocMemoryDumpProvider: :instance(), "PartitionAlloc"); | 69 s_platform->registerMemoryDumpProvider(PartitionAllocMemoryDumpProvider: :instance(), "PartitionAlloc"); |
| 69 | 70 |
| 70 CompositorFactory::initializeDefault(); | 71 CompositorFactory::initializeDefault(); |
| 72 platform->registerMemoryDumpProvider(FontCacheMemoryDumpProvider::instance() , "FontCaches"); | |
|
sof
2016/03/09 16:41:39
Needs a null check (or ~TestingPlatformSupport cha
| |
| 71 } | 73 } |
| 72 | 74 |
| 73 void Platform::shutdown() | 75 void Platform::shutdown() |
| 74 { | 76 { |
| 77 s_platform->unregisterMemoryDumpProvider(FontCacheMemoryDumpProvider::instan ce()); | |
| 75 CompositorFactory::shutdown(); | 78 CompositorFactory::shutdown(); |
| 76 | 79 |
| 77 if (s_platform->m_mainThread) | 80 if (s_platform->m_mainThread) |
| 78 s_platform->unregisterMemoryDumpProvider(PartitionAllocMemoryDumpProvide r::instance()); | 81 s_platform->unregisterMemoryDumpProvider(PartitionAllocMemoryDumpProvide r::instance()); |
| 79 | 82 |
| 80 if (s_platform) | 83 if (s_platform) |
| 81 s_platform->m_mainThread = 0; | 84 s_platform->m_mainThread = 0; |
| 82 s_platform = 0; | 85 s_platform = 0; |
| 83 } | 86 } |
| 84 | 87 |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 107 ProviderToAdapterMap::iterator it = memoryDumpProviders().find(provider); | 110 ProviderToAdapterMap::iterator it = memoryDumpProviders().find(provider); |
| 108 if (it == memoryDumpProviders().end()) | 111 if (it == memoryDumpProviders().end()) |
| 109 return; | 112 return; |
| 110 WebMemoryDumpProviderAdapter* adapter = it->value.get(); | 113 WebMemoryDumpProviderAdapter* adapter = it->value.get(); |
| 111 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( adapter); | 114 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( adapter); |
| 112 adapter->set_is_registered(false); | 115 adapter->set_is_registered(false); |
| 113 memoryDumpProviders().remove(it); | 116 memoryDumpProviders().remove(it); |
| 114 } | 117 } |
| 115 | 118 |
| 116 } // namespace blink | 119 } // namespace blink |
| OLD | NEW |