| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 } // namespace | 53 } // namespace |
| 54 | 54 |
| 55 Platform::Platform() | 55 Platform::Platform() |
| 56 : m_mainThread(0) | 56 : m_mainThread(0) |
| 57 { | 57 { |
| 58 } | 58 } |
| 59 | 59 |
| 60 void Platform::initialize(Platform* platform) | 60 void Platform::initialize(Platform* platform) |
| 61 { | 61 { |
| 62 ASSERT(platform); |
| 62 s_platform = platform; | 63 s_platform = platform; |
| 63 if (s_platform) | 64 s_platform->m_mainThread = platform->currentThread(); |
| 64 s_platform->m_mainThread = platform->currentThread(); | |
| 65 | 65 |
| 66 // TODO(ssid): remove this check after fixing crbug.com/486782. | 66 // TODO(ssid): remove this check after fixing crbug.com/486782. |
| 67 if (s_platform && s_platform->m_mainThread) | 67 if (s_platform->m_mainThread) |
| 68 s_platform->registerMemoryDumpProvider(PartitionAllocMemoryDumpProvider:
:instance(), "PartitionAlloc"); | 68 s_platform->registerMemoryDumpProvider(PartitionAllocMemoryDumpProvider:
:instance(), "PartitionAlloc"); |
| 69 | 69 |
| 70 CompositorFactory::initializeDefault(); | 70 CompositorFactory::initializeDefault(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void Platform::shutdown() | 73 void Platform::shutdown() |
| 74 { | 74 { |
| 75 CompositorFactory::shutdown(); | 75 CompositorFactory::shutdown(); |
| 76 | 76 |
| 77 if (s_platform->m_mainThread) | 77 if (s_platform->m_mainThread) |
| 78 s_platform->unregisterMemoryDumpProvider(PartitionAllocMemoryDumpProvide
r::instance()); | 78 s_platform->unregisterMemoryDumpProvider(PartitionAllocMemoryDumpProvide
r::instance()); |
| 79 | 79 |
| 80 if (s_platform) | 80 s_platform->m_mainThread = nullptr; |
| 81 s_platform->m_mainThread = 0; | 81 s_platform = nullptr; |
| 82 s_platform = 0; | |
| 83 } | 82 } |
| 84 | 83 |
| 85 void Platform::setCurrentPlatformForTesting(Platform* platform) | 84 void Platform::setCurrentPlatformForTesting(Platform* platform) |
| 86 { | 85 { |
| 86 ASSERT(platform); |
| 87 s_platform = platform; | 87 s_platform = platform; |
| 88 if (s_platform) | 88 s_platform->m_mainThread = platform->currentThread(); |
| 89 s_platform->m_mainThread = platform->currentThread(); | |
| 90 } | 89 } |
| 91 | 90 |
| 92 Platform* Platform::current() | 91 Platform* Platform::current() |
| 93 { | 92 { |
| 94 return s_platform; | 93 return s_platform; |
| 95 } | 94 } |
| 96 | 95 |
| 97 WebThread* Platform::mainThread() const | 96 WebThread* Platform::mainThread() const |
| 98 { | 97 { |
| 99 return m_mainThread; | 98 return m_mainThread; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 114 ProviderToAdapterMap::iterator it = memoryDumpProviders().find(provider); | 113 ProviderToAdapterMap::iterator it = memoryDumpProviders().find(provider); |
| 115 if (it == memoryDumpProviders().end()) | 114 if (it == memoryDumpProviders().end()) |
| 116 return; | 115 return; |
| 117 WebMemoryDumpProviderAdapter* adapter = it->value.get(); | 116 WebMemoryDumpProviderAdapter* adapter = it->value.get(); |
| 118 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
adapter); | 117 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
adapter); |
| 119 adapter->set_is_registered(false); | 118 adapter->set_is_registered(false); |
| 120 memoryDumpProviders().remove(it); | 119 memoryDumpProviders().remove(it); |
| 121 } | 120 } |
| 122 | 121 |
| 123 } // namespace blink | 122 } // namespace blink |
| OLD | NEW |