Changeset 245258 in webkit
- Timestamp:
- May 13, 2019 3:32:34 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r245251 r245258 1 2019-05-13 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [WTF] Simplify GCThread and CompilationThread flags by adding them to WTF::Thread 4 https://bugs.webkit.org/show_bug.cgi?id=197146 5 6 Reviewed by Saam Barati. 7 8 Rename Heap::Thread to Heap::HeapThread to remove conflict between WTF::Thread. 9 10 * heap/AlignedMemoryAllocator.cpp: 11 (JSC::AlignedMemoryAllocator::registerDirectory): 12 * heap/Heap.cpp: 13 (JSC::Heap::HeapThread::HeapThread): 14 (JSC::Heap::Heap): 15 (JSC::Heap::runCurrentPhase): 16 (JSC::Heap::runBeginPhase): 17 (JSC::Heap::resumeThePeriphery): 18 (JSC::Heap::requestCollection): 19 (JSC::Heap::isCurrentThreadBusy): 20 (JSC::Heap::notifyIsSafeToCollect): 21 (JSC::Heap::Thread::Thread): Deleted. 22 * heap/Heap.h: 23 * heap/HeapInlines.h: 24 (JSC::Heap::incrementDeferralDepth): 25 (JSC::Heap::decrementDeferralDepth): 26 (JSC::Heap::decrementDeferralDepthAndGCIfNeeded): 27 * heap/MarkedSpace.cpp: 28 (JSC::MarkedSpace::prepareForAllocation): 29 1 30 2019-05-13 Saam Barati <sbarati@apple.com> 2 31 -
trunk/Source/JavaScriptCore/heap/AlignedMemoryAllocator.cpp
r240965 r245258 46 46 47 47 if (m_directories.isEmpty()) { 48 ASSERT(! mayBeGCThread() || directory->heap()->worldIsStopped());48 ASSERT(!Thread::mayBeGCThread() || directory->heap()->worldIsStopped()); 49 49 for (Subspace* subspace = m_subspaces.first(); subspace; subspace = subspace->nextSubspaceInAlignedMemoryAllocator()) 50 50 subspace->didCreateFirstDirectory(directory); -
trunk/Source/JavaScriptCore/heap/Heap.cpp
r244745 r245258 149 149 bool isValidThreadState(VM* vm) 150 150 { 151 if (vm->atomicStringTable() != WTF::Thread::current().atomicStringTable())151 if (vm->atomicStringTable() != Thread::current().atomicStringTable()) 152 152 return false; 153 153 … … 232 232 } // anonymous namespace 233 233 234 class Heap:: Thread : public AutomaticThread {234 class Heap::HeapThread : public AutomaticThread { 235 235 public: 236 Thread(const AbstractLocker& locker, Heap& heap)236 HeapThread(const AbstractLocker& locker, Heap& heap) 237 237 : AutomaticThread(locker, heap.m_threadLock, heap.m_threadCondition.copyRef()) 238 238 , m_heap(heap) … … 265 265 void threadDidStart() override 266 266 { 267 WTF::registerGCThread(GCThreadType::Main);267 Thread::registerGCThread(GCThreadType::Main); 268 268 } 269 269 … … 324 324 325 325 LockHolder locker(*m_threadLock); 326 m_thread = adoptRef(new Thread(locker, *this));326 m_thread = adoptRef(new HeapThread(locker, *this)); 327 327 } 328 328 … … 1170 1170 checkConn(conn); 1171 1171 m_currentThreadState = currentThreadState; 1172 m_currentThread = & WTF::Thread::current();1172 m_currentThread = &Thread::current(); 1173 1173 1174 1174 if (conn == GCConductor::Mutator) … … 1299 1299 } 1300 1300 1301 WTF::registerGCThread(GCThreadType::Helper);1301 Thread::registerGCThread(GCThreadType::Helper); 1302 1302 1303 1303 { … … 1696 1696 } 1697 1697 } 1698 WTF::Thread::yield();1698 Thread::yield(); 1699 1699 } 1700 1700 … … 2106 2106 2107 2107 ASSERT(vm()->currentThreadIsHoldingAPILock()); 2108 RELEASE_ASSERT(vm()->atomicStringTable() == WTF::Thread::current().atomicStringTable());2108 RELEASE_ASSERT(vm()->atomicStringTable() == Thread::current().atomicStringTable()); 2109 2109 2110 2110 LockHolder locker(*m_threadLock); … … 2549 2549 bool Heap::isCurrentThreadBusy() 2550 2550 { 2551 return mayBeGCThread() || mutatorState() != MutatorState::Running;2551 return Thread::mayBeGCThread() || mutatorState() != MutatorState::Running; 2552 2552 } 2553 2553 … … 2865 2865 2866 2866 if (Options::collectContinuously()) { 2867 m_collectContinuouslyThread = WTF::Thread::create(2867 m_collectContinuouslyThread = Thread::create( 2868 2868 "JSC DEBUG Continuous GC", 2869 2869 [this] () { -
trunk/Source/JavaScriptCore/heap/Heap.h
r243467 r245258 427 427 friend class WeakSet; 428 428 429 class Thread;430 friend class Thread;429 class HeapThread; 430 friend class HeapThread; 431 431 432 432 static const size_t minExtraMemory = 256; … … 728 728 RefPtr<AutomaticThread> m_thread; 729 729 730 RefPtr< WTF::Thread> m_collectContinuouslyThread { nullptr };730 RefPtr<Thread> m_collectContinuouslyThread { nullptr }; 731 731 732 732 MonotonicTime m_lastGCStartTime; … … 738 738 739 739 CurrentThreadState* m_currentThreadState { nullptr }; 740 WTF::Thread* m_currentThread { nullptr }; // It's OK if this becomes a dangling pointer.740 Thread* m_currentThread { nullptr }; // It's OK if this becomes a dangling pointer. 741 741 742 742 #if PLATFORM(IOS_FAMILY) -
trunk/Source/JavaScriptCore/heap/HeapInlines.h
r244088 r245258 174 174 inline void Heap::incrementDeferralDepth() 175 175 { 176 ASSERT(! mayBeGCThread() || m_worldIsStopped);176 ASSERT(!Thread::mayBeGCThread() || m_worldIsStopped); 177 177 m_deferralDepth++; 178 178 } … … 180 180 inline void Heap::decrementDeferralDepth() 181 181 { 182 ASSERT(! mayBeGCThread() || m_worldIsStopped);182 ASSERT(!Thread::mayBeGCThread() || m_worldIsStopped); 183 183 m_deferralDepth--; 184 184 } … … 186 186 inline void Heap::decrementDeferralDepthAndGCIfNeeded() 187 187 { 188 ASSERT(! mayBeGCThread() || m_worldIsStopped);188 ASSERT(!Thread::mayBeGCThread() || m_worldIsStopped); 189 189 m_deferralDepth--; 190 190 -
trunk/Source/JavaScriptCore/heap/MarkedSpace.cpp
r243688 r245258 260 260 void MarkedSpace::prepareForAllocation() 261 261 { 262 ASSERT(! mayBeGCThread() || m_heap->worldIsStopped());262 ASSERT(!Thread::mayBeGCThread() || m_heap->worldIsStopped()); 263 263 for (Subspace* subspace : m_subspaces) 264 264 subspace->prepareForAllocation(); -
trunk/Source/WTF/ChangeLog
r245254 r245258 1 2019-05-13 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [WTF] Simplify GCThread and CompilationThread flags by adding them to WTF::Thread 4 https://bugs.webkit.org/show_bug.cgi?id=197146 5 6 Reviewed by Saam Barati. 7 8 Since GCThread and CompilationThread flags exist in WTF, we put these flags into WTF::Thread directly instead of holding them in ThreadSpecific<>. 9 And this patch removes dependency from Threading.h to ThreadSpecific.h. ThreadSpecific.h's OS threading primitives are moved to ThreadingPrimitives.h, 10 and Threading.h relies on it instead. 11 12 * wtf/CompilationThread.cpp: 13 (WTF::isCompilationThread): 14 (WTF::initializeCompilationThreads): Deleted. 15 (WTF::exchangeIsCompilationThread): Deleted. 16 * wtf/CompilationThread.h: 17 (WTF::CompilationScope::CompilationScope): 18 (WTF::CompilationScope::~CompilationScope): 19 (WTF::CompilationScope::leaveEarly): 20 * wtf/MainThread.cpp: 21 (WTF::initializeMainThread): 22 (WTF::initializeMainThreadToProcessMainThread): 23 (WTF::isMainThreadOrGCThread): 24 (WTF::initializeGCThreads): Deleted. 25 (WTF::registerGCThread): Deleted. 26 (WTF::mayBeGCThread): Deleted. 27 * wtf/MainThread.h: 28 * wtf/ThreadSpecific.h: 29 (WTF::canBeGCThread>::ThreadSpecific): 30 (WTF::canBeGCThread>::set): 31 (WTF::threadSpecificKeyCreate): Deleted. 32 (WTF::threadSpecificKeyDelete): Deleted. 33 (WTF::threadSpecificSet): Deleted. 34 (WTF::threadSpecificGet): Deleted. 35 * wtf/Threading.cpp: 36 (WTF::Thread::exchangeIsCompilationThread): 37 (WTF::Thread::registerGCThread): 38 (WTF::Thread::mayBeGCThread): 39 * wtf/Threading.h: 40 (WTF::Thread::isCompilationThread const): 41 (WTF::Thread::gcThreadType const): 42 (WTF::Thread::joinableState const): 43 (WTF::Thread::hasExited const): 44 (WTF::Thread::Thread): 45 (WTF::Thread::joinableState): Deleted. 46 (WTF::Thread::hasExited): Deleted. 47 * wtf/ThreadingPrimitives.h: 48 (WTF::threadSpecificKeyCreate): 49 (WTF::threadSpecificKeyDelete): 50 (WTF::threadSpecificSet): 51 (WTF::threadSpecificGet): 52 * wtf/win/ThreadSpecificWin.cpp: 53 (WTF::flsKeys): 54 1 55 2019-05-13 Yusuke Suzuki <ysuzuki@apple.com> 2 56 -
trunk/Source/WTF/wtf/CompilationThread.cpp
r237099 r245258 27 27 #include <wtf/CompilationThread.h> 28 28 29 #include <mutex>30 29 #include <wtf/StdLibExtras.h> 31 #include <wtf/ThreadSpecific.h>32 30 #include <wtf/Threading.h> 33 31 34 32 namespace WTF { 35 33 36 static ThreadSpecific<bool, CanBeGCThread::True>* s_isCompilationThread;37 38 static void initializeCompilationThreads()39 {40 static std::once_flag initializeCompilationThreadsOnceFlag;41 std::call_once(initializeCompilationThreadsOnceFlag, []{42 s_isCompilationThread = new ThreadSpecific<bool, CanBeGCThread::True>();43 });44 }45 46 34 bool isCompilationThread() 47 35 { 48 if (!s_isCompilationThread) 49 return false; 50 if (!s_isCompilationThread->isSet()) 51 return false; 52 return **s_isCompilationThread; 53 } 54 55 bool exchangeIsCompilationThread(bool newValue) 56 { 57 initializeCompilationThreads(); 58 bool oldValue = isCompilationThread(); 59 **s_isCompilationThread = newValue; 60 return oldValue; 36 return Thread::current().isCompilationThread(); 61 37 } 62 38 -
trunk/Source/WTF/wtf/CompilationThread.h
r237099 r245258 26 26 #pragma once 27 27 28 #include <wtf/Threading.h> 29 28 30 namespace WTF { 29 30 WTF_EXPORT_PRIVATE bool exchangeIsCompilationThread(bool newValue);31 31 32 32 class CompilationScope { 33 33 public: 34 34 CompilationScope() 35 : m_oldValue( exchangeIsCompilationThread(true))35 : m_oldValue(Thread::exchangeIsCompilationThread(true)) 36 36 { 37 37 } … … 39 39 ~CompilationScope() 40 40 { 41 exchangeIsCompilationThread(m_oldValue);41 Thread::exchangeIsCompilationThread(m_oldValue); 42 42 } 43 43 44 44 void leaveEarly() 45 45 { 46 exchangeIsCompilationThread(m_oldValue);46 Thread::exchangeIsCompilationThread(m_oldValue); 47 47 } 48 48 private: … … 53 53 54 54 using WTF::CompilationScope; 55 using WTF::exchangeIsCompilationThread; -
trunk/Source/WTF/wtf/MainThread.cpp
r239427 r245258 58 58 initializeThreading(); 59 59 initializeMainThreadPlatform(); 60 initializeGCThreads();61 60 }); 62 61 } … … 69 68 initializeThreading(); 70 69 initializeMainThreadToProcessMainThreadPlatform(); 71 initializeGCThreads();72 70 }); 73 71 } … … 158 156 } 159 157 160 static ThreadSpecific<Optional<GCThreadType>, CanBeGCThread::True>* isGCThread;161 162 void initializeGCThreads()163 {164 static std::once_flag flag;165 std::call_once(166 flag,167 [] {168 isGCThread = new ThreadSpecific<Optional<GCThreadType>, CanBeGCThread::True>();169 });170 }171 172 void registerGCThread(GCThreadType type)173 {174 if (!isGCThread) {175 // This happens if we're running in a process that doesn't care about176 // MainThread.177 return;178 }179 180 **isGCThread = type;181 }182 183 158 bool isMainThreadOrGCThread() 184 159 { 185 if ( mayBeGCThread())160 if (Thread::mayBeGCThread()) 186 161 return true; 187 162 188 163 return isMainThread(); 189 }190 191 Optional<GCThreadType> mayBeGCThread()192 {193 if (!isGCThread)194 return WTF::nullopt;195 if (!isGCThread->isSet())196 return WTF::nullopt;197 return **isGCThread;198 164 } 199 165 -
trunk/Source/WTF/wtf/MainThread.h
r243795 r245258 69 69 #endif // USE(WEB_THREAD) 70 70 71 WTF_EXPORT_PRIVATE void initializeGCThreads();72 73 enum class GCThreadType {74 Main,75 Helper76 };77 78 void printInternal(PrintStream&, GCThreadType);79 80 WTF_EXPORT_PRIVATE void registerGCThread(GCThreadType);81 WTF_EXPORT_PRIVATE Optional<GCThreadType> mayBeGCThread();82 71 WTF_EXPORT_PRIVATE bool isMainThreadOrGCThread(); 83 72 … … 99 88 } // namespace WTF 100 89 101 using WTF::GCThreadType;102 90 using WTF::callOnMainThread; 103 91 using WTF::callOnMainThreadAndWait; … … 107 95 using WTF::isUIThread; 108 96 using WTF::isWebThread; 109 using WTF::mayBeGCThread;110 97 using WTF::setMainThreadCallbacksPaused; 111 98 #if PLATFORM(COCOA) -
trunk/Source/WTF/wtf/ThreadSpecific.h
r237099 r245258 45 45 #include <wtf/Noncopyable.h> 46 46 #include <wtf/StdLibExtras.h> 47 48 #if USE(PTHREADS) 49 #include <pthread.h> 50 51 #if OS(HURD) 52 // PTHREAD_KEYS_MAX is not defined in bionic nor in Hurd, so explicitly define it here. 53 #define PTHREAD_KEYS_MAX 1024 54 #else 55 #include <limits.h> 56 #endif 57 58 #elif OS(WINDOWS) 59 #include <windows.h> 60 #endif 47 #include <wtf/Threading.h> 61 48 62 49 namespace WTF { 63 64 #if OS(WINDOWS) && CPU(X86)65 #define THREAD_SPECIFIC_CALL __stdcall66 #else67 #define THREAD_SPECIFIC_CALL68 #endif69 50 70 51 enum class CanBeGCThread { … … 130 111 #if USE(PTHREADS) 131 112 132 typedef pthread_key_t ThreadSpecificKey;133 134 static const constexpr ThreadSpecificKey InvalidThreadSpecificKey = PTHREAD_KEYS_MAX;135 136 inline void threadSpecificKeyCreate(ThreadSpecificKey* key, void (*destructor)(void *))137 {138 int error = pthread_key_create(key, destructor);139 if (error)140 CRASH();141 }142 143 inline void threadSpecificKeyDelete(ThreadSpecificKey key)144 {145 int error = pthread_key_delete(key);146 if (error)147 CRASH();148 }149 150 inline void threadSpecificSet(ThreadSpecificKey key, void* value)151 {152 pthread_setspecific(key, value);153 }154 155 inline void* threadSpecificGet(ThreadSpecificKey key)156 {157 return pthread_getspecific(key);158 }159 160 113 template<typename T, CanBeGCThread canBeGCThread> 161 114 inline ThreadSpecific<T, canBeGCThread>::ThreadSpecific() … … 186 139 // 1) Once the instance of ThreadSpecific<> is created, it will not be destructed until the program dies. 187 140 // 2) We do not need to hold many instances of ThreadSpecific<> data. This fixed number should be far enough. 188 const int kMaxFlsKeySize = 128;141 static constexpr int maxFlsKeySize = 128; 189 142 190 143 WTF_EXPORT_PRIVATE long& flsKeyCount(); 191 144 WTF_EXPORT_PRIVATE DWORD* flsKeys(); 192 193 typedef DWORD ThreadSpecificKey;194 195 static const constexpr ThreadSpecificKey InvalidThreadSpecificKey = FLS_OUT_OF_INDEXES;196 197 inline void threadSpecificKeyCreate(ThreadSpecificKey* key, void (THREAD_SPECIFIC_CALL *destructor)(void *))198 {199 DWORD flsKey = FlsAlloc(destructor);200 if (flsKey == FLS_OUT_OF_INDEXES)201 CRASH();202 203 *key = flsKey;204 }205 206 inline void threadSpecificKeyDelete(ThreadSpecificKey key)207 {208 FlsFree(key);209 }210 211 inline void threadSpecificSet(ThreadSpecificKey key, void* data)212 {213 FlsSetValue(key, data);214 }215 216 inline void* threadSpecificGet(ThreadSpecificKey key)217 {218 return FlsGetValue(key);219 }220 145 221 146 template<typename T, CanBeGCThread canBeGCThread> … … 228 153 229 154 m_index = InterlockedIncrement(&flsKeyCount()) - 1; 230 if (m_index >= kMaxFlsKeySize)155 if (m_index >= maxFlsKeySize) 231 156 CRASH(); 232 157 flsKeys()[m_index] = flsKey; … … 275 200 inline T* ThreadSpecific<T, canBeGCThread>::set() 276 201 { 277 RELEASE_ASSERT(canBeGCThread == CanBeGCThread::True || ! mayBeGCThread());202 RELEASE_ASSERT(canBeGCThread == CanBeGCThread::True || !Thread::mayBeGCThread()); 278 203 ASSERT(!get()); 279 204 Data* data = new Data(this); // Data will set itself into TLS. -
trunk/Source/WTF/wtf/Threading.cpp
r242812 r245258 260 260 } 261 261 262 bool Thread::exchangeIsCompilationThread(bool newValue) 263 { 264 auto& thread = Thread::current(); 265 bool oldValue = thread.m_isCompilationThread; 266 thread.m_isCompilationThread = newValue; 267 return oldValue; 268 } 269 270 void Thread::registerGCThread(GCThreadType gcThreadType) 271 { 272 Thread::current().m_gcThreadType = static_cast<unsigned>(gcThreadType); 273 } 274 275 bool Thread::mayBeGCThread() 276 { 277 return Thread::current().gcThreadType() != GCThreadType::None; 278 } 279 262 280 void Thread::setCurrentThreadIsUserInteractive(int relativePriority) 263 281 { -
trunk/Source/WTF/wtf/Threading.h
r241739 r245258 44 44 #include <wtf/StackStats.h> 45 45 #include <wtf/ThreadSafeRefCounted.h> 46 #include <wtf/ThreadSpecific.h>47 46 #include <wtf/Vector.h> 48 47 #include <wtf/WordLock.h> … … 81 80 WTF_EXPORT_PRIVATE int waitForThreadCompletion(ThreadIdentifier); 82 81 #endif 82 83 enum class GCThreadType : uint8_t { 84 None = 0, 85 Main, 86 Helper, 87 }; 83 88 84 89 class Thread : public ThreadSafeRefCounted<Thread> { … … 151 156 WTF_EXPORT_PRIVATE static void yield(); 152 157 158 WTF_EXPORT_PRIVATE static bool exchangeIsCompilationThread(bool newValue); 159 WTF_EXPORT_PRIVATE static void registerGCThread(GCThreadType); 160 WTF_EXPORT_PRIVATE static bool mayBeGCThread(); 161 153 162 WTF_EXPORT_PRIVATE void dump(PrintStream& out) const; 154 163 … … 203 212 #endif 204 213 214 bool isCompilationThread() const { return m_isCompilationThread; } 215 GCThreadType gcThreadType() const { return static_cast<GCThreadType>(m_gcThreadType); } 216 205 217 struct NewThreadContext; 206 218 static void entryPoint(NewThreadContext*); 207 219 protected: 208 Thread() = default;220 Thread(); 209 221 210 222 void initializeInThread(); … … 239 251 }; 240 252 241 JoinableState joinableState() { return m_joinableState; }253 JoinableState joinableState() const { return m_joinableState; } 242 254 void didBecomeDetached() { m_joinableState = Detached; } 243 255 void didExit(); 244 256 void didJoin() { m_joinableState = Joined; } 245 bool hasExited() { return m_didExit; }257 bool hasExited() const { return m_didExit; } 246 258 247 259 // These functions are only called from ThreadGroup. … … 281 293 282 294 JoinableState m_joinableState { Joinable }; 283 bool m_isShuttingDown { false }; 284 bool m_didExit { false }; 285 bool m_isDestroyedOnce { false }; 295 bool m_isShuttingDown : 1; 296 bool m_didExit : 1; 297 bool m_isDestroyedOnce : 1; 298 bool m_isCompilationThread: 1; 299 unsigned m_gcThreadType : 2; 286 300 287 301 // Lock & ParkingLot rely on ThreadSpecific. But Thread object can be destroyed even after ThreadSpecific things are destroyed. … … 311 325 void* m_apiData { nullptr }; 312 326 }; 327 328 inline Thread::Thread() 329 : m_isShuttingDown(false) 330 , m_didExit(false) 331 , m_isDestroyedOnce(false) 332 , m_isCompilationThread(false) 333 , m_gcThreadType(static_cast<unsigned>(GCThreadType::None)) 334 { 335 } 313 336 314 337 inline Thread* Thread::currentMayBeNull() … … 346 369 347 370 using WTF::Thread; 371 using WTF::GCThreadType; 348 372 349 373 #if OS(WINDOWS) -
trunk/Source/WTF/wtf/ThreadingPrimitives.h
r237099 r245258 31 31 #pragma once 32 32 33 #include <limits.h> 33 34 #include <wtf/FastMalloc.h> 34 35 #include <wtf/Locker.h> … … 42 43 #if USE(PTHREADS) 43 44 #include <pthread.h> 45 #if !defined(PTHREAD_KEYS_MAX) 46 // PTHREAD_KEYS_MAX is not defined in bionic nor in Hurd, so explicitly define it here. 47 #define PTHREAD_KEYS_MAX 1024 48 #endif 49 #endif 50 51 #if OS(WINDOWS) && CPU(X86) 52 #define THREAD_SPECIFIC_CALL __stdcall 53 #else 54 #define THREAD_SPECIFIC_CALL 44 55 #endif 45 56 … … 52 63 using PlatformMutex = pthread_mutex_t; 53 64 using PlatformCondition = pthread_cond_t; 65 using ThreadSpecificKey = pthread_key_t; 54 66 #elif OS(WINDOWS) 55 67 using ThreadIdentifier = uint32_t; … … 57 69 using PlatformMutex = SRWLOCK; 58 70 using PlatformCondition = CONDITION_VARIABLE; 71 using ThreadSpecificKey = DWORD; 59 72 #else 60 73 #error "Not supported platform" … … 105 118 }; 106 119 120 #if USE(PTHREADS) 121 122 static constexpr ThreadSpecificKey InvalidThreadSpecificKey = PTHREAD_KEYS_MAX; 123 124 inline void threadSpecificKeyCreate(ThreadSpecificKey* key, void (*destructor)(void *)) 125 { 126 int error = pthread_key_create(key, destructor); 127 if (error) 128 CRASH(); 129 } 130 131 inline void threadSpecificKeyDelete(ThreadSpecificKey key) 132 { 133 int error = pthread_key_delete(key); 134 if (error) 135 CRASH(); 136 } 137 138 inline void threadSpecificSet(ThreadSpecificKey key, void* value) 139 { 140 pthread_setspecific(key, value); 141 } 142 143 inline void* threadSpecificGet(ThreadSpecificKey key) 144 { 145 return pthread_getspecific(key); 146 } 147 148 #elif OS(WINDOWS) 149 150 static constexpr ThreadSpecificKey InvalidThreadSpecificKey = FLS_OUT_OF_INDEXES; 151 152 inline void threadSpecificKeyCreate(ThreadSpecificKey* key, void (THREAD_SPECIFIC_CALL *destructor)(void *)) 153 { 154 DWORD flsKey = FlsAlloc(destructor); 155 if (flsKey == FLS_OUT_OF_INDEXES) 156 CRASH(); 157 158 *key = flsKey; 159 } 160 161 inline void threadSpecificKeyDelete(ThreadSpecificKey key) 162 { 163 FlsFree(key); 164 } 165 166 inline void threadSpecificSet(ThreadSpecificKey key, void* data) 167 { 168 FlsSetValue(key, data); 169 } 170 171 inline void* threadSpecificGet(ThreadSpecificKey key) 172 { 173 return FlsGetValue(key); 174 } 175 176 #endif 177 107 178 } // namespace WTF 108 179 -
trunk/Source/WTF/wtf/win/ThreadSpecificWin.cpp
r240636 r245258 35 35 DWORD* flsKeys() 36 36 { 37 static DWORD keys[ kMaxFlsKeySize];37 static DWORD keys[maxFlsKeySize]; 38 38 return keys; 39 39 } -
trunk/Source/WebCore/ChangeLog
r245253 r245258 1 2019-05-13 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [WTF] Simplify GCThread and CompilationThread flags by adding them to WTF::Thread 4 https://bugs.webkit.org/show_bug.cgi?id=197146 5 6 Reviewed by Saam Barati. 7 8 * Modules/indexeddb/IDBDatabase.cpp: 9 (WebCore::IDBDatabase::hasPendingActivity const): 10 * Modules/indexeddb/IDBRequest.cpp: 11 (WebCore::IDBRequest::hasPendingActivity const): 12 * Modules/indexeddb/IDBTransaction.cpp: 13 (WebCore::IDBTransaction::hasPendingActivity const): 14 1 15 2019-05-13 Geoffrey Garen <ggaren@apple.com> 2 16 -
trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp
r243887 r245258 78 78 bool IDBDatabase::hasPendingActivity() const 79 79 { 80 ASSERT(&originThread() == &Thread::current() || mayBeGCThread());80 ASSERT(&originThread() == &Thread::current() || Thread::mayBeGCThread()); 81 81 82 82 if (m_closedInServer || isContextStopped()) -
trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp
r244674 r245258 268 268 bool IDBRequest::hasPendingActivity() const 269 269 { 270 ASSERT(&originThread() == &Thread::current() || mayBeGCThread());270 ASSERT(&originThread() == &Thread::current() || Thread::mayBeGCThread()); 271 271 return !m_contextStopped && m_hasPendingActivity; 272 272 } -
trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp
r244674 r245258 332 332 bool IDBTransaction::hasPendingActivity() const 333 333 { 334 ASSERT(&m_database->originThread() == &Thread::current() || mayBeGCThread());334 ASSERT(&m_database->originThread() == &Thread::current() || Thread::mayBeGCThread()); 335 335 return !m_contextStopped && m_state != IndexedDB::TransactionState::Finished; 336 336 }
Note: See TracChangeset
for help on using the changeset viewer.