OLD | NEW |
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 Loading... |
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 Loading... |
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 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |