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

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

Issue 1477023003: Refactor the Heap into ThreadHeap to prepare for per thread heaps Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 { 84 {
85 ASSERT(!s_platform); 85 ASSERT(!s_platform);
86 ASSERT(platform); 86 ASSERT(platform);
87 s_platform = platform; 87 s_platform = platform;
88 s_platform->m_mainThread = platform->currentThread(); 88 s_platform->m_mainThread = platform->currentThread();
89 89
90 WTF::Partitions::initialize(maxObservedSizeFunction); 90 WTF::Partitions::initialize(maxObservedSizeFunction);
91 WTF::initialize(); 91 WTF::initialize();
92 WTF::initializeMainThread(callOnMainThreadFunction); 92 WTF::initializeMainThread(callOnMainThreadFunction);
93 93
94 Heap::init(); 94 ProcessHeap::init();
95 95
96 ThreadState::attachMainThread(); 96 ThreadState::attachMainThread();
97 97
98 // TODO(ssid): remove this check after fixing crbug.com/486782. 98 // TODO(ssid): remove this check after fixing crbug.com/486782.
99 if (s_platform->m_mainThread) { 99 if (s_platform->m_mainThread) {
100 ASSERT(!s_gcTaskRunner); 100 ASSERT(!s_gcTaskRunner);
101 s_gcTaskRunner = new GCTaskRunner(s_platform->m_mainThread); 101 s_gcTaskRunner = new GCTaskRunner(s_platform->m_mainThread);
102 s_platform->registerMemoryDumpProvider(PartitionAllocMemoryDumpProvider: :instance(), "PartitionAlloc"); 102 s_platform->registerMemoryDumpProvider(PartitionAllocMemoryDumpProvider: :instance(), "PartitionAlloc");
103 s_platform->registerMemoryDumpProvider(FontCacheMemoryDumpProvider::inst ance(), "FontCaches"); 103 s_platform->registerMemoryDumpProvider(FontCacheMemoryDumpProvider::inst ance(), "FontCaches");
104 } 104 }
(...skipping 11 matching lines...) Expand all
116 s_platform->unregisterMemoryDumpProvider(PartitionAllocMemoryDumpProvide r::instance()); 116 s_platform->unregisterMemoryDumpProvider(PartitionAllocMemoryDumpProvide r::instance());
117 ASSERT(s_gcTaskRunner); 117 ASSERT(s_gcTaskRunner);
118 delete s_gcTaskRunner; 118 delete s_gcTaskRunner;
119 s_gcTaskRunner = nullptr; 119 s_gcTaskRunner = nullptr;
120 } 120 }
121 121
122 // Detach the main thread before starting the shutdown sequence 122 // Detach the main thread before starting the shutdown sequence
123 // so that the main thread won't get involved in a GC during the shutdown. 123 // so that the main thread won't get involved in a GC during the shutdown.
124 ThreadState::detachMainThread(); 124 ThreadState::detachMainThread();
125 125
126 Heap::shutdown(); 126 ProcessHeap::shutdown();
127 127
128 WTF::shutdown(); 128 WTF::shutdown();
129 WTF::Partitions::shutdown(); 129 WTF::Partitions::shutdown();
130 130
131 s_platform->m_mainThread = nullptr; 131 s_platform->m_mainThread = nullptr;
132 s_platform = nullptr; 132 s_platform = nullptr;
133 } 133 }
134 134
135 void Platform::setCurrentPlatformForTesting(Platform* platform) 135 void Platform::setCurrentPlatformForTesting(Platform* platform)
136 { 136 {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 ProviderToAdapterMap::iterator it = memoryDumpProviders().find(provider); 172 ProviderToAdapterMap::iterator it = memoryDumpProviders().find(provider);
173 if (it == memoryDumpProviders().end()) 173 if (it == memoryDumpProviders().end())
174 return; 174 return;
175 WebMemoryDumpProviderAdapter* adapter = it->value.get(); 175 WebMemoryDumpProviderAdapter* adapter = it->value.get();
176 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( adapter); 176 base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider( adapter);
177 adapter->set_is_registered(false); 177 adapter->set_is_registered(false);
178 memoryDumpProviders().remove(it); 178 memoryDumpProviders().remove(it);
179 } 179 }
180 180
181 } // namespace blink 181 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/WebThreadSupportingGC.cpp ('k') | third_party/WebKit/Source/platform/heap/BlinkGC.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698