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

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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 151 }
152 ~SweepForbiddenScope() { 152 ~SweepForbiddenScope() {
153 ASSERT(m_state->m_sweepForbidden); 153 ASSERT(m_state->m_sweepForbidden);
154 m_state->m_sweepForbidden = false; 154 m_state->m_sweepForbidden = false;
155 } 155 }
156 156
157 private: 157 private:
158 ThreadState* m_state; 158 ThreadState* m_state;
159 }; 159 };
160 160
161 void lockThreadAttachMutex();
162 void unlockThreadAttachMutex();
163
164 static void attachMainThread(); 161 static void attachMainThread();
165 162
166 // Associate ThreadState object with the current thread. After this 163 // Associate ThreadState object with the current thread. After this
167 // call thread can start using the garbage collected heap infrastructure. 164 // call thread can start using the garbage collected heap infrastructure.
168 // It also has to periodically check for safepoints. 165 // It also has to periodically check for safepoints.
169 static void attachCurrentThread(); 166 static void attachCurrentThread();
170 167
171 // Disassociate attached ThreadState from the current thread. The thread 168 // Disassociate attached ThreadState from the current thread. The thread
172 // can no longer use the garbage collected heap after this call. 169 // can no longer use the garbage collected heap after this call.
173 static void detachCurrentThread(); 170 static void detachCurrentThread();
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 603
607 // We can't create a static member of type ThreadState here 604 // We can't create a static member of type ThreadState here
608 // because it will introduce global constructor and destructor. 605 // because it will introduce global constructor and destructor.
609 // We would like to manage lifetime of the ThreadState attached 606 // We would like to manage lifetime of the ThreadState attached
610 // to the main thread explicitly instead and still use normal 607 // to the main thread explicitly instead and still use normal
611 // constructor and destructor for the ThreadState class. 608 // constructor and destructor for the ThreadState class.
612 // For this we reserve static storage for the main ThreadState 609 // For this we reserve static storage for the main ThreadState
613 // and lazily construct ThreadState in it using placement new. 610 // and lazily construct ThreadState in it using placement new.
614 static uint8_t s_mainThreadStateStorage[]; 611 static uint8_t s_mainThreadStateStorage[];
615 612
616 ThreadHeap* m_heap; 613 std::unique_ptr<ThreadHeap> m_heap;
617 ThreadIdentifier m_thread; 614 ThreadIdentifier m_thread;
618 std::unique_ptr<PersistentRegion> m_persistentRegion; 615 std::unique_ptr<PersistentRegion> m_persistentRegion;
619 BlinkGC::StackState m_stackState; 616 BlinkGC::StackState m_stackState;
620 intptr_t* m_startOfStack; 617 intptr_t* m_startOfStack;
621 intptr_t* m_endOfStack; 618 intptr_t* m_endOfStack;
622 619
623 void* m_safePointScopeMarker; 620 void* m_safePointScopeMarker;
624 Vector<Address> m_safePointStackCopy; 621 Vector<Address> m_safePointStackCopy;
625 bool m_sweepForbidden; 622 bool m_sweepForbidden;
626 size_t m_noAllocationCount; 623 size_t m_noAllocationCount;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 class ThreadStateFor<AnyThread> { 697 class ThreadStateFor<AnyThread> {
701 STATIC_ONLY(ThreadStateFor); 698 STATIC_ONLY(ThreadStateFor);
702 699
703 public: 700 public:
704 static ThreadState* state() { return ThreadState::current(); } 701 static ThreadState* state() { return ThreadState::current(); }
705 }; 702 };
706 703
707 } // namespace blink 704 } // namespace blink
708 705
709 #endif // ThreadState_h 706 #endif // ThreadState_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Heap.cpp ('k') | third_party/WebKit/Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698