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

Side by Side Diff: third_party/WebKit/Source/platform/heap/Heap.cpp

Issue 1754313002: Simplify the shutdown sequence of Oilpan's heap (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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 #endif 131 #endif
132 132
133 GCInfoTable::init(); 133 GCInfoTable::init();
134 134
135 if (Platform::current() && Platform::current()->currentThread()) 135 if (Platform::current() && Platform::current()->currentThread())
136 Platform::current()->registerMemoryDumpProvider(BlinkGCMemoryDumpProvide r::instance(), "BlinkGC"); 136 Platform::current()->registerMemoryDumpProvider(BlinkGCMemoryDumpProvide r::instance(), "BlinkGC");
137 } 137 }
138 138
139 void Heap::shutdown() 139 void Heap::shutdown()
140 { 140 {
141 ASSERT(s_markingStack);
142
141 if (Platform::current() && Platform::current()->currentThread()) 143 if (Platform::current() && Platform::current()->currentThread())
142 Platform::current()->unregisterMemoryDumpProvider(BlinkGCMemoryDumpProvi der::instance()); 144 Platform::current()->unregisterMemoryDumpProvider(BlinkGCMemoryDumpProvi der::instance());
143 s_shutdownCalled = true;
144 ThreadState::shutdownHeapIfNecessary();
145 }
146 145
147 void Heap::doShutdown() 146 // The main thread must be the last thread that gets detached.
148 { 147 RELEASE_ASSERT(ThreadState::attachedThreads().size() == 0);
149 // We don't want to call doShutdown() twice.
150 if (!s_markingStack)
151 return;
152 148
153 ASSERT(!ThreadState::attachedThreads().size());
154 delete s_heapDoesNotContainCache; 149 delete s_heapDoesNotContainCache;
155 s_heapDoesNotContainCache = nullptr; 150 s_heapDoesNotContainCache = nullptr;
156 delete s_freePagePool; 151 delete s_freePagePool;
157 s_freePagePool = nullptr; 152 s_freePagePool = nullptr;
158 delete s_orphanedPagePool; 153 delete s_orphanedPagePool;
159 s_orphanedPagePool = nullptr; 154 s_orphanedPagePool = nullptr;
160 delete s_globalWeakCallbackStack; 155 delete s_globalWeakCallbackStack;
161 s_globalWeakCallbackStack = nullptr; 156 s_globalWeakCallbackStack = nullptr;
162 delete s_postMarkingCallbackStack; 157 delete s_postMarkingCallbackStack;
163 s_postMarkingCallbackStack = nullptr; 158 s_postMarkingCallbackStack = nullptr;
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 size_t Heap::s_wrapperCountAtLastGC = 0; 683 size_t Heap::s_wrapperCountAtLastGC = 0;
689 size_t Heap::s_collectedWrapperCount = 0; 684 size_t Heap::s_collectedWrapperCount = 0;
690 size_t Heap::s_partitionAllocSizeAtLastGC = 0; 685 size_t Heap::s_partitionAllocSizeAtLastGC = 0;
691 double Heap::s_estimatedMarkingTimePerByte = 0.0; 686 double Heap::s_estimatedMarkingTimePerByte = 0.0;
692 bool Heap::s_isLowEndDevice = false; 687 bool Heap::s_isLowEndDevice = false;
693 #if ENABLE(ASSERT) 688 #if ENABLE(ASSERT)
694 uint16_t Heap::s_gcGeneration = 0; 689 uint16_t Heap::s_gcGeneration = 0;
695 #endif 690 #endif
696 691
697 } // namespace blink 692 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Heap.h ('k') | third_party/WebKit/Source/platform/heap/ThreadState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698