Changeset 225938 in webkit
- Timestamp:
- Dec 14, 2017, 3:51:05 PM (9 years ago)
- Location:
- trunk/Source
- Files:
-
- 13 edited
-
WTF/ChangeLog (modified) (1 diff)
-
WTF/wtf/ParallelJobsGeneric.cpp (modified) (2 diffs)
-
WTF/wtf/Threading.cpp (modified) (3 diffs)
-
WTF/wtf/Threading.h (modified) (1 diff)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/workers/WorkerThread.cpp (modified) (2 diffs)
-
WebCore/workers/WorkerThread.h (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/UIProcess/API/glib/IconDatabase.cpp (modified) (1 diff)
-
WebKit/UIProcess/API/glib/IconDatabase.h (modified) (1 diff)
-
WebKitLegacy/ChangeLog (modified) (1 diff)
-
WebKitLegacy/Storage/StorageThread.cpp (modified) (1 diff)
-
WebKitLegacy/Storage/StorageThread.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r225913 r225938 1 2017-12-14 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 Drop Thread::tryCreate 4 https://bugs.webkit.org/show_bug.cgi?id=180808 5 6 Reviewed by Darin Adler. 7 8 We remove Thread::tryCreate. When thread creation fails, we have no way to keep WebKit working. 9 Compared to tryMalloc, Thread::create always consumes fixed size of resource. If it fails, 10 this is not due to arbitrary large user request. It is not reasonable that some thread creations 11 are handled gracefully while the other thread creations are not. 12 13 If we would like to have the limit of number of users' thread creation (like, calling `new Worker` 14 so many times), we should have a soft limit instead of relying on system's hard limit. 15 16 * wtf/ParallelJobsGeneric.cpp: 17 (WTF::ParallelEnvironment::ThreadPrivate::tryLockFor): 18 * wtf/Threading.cpp: 19 (WTF::Thread::create): 20 (WTF::Thread::tryCreate): Deleted. 21 * wtf/Threading.h: 22 (WTF::Thread::create): Deleted. 23 1 24 2017-12-13 Keith Miller <keith_miller@apple.com> 2 25 -
trunk/Source/WTF/wtf/ParallelJobsGeneric.cpp
r225778 r225938 95 95 96 96 if (!m_thread) { 97 m_thread = Thread:: tryCreate("Parallel worker", [this] {97 m_thread = Thread::create("Parallel worker", [this] { 98 98 LockHolder lock(m_mutex); 99 99 100 while ( m_thread) {100 while (true) { 101 101 if (m_running) { 102 102 (*m_threadFunction)(m_parameters); 103 103 m_running = false; 104 m_parent = 0;104 m_parent = nullptr; 105 105 m_threadCondition.notifyOne(); 106 106 } … … 110 110 }); 111 111 } 112 113 if (m_thread) 114 m_parent = parent; 112 m_parent = parent; 115 113 116 114 m_mutex.unlock(); 117 return m_thread;115 return true; 118 116 } 119 117 -
trunk/Source/WTF/wtf/Threading.cpp
r225778 r225938 130 130 } 131 131 132 Ref Ptr<Thread> Thread::tryCreate(const char* name, Function<void()>&& entryPoint)132 Ref<Thread> Thread::create(const char* name, Function<void()>&& entryPoint) 133 133 { 134 134 WTF::initializeThreading(); … … 143 143 { 144 144 MutexLocker locker(context->mutex); 145 if (!thread->establishHandle(context.ptr())) { 146 context->deref(); 147 return nullptr; 148 } 145 bool success = thread->establishHandle(context.ptr()); 146 RELEASE_ASSERT(success); 149 147 context->stage = NewThreadContext::Stage::EstablishedHandle; 150 148 … … 161 159 162 160 ASSERT(!thread->stack().isEmpty()); 163 return WTFMove(thread);161 return thread; 164 162 } 165 163 -
trunk/Source/WTF/wtf/Threading.h
r225778 r225938 87 87 // Returns nullptr if thread creation failed. 88 88 // The thread name must be a literal since on some platforms it's passed in to the thread. 89 WTF_EXPORT_PRIVATE static RefPtr<Thread> tryCreate(const char* threadName, Function<void()>&&); 90 static inline Ref<Thread> create(const char* threadName, Function<void()>&& function) 91 { 92 auto thread = tryCreate(threadName, WTFMove(function)); 93 RELEASE_ASSERT(thread); 94 return thread.releaseNonNull(); 95 } 89 WTF_EXPORT_PRIVATE static Ref<Thread> create(const char* threadName, Function<void()>&&); 96 90 97 91 // Returns Thread object. -
trunk/Source/WebCore/ChangeLog
r225936 r225938 1 2017-12-14 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 Drop Thread::tryCreate 4 https://bugs.webkit.org/show_bug.cgi?id=180808 5 6 Reviewed by Darin Adler. 7 8 This change reveals that nobody cares the WorkerThread::start's failure. 9 We should use `Thread::create` to ensure thread is actually starting. 10 11 * workers/WorkerThread.cpp: 12 (WebCore::WorkerThread::start): 13 * workers/WorkerThread.h: 14 1 15 2017-12-14 Alicia Boya García <aboya@igalia.com> 2 16 -
trunk/Source/WebCore/workers/WorkerThread.cpp
r225778 r225938 131 131 } 132 132 133 boolWorkerThread::start(WTF::Function<void(const String&)>&& evaluateCallback)133 void WorkerThread::start(WTF::Function<void(const String&)>&& evaluateCallback) 134 134 { 135 135 // Mutex protection is necessary to ensure that m_thread is initialized when the thread starts. … … 137 137 138 138 if (m_thread) 139 return true;139 return; 140 140 141 141 m_evaluateCallback = WTFMove(evaluateCallback); 142 142 143 m_thread = Thread:: tryCreate("WebCore: Worker", [this] {143 m_thread = Thread::create("WebCore: Worker", [this] { 144 144 workerThread(); 145 145 }); 146 147 return m_thread;148 146 } 149 147 -
trunk/Source/WebCore/workers/WorkerThread.h
r225470 r225938 64 64 virtual ~WorkerThread(); 65 65 66 WEBCORE_EXPORT boolstart(WTF::Function<void(const String&)>&& evaluateCallback);66 WEBCORE_EXPORT void start(WTF::Function<void(const String&)>&& evaluateCallback); 67 67 void stop(WTF::Function<void()>&& terminatedCallback); 68 68 -
trunk/Source/WebKit/ChangeLog
r225935 r225938 1 2017-12-14 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 Drop Thread::tryCreate 4 https://bugs.webkit.org/show_bug.cgi?id=180808 5 6 Reviewed by Darin Adler. 7 8 We still return bool since IconDatabase::open returns `false` if it is opened twice. 9 10 * UIProcess/API/glib/IconDatabase.cpp: 11 (WebKit::IconDatabase::open): 12 * UIProcess/API/glib/IconDatabase.h: 13 1 14 2017-12-14 Brady Eidson <beidson@apple.com> 2 15 -
trunk/Source/WebKit/UIProcess/API/glib/IconDatabase.cpp
r225778 r225938 220 220 // completes and m_syncThreadRunning is properly set 221 221 m_syncLock.lock(); 222 m_syncThread = Thread:: tryCreate("WebCore: IconDatabase", [this] {222 m_syncThread = Thread::create("WebCore: IconDatabase", [this] { 223 223 iconDatabaseSyncThread(); 224 224 }); 225 m_syncThreadRunning = m_syncThread;225 m_syncThreadRunning = true; 226 226 m_syncLock.unlock(); 227 if (!m_syncThread)228 return false;229 227 return true; 230 228 } -
trunk/Source/WebKit/UIProcess/API/glib/IconDatabase.h
r221238 r225938 286 286 PageURLRecord* getOrCreatePageURLRecord(const String& pageURL); 287 287 288 bool m_isEnabled { false };288 bool m_isEnabled { false }; 289 289 bool m_privateBrowsingEnabled { false }; 290 290 -
trunk/Source/WebKitLegacy/ChangeLog
r225778 r225938 1 2017-12-14 Yusuke Suzuki <utatane.tea@gmail.com> 2 3 Drop Thread::tryCreate 4 https://bugs.webkit.org/show_bug.cgi?id=180808 5 6 Reviewed by Darin Adler. 7 8 * Storage/StorageThread.cpp: 9 (WebCore::StorageThread::start): 10 * Storage/StorageThread.h: 11 1 12 2017-12-12 Yusuke Suzuki <utatane.tea@gmail.com> 2 13 -
trunk/Source/WebKitLegacy/Storage/StorageThread.cpp
r225778 r225938 51 51 } 52 52 53 boolStorageThread::start()53 void StorageThread::start() 54 54 { 55 55 ASSERT(isMainThread()); 56 56 if (!m_thread) { 57 m_thread = Thread:: tryCreate("WebCore: LocalStorage", [this] {57 m_thread = Thread::create("WebCore: LocalStorage", [this] { 58 58 threadEntryPoint(); 59 59 }); 60 60 } 61 61 activeStorageThreads().add(this); 62 return m_thread;63 62 } 64 63 -
trunk/Source/WebKitLegacy/Storage/StorageThread.h
r218816 r225938 42 42 ~StorageThread(); 43 43 44 boolstart();44 void start(); 45 45 void terminate(); 46 46
Note:
See TracChangeset
for help on using the changeset viewer.