| 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 12 matching lines...) Expand all Loading... |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 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 "config.h" | 31 #include "config.h" |
| 32 #include "platform/PartitionAllocMemoryDumpProvider.h" | 32 #include "platform/PartitionAllocMemoryDumpProvider.h" |
| 33 #include "platform/heap/BlinkGCMemoryDumpProvider.h" | |
| 34 #include "public/platform/Platform.h" | 33 #include "public/platform/Platform.h" |
| 35 | 34 |
| 36 namespace blink { | 35 namespace blink { |
| 37 | 36 |
| 38 static Platform* s_platform = 0; | 37 static Platform* s_platform = 0; |
| 39 | 38 |
| 40 Platform::Platform() | 39 Platform::Platform() |
| 41 : m_mainThread(0) | 40 : m_mainThread(0) |
| 42 { | 41 { |
| 43 } | 42 } |
| 44 | 43 |
| 45 void Platform::initialize(Platform* platform) | 44 void Platform::initialize(Platform* platform) |
| 46 { | 45 { |
| 47 s_platform = platform; | 46 s_platform = platform; |
| 48 if (s_platform) | 47 if (s_platform) |
| 49 s_platform->m_mainThread = platform->currentThread(); | 48 s_platform->m_mainThread = platform->currentThread(); |
| 50 | 49 |
| 51 // TODO(ssid): remove this check after fixing crbug.com/486782. | 50 // TODO(ssid): remove this check after fixing crbug.com/486782. |
| 52 if (s_platform && s_platform->m_mainThread) { | 51 if (s_platform && s_platform->m_mainThread) |
| 53 s_platform->registerMemoryDumpProvider(PartitionAllocMemoryDumpProvider:
:instance()); | 52 s_platform->registerMemoryDumpProvider(PartitionAllocMemoryDumpProvider:
:instance()); |
| 54 s_platform->registerMemoryDumpProvider(BlinkGCMemoryDumpProvider::instan
ce()); | |
| 55 } | |
| 56 } | 53 } |
| 57 | 54 |
| 58 void Platform::shutdown() | 55 void Platform::shutdown() |
| 59 { | 56 { |
| 60 if (s_platform->m_mainThread) { | 57 if (s_platform->m_mainThread) |
| 61 s_platform->unregisterMemoryDumpProvider(PartitionAllocMemoryDumpProvide
r::instance()); | 58 s_platform->unregisterMemoryDumpProvider(PartitionAllocMemoryDumpProvide
r::instance()); |
| 62 s_platform->unregisterMemoryDumpProvider(BlinkGCMemoryDumpProvider::inst
ance()); | |
| 63 } | |
| 64 | 59 |
| 65 if (s_platform) | 60 if (s_platform) |
| 66 s_platform->m_mainThread = 0; | 61 s_platform->m_mainThread = 0; |
| 67 s_platform = 0; | 62 s_platform = 0; |
| 68 } | 63 } |
| 69 | 64 |
| 70 Platform* Platform::current() | 65 Platform* Platform::current() |
| 71 { | 66 { |
| 72 return s_platform; | 67 return s_platform; |
| 73 } | 68 } |
| 74 | 69 |
| 75 WebThread* Platform::mainThread() const | 70 WebThread* Platform::mainThread() const |
| 76 { | 71 { |
| 77 return m_mainThread; | 72 return m_mainThread; |
| 78 } | 73 } |
| 79 | 74 |
| 80 } // namespace blink | 75 } // namespace blink |
| OLD | NEW |