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

Side by Side Diff: third_party/WebKit/Source/web/WebKit.cpp

Issue 1787623003: Move LSan-specific shutdown code to ThreadState::cleanupMainThread (Closed) 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 ThreadState::attachMainThread(); 151 ThreadState::attachMainThread();
152 // currentThread() is null if we are running on a thread without a message l oop. 152 // currentThread() is null if we are running on a thread without a message l oop.
153 if (WebThread* currentThread = platform->currentThread()) { 153 if (WebThread* currentThread = platform->currentThread()) {
154 ASSERT(!s_gcTaskRunner); 154 ASSERT(!s_gcTaskRunner);
155 s_gcTaskRunner = new GCTaskRunner(currentThread); 155 s_gcTaskRunner = new GCTaskRunner(currentThread);
156 } 156 }
157 } 157 }
158 158
159 void shutdown() 159 void shutdown()
160 { 160 {
161 #if defined(LEAK_SANITIZER)
162 // If LSan is about to perform leak detection, release all the registered
163 // static Persistent<> root references to global caches that Blink keeps,
164 // followed by GCs to clear out all they referred to. A full v8 GC cycle
165 // is needed to flush out all garbage.
166 //
167 // This is not needed for caches over non-Oilpan objects, as they're
168 // not scanned by LSan due to being held in non-global storage
169 // ("static" references inside functions/methods.)
170 if (ThreadState* threadState = ThreadState::current()) {
171 threadState->releaseStaticPersistentNodes();
172 Heap::collectAllGarbage();
173 }
174 #endif
175
176 ThreadState::current()->cleanupMainThread(); 161 ThreadState::current()->cleanupMainThread();
177 162
178 // currentThread() is null if we are running on a thread without a message l oop. 163 // currentThread() is null if we are running on a thread without a message l oop.
179 if (Platform::current()->currentThread()) { 164 if (Platform::current()->currentThread()) {
180 // We don't need to (cannot) remove s_endOfTaskRunner from the current 165 // We don't need to (cannot) remove s_endOfTaskRunner from the current
181 // message loop, because the message loop is already destructed before 166 // message loop, because the message loop is already destructed before
182 // the shutdown() is called. 167 // the shutdown() is called.
183 delete s_endOfTaskRunner; 168 delete s_endOfTaskRunner;
184 s_endOfTaskRunner = nullptr; 169 s_endOfTaskRunner = nullptr;
185 } 170 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 ASSERT(!reloadPages); 251 ASSERT(!reloadPages);
267 Page::refreshPlugins(); 252 Page::refreshPlugins();
268 } 253 }
269 254
270 void decommitFreeableMemory() 255 void decommitFreeableMemory()
271 { 256 {
272 WTF::Partitions::decommitFreeableMemory(); 257 WTF::Partitions::decommitFreeableMemory();
273 } 258 }
274 259
275 } // namespace blink 260 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698