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 } | 53 } |
56 } | 54 } |
57 | 55 |
58 void Platform::shutdown() | 56 void Platform::shutdown() |
59 { | 57 { |
60 if (s_platform->m_mainThread) { | 58 if (s_platform->m_mainThread) { |
61 s_platform->unregisterMemoryDumpProvider(PartitionAllocMemoryDumpProvide
r::instance()); | 59 s_platform->unregisterMemoryDumpProvider(PartitionAllocMemoryDumpProvide
r::instance()); |
62 s_platform->unregisterMemoryDumpProvider(BlinkGCMemoryDumpProvider::inst
ance()); | |
63 } | 60 } |
64 | 61 |
65 if (s_platform) | 62 if (s_platform) |
66 s_platform->m_mainThread = 0; | 63 s_platform->m_mainThread = 0; |
67 s_platform = 0; | 64 s_platform = 0; |
68 } | 65 } |
69 | 66 |
70 Platform* Platform::current() | 67 Platform* Platform::current() |
71 { | 68 { |
72 return s_platform; | 69 return s_platform; |
73 } | 70 } |
74 | 71 |
75 WebThread* Platform::mainThread() const | 72 WebThread* Platform::mainThread() const |
76 { | 73 { |
77 return m_mainThread; | 74 return m_mainThread; |
78 } | 75 } |
79 | 76 |
80 } // namespace blink | 77 } // namespace blink |
OLD | NEW |