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

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

Issue 2697703005: Remove ThreadHeap::m_threads (Closed)
Patch Set: temp Created 3 years, 10 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 153 }
154 ~SweepForbiddenScope() { 154 ~SweepForbiddenScope() {
155 ASSERT(m_state->m_sweepForbidden); 155 ASSERT(m_state->m_sweepForbidden);
156 m_state->m_sweepForbidden = false; 156 m_state->m_sweepForbidden = false;
157 } 157 }
158 158
159 private: 159 private:
160 ThreadState* m_state; 160 ThreadState* m_state;
161 }; 161 };
162 162
163 void lockThreadAttachMutex();
164 void unlockThreadAttachMutex();
165
166 static void attachMainThread(); 163 static void attachMainThread();
167 164
168 // Associate ThreadState object with the current thread. After this 165 // Associate ThreadState object with the current thread. After this
169 // call thread can start using the garbage collected heap infrastructure. 166 // call thread can start using the garbage collected heap infrastructure.
170 // It also has to periodically check for safepoints. 167 // It also has to periodically check for safepoints.
171 static void attachCurrentThread(); 168 static void attachCurrentThread();
172 169
173 // Disassociate attached ThreadState from the current thread. The thread 170 // Disassociate attached ThreadState from the current thread. The thread
174 // can no longer use the garbage collected heap after this call. 171 // can no longer use the garbage collected heap after this call.
175 static void detachCurrentThread(); 172 static void detachCurrentThread();
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 601
605 void invokePreFinalizers(); 602 void invokePreFinalizers();
606 603
607 void takeSnapshot(SnapshotType); 604 void takeSnapshot(SnapshotType);
608 void clearArenaAges(); 605 void clearArenaAges();
609 int arenaIndexOfVectorArenaLeastRecentlyExpanded(int beginArenaIndex, 606 int arenaIndexOfVectorArenaLeastRecentlyExpanded(int beginArenaIndex,
610 int endArenaIndex); 607 int endArenaIndex);
611 608
612 void reportMemoryToV8(); 609 void reportMemoryToV8();
613 610
614 // Should only be called under protection of threadAttachMutex().
615 const Vector<std::unique_ptr<BlinkGCInterruptor>>& interruptors() const { 611 const Vector<std::unique_ptr<BlinkGCInterruptor>>& interruptors() const {
616 return m_interruptors; 612 return m_interruptors;
617 } 613 }
618 614
619 friend class SafePointBarrier; 615 friend class SafePointBarrier;
620 friend class SafePointScope; 616 friend class SafePointScope;
621 617
622 static WTF::ThreadSpecific<ThreadState*>* s_threadSpecific; 618 static WTF::ThreadSpecific<ThreadState*>* s_threadSpecific;
623 619
624 // We can't create a static member of type ThreadState here 620 // We can't create a static member of type ThreadState here
625 // because it will introduce global constructor and destructor. 621 // because it will introduce global constructor and destructor.
626 // We would like to manage lifetime of the ThreadState attached 622 // We would like to manage lifetime of the ThreadState attached
627 // to the main thread explicitly instead and still use normal 623 // to the main thread explicitly instead and still use normal
628 // constructor and destructor for the ThreadState class. 624 // constructor and destructor for the ThreadState class.
629 // For this we reserve static storage for the main ThreadState 625 // For this we reserve static storage for the main ThreadState
630 // and lazily construct ThreadState in it using placement new. 626 // and lazily construct ThreadState in it using placement new.
631 static uint8_t s_mainThreadStateStorage[]; 627 static uint8_t s_mainThreadStateStorage[];
632 628
633 ThreadHeap* m_heap; 629 std::unique_ptr<ThreadHeap> m_heap;
634 ThreadIdentifier m_thread; 630 ThreadIdentifier m_thread;
635 std::unique_ptr<PersistentRegion> m_persistentRegion; 631 std::unique_ptr<PersistentRegion> m_persistentRegion;
636 BlinkGC::StackState m_stackState; 632 BlinkGC::StackState m_stackState;
637 intptr_t* m_startOfStack; 633 intptr_t* m_startOfStack;
638 intptr_t* m_endOfStack; 634 intptr_t* m_endOfStack;
639 635
640 void* m_safePointScopeMarker; 636 void* m_safePointScopeMarker;
641 Vector<Address> m_safePointStackCopy; 637 Vector<Address> m_safePointStackCopy;
642 bool m_atSafePoint; 638 bool m_atSafePoint;
643 Vector<std::unique_ptr<BlinkGCInterruptor>> m_interruptors; 639 Vector<std::unique_ptr<BlinkGCInterruptor>> m_interruptors;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 class ThreadStateFor<AnyThread> { 715 class ThreadStateFor<AnyThread> {
720 STATIC_ONLY(ThreadStateFor); 716 STATIC_ONLY(ThreadStateFor);
721 717
722 public: 718 public:
723 static ThreadState* state() { return ThreadState::current(); } 719 static ThreadState* state() { return ThreadState::current(); }
724 }; 720 };
725 721
726 } // namespace blink 722 } // namespace blink
727 723
728 #endif // ThreadState_h 724 #endif // ThreadState_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698