Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: Source/platform/exported/Platform.cpp

Issue 1149673002: Adding blink gc memory dump infrastructure for thread specific dumps. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase and replacing main thread with thread id. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/platform/heap/BlinkGCMemoryDumpProvider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | Source/platform/heap/BlinkGCMemoryDumpProvider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698