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 "config.h" | 31 #include "config.h" |
| 32 #include "base/trace_event/memory_dump_manager.h" |
32 #include "platform/PartitionAllocMemoryDumpProvider.h" | 33 #include "platform/PartitionAllocMemoryDumpProvider.h" |
33 #include "public/platform/Platform.h" | 34 #include "public/platform/Platform.h" |
34 | 35 |
35 namespace blink { | 36 namespace blink { |
36 | 37 |
37 static Platform* s_platform = 0; | 38 static Platform* s_platform = 0; |
38 | 39 |
39 Platform::Platform() | 40 Platform::Platform() |
40 : m_mainThread(0) | 41 : m_mainThread(0) |
41 { | 42 { |
42 } | 43 } |
43 | 44 |
44 void Platform::initialize(Platform* platform) | 45 void Platform::initialize(Platform* platform) |
45 { | 46 { |
46 s_platform = platform; | 47 s_platform = platform; |
47 if (s_platform) | 48 if (s_platform) |
48 s_platform->m_mainThread = platform->currentThread(); | 49 s_platform->m_mainThread = platform->currentThread(); |
49 | 50 |
50 // TODO(ssid): remove this check after fixing crbug.com/486782. | 51 // TODO(ssid): remove this check after fixing crbug.com/486782. |
51 if (s_platform && s_platform->m_mainThread) | 52 if (s_platform && s_platform->m_mainThread) |
52 s_platform->registerMemoryDumpProvider(PartitionAllocMemoryDumpProvider:
:instance()); | 53 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvide
r(PartitionAllocMemoryDumpProvider::instance()); |
53 } | 54 } |
54 | 55 |
55 void Platform::shutdown() | 56 void Platform::shutdown() |
56 { | 57 { |
57 if (s_platform->m_mainThread) | 58 if (s_platform->m_mainThread) |
58 s_platform->unregisterMemoryDumpProvider(PartitionAllocMemoryDumpProvide
r::instance()); | 59 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvi
der(PartitionAllocMemoryDumpProvider::instance()); |
59 | 60 |
60 if (s_platform) | 61 if (s_platform) |
61 s_platform->m_mainThread = 0; | 62 s_platform->m_mainThread = 0; |
62 s_platform = 0; | 63 s_platform = 0; |
63 } | 64 } |
64 | 65 |
65 Platform* Platform::current() | 66 Platform* Platform::current() |
66 { | 67 { |
67 return s_platform; | 68 return s_platform; |
68 } | 69 } |
69 | 70 |
70 WebThread* Platform::mainThread() const | 71 WebThread* Platform::mainThread() const |
71 { | 72 { |
72 return m_mainThread; | 73 return m_mainThread; |
73 } | 74 } |
74 | 75 |
75 } // namespace blink | 76 } // namespace blink |
OLD | NEW |