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

Side by Side Diff: third_party/WebKit/Source/platform/heap/ThreadState.h

Issue 2625293002: Remove ThreadHeapMode (Closed)
Patch Set: Created 3 years, 11 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 m_state->m_sweepForbidden = false; 160 m_state->m_sweepForbidden = false;
161 } 161 }
162 162
163 private: 163 private:
164 ThreadState* m_state; 164 ThreadState* m_state;
165 }; 165 };
166 166
167 void lockThreadAttachMutex(); 167 void lockThreadAttachMutex();
168 void unlockThreadAttachMutex(); 168 void unlockThreadAttachMutex();
169 169
170 BlinkGC::ThreadHeapMode threadHeapMode() const { return m_threadHeapMode; }
171
172 bool isTerminating() { return m_isTerminating; } 170 bool isTerminating() { return m_isTerminating; }
173 171
174 static void attachMainThread(); 172 static void attachMainThread();
175 static void detachMainThread(); 173 static void detachMainThread();
176 void cleanupMainThread(); 174 void cleanupMainThread();
177 175
178 // Associate ThreadState object with the current thread. After this 176 // Associate ThreadState object with the current thread. After this
179 // call thread can start using the garbage collected heap infrastructure. 177 // call thread can start using the garbage collected heap infrastructure.
180 // It also has to periodically check for safepoints. 178 // It also has to periodically check for safepoints.
181 static void attachCurrentThread(BlinkGC::ThreadHeapMode); 179 static void attachCurrentThread();
182 180
183 // Disassociate attached ThreadState from the current thread. The thread 181 // Disassociate attached ThreadState from the current thread. The thread
184 // can no longer use the garbage collected heap after this call. 182 // can no longer use the garbage collected heap after this call.
185 static void detachCurrentThread(); 183 static void detachCurrentThread();
186 184
187 static ThreadState* current() { 185 static ThreadState* current() {
188 #if defined(__GLIBC__) || OS(ANDROID) || OS(FREEBSD) 186 #if defined(__GLIBC__) || OS(ANDROID) || OS(FREEBSD)
189 // TLS lookup is fast in these platforms. 187 // TLS lookup is fast in these platforms.
190 return **s_threadSpecific; 188 return **s_threadSpecific;
191 #else 189 #else
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 // value. 579 // value.
582 bool isOnThreadHeap(const void* object) const { 580 bool isOnThreadHeap(const void* object) const {
583 return &fromObject(object)->heap() == &heap(); 581 return &fromObject(object)->heap() == &heap();
584 } 582 }
585 583
586 private: 584 private:
587 template <typename T> 585 template <typename T>
588 friend class PrefinalizerRegistration; 586 friend class PrefinalizerRegistration;
589 enum SnapshotType { HeapSnapshot, FreelistSnapshot }; 587 enum SnapshotType { HeapSnapshot, FreelistSnapshot };
590 588
591 explicit ThreadState(BlinkGC::ThreadHeapMode); 589 ThreadState();
592 ~ThreadState(); 590 ~ThreadState();
593 591
594 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); 592 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope();
595 void clearSafePointScopeMarker() { 593 void clearSafePointScopeMarker() {
596 m_safePointStackCopy.clear(); 594 m_safePointStackCopy.clear();
597 m_safePointScopeMarker = nullptr; 595 m_safePointScopeMarker = nullptr;
598 } 596 }
599 597
600 // shouldSchedule{Precise,Idle}GC and shouldForceConservativeGC 598 // shouldSchedule{Precise,Idle}GC and shouldForceConservativeGC
601 // implement the heuristics that are used to determine when to collect 599 // implement the heuristics that are used to determine when to collect
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 size_t m_noAllocationCount; 695 size_t m_noAllocationCount;
698 size_t m_gcForbiddenCount; 696 size_t m_gcForbiddenCount;
699 size_t m_mixinsBeingConstructedCount; 697 size_t m_mixinsBeingConstructedCount;
700 double m_accumulatedSweepingTime; 698 double m_accumulatedSweepingTime;
701 699
702 BaseArena* m_arenas[BlinkGC::NumberOfArenas]; 700 BaseArena* m_arenas[BlinkGC::NumberOfArenas];
703 int m_vectorBackingArenaIndex; 701 int m_vectorBackingArenaIndex;
704 size_t m_arenaAges[BlinkGC::NumberOfArenas]; 702 size_t m_arenaAges[BlinkGC::NumberOfArenas];
705 size_t m_currentArenaAges; 703 size_t m_currentArenaAges;
706 704
707 const BlinkGC::ThreadHeapMode m_threadHeapMode;
708 bool m_isTerminating; 705 bool m_isTerminating;
709 GarbageCollectedMixinConstructorMarker* m_gcMixinMarker; 706 GarbageCollectedMixinConstructorMarker* m_gcMixinMarker;
710 707
711 bool m_shouldFlushHeapDoesNotContainCache; 708 bool m_shouldFlushHeapDoesNotContainCache;
712 GCState m_gcState; 709 GCState m_gcState;
713 710
714 std::unique_ptr<CallbackStack> m_threadLocalWeakCallbackStack; 711 std::unique_ptr<CallbackStack> m_threadLocalWeakCallbackStack;
715 712
716 using PreFinalizerCallback = bool (*)(void*); 713 using PreFinalizerCallback = bool (*)(void*);
717 using PreFinalizer = std::pair<void*, PreFinalizerCallback>; 714 using PreFinalizer = std::pair<void*, PreFinalizerCallback>;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 class ThreadStateFor<AnyThread> { 772 class ThreadStateFor<AnyThread> {
776 STATIC_ONLY(ThreadStateFor); 773 STATIC_ONLY(ThreadStateFor);
777 774
778 public: 775 public:
779 static ThreadState* state() { return ThreadState::current(); } 776 static ThreadState* state() { return ThreadState::current(); }
780 }; 777 };
781 778
782 } // namespace blink 779 } // namespace blink
783 780
784 #endif // ThreadState_h 781 #endif // ThreadState_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698