| 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 11 matching lines...) Expand all Loading... |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 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 "platform/PartitionAllocMemoryDumpProvider.h" | 31 #include "platform/PartitionAllocMemoryDumpProvider.h" |
| 32 #include "platform/graphics/CompositorFactory.h" |
| 32 #include "public/platform/Platform.h" | 33 #include "public/platform/Platform.h" |
| 33 | 34 |
| 34 namespace blink { | 35 namespace blink { |
| 35 | 36 |
| 36 static Platform* s_platform = 0; | 37 static Platform* s_platform = 0; |
| 37 | 38 |
| 38 Platform::Platform() | 39 Platform::Platform() |
| 39 : m_mainThread(0) | 40 : m_mainThread(0) |
| 40 { | 41 { |
| 41 } | 42 } |
| 42 | 43 |
| 43 void Platform::initialize(Platform* platform) | 44 void Platform::initialize(Platform* platform) |
| 44 { | 45 { |
| 45 s_platform = platform; | 46 s_platform = platform; |
| 46 if (s_platform) | 47 if (s_platform) |
| 47 s_platform->m_mainThread = platform->currentThread(); | 48 s_platform->m_mainThread = platform->currentThread(); |
| 48 | 49 |
| 49 // TODO(ssid): remove this check after fixing crbug.com/486782. | 50 // TODO(ssid): remove this check after fixing crbug.com/486782. |
| 50 if (s_platform && s_platform->m_mainThread) | 51 if (s_platform && s_platform->m_mainThread) |
| 51 s_platform->registerMemoryDumpProvider(PartitionAllocMemoryDumpProvider:
:instance(), "PartitionAlloc"); | 52 s_platform->registerMemoryDumpProvider(PartitionAllocMemoryDumpProvider:
:instance(), "PartitionAlloc"); |
| 53 |
| 54 CompositorFactory::initializeDefault(); |
| 52 } | 55 } |
| 53 | 56 |
| 54 void Platform::shutdown() | 57 void Platform::shutdown() |
| 55 { | 58 { |
| 59 CompositorFactory::shutdown(); |
| 60 |
| 56 if (s_platform->m_mainThread) | 61 if (s_platform->m_mainThread) |
| 57 s_platform->unregisterMemoryDumpProvider(PartitionAllocMemoryDumpProvide
r::instance()); | 62 s_platform->unregisterMemoryDumpProvider(PartitionAllocMemoryDumpProvide
r::instance()); |
| 58 | 63 |
| 59 if (s_platform) | 64 if (s_platform) |
| 60 s_platform->m_mainThread = 0; | 65 s_platform->m_mainThread = 0; |
| 61 s_platform = 0; | 66 s_platform = 0; |
| 62 } | 67 } |
| 63 | 68 |
| 64 Platform* Platform::current() | 69 Platform* Platform::current() |
| 65 { | 70 { |
| 66 return s_platform; | 71 return s_platform; |
| 67 } | 72 } |
| 68 | 73 |
| 69 WebThread* Platform::mainThread() const | 74 WebThread* Platform::mainThread() const |
| 70 { | 75 { |
| 71 return m_mainThread; | 76 return m_mainThread; |
| 72 } | 77 } |
| 73 | 78 |
| 74 } // namespace blink | 79 } // namespace blink |
| OLD | NEW |