WebKit Bugzilla
Attachment 339702 Details for
Bug 185349
: [WTF] Embed default atomic string table in Thread
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185349-20180507114956.patch (text/plain), 5.40 KB, created by
Yusuke Suzuki
on 2018-05-06 19:49:57 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yusuke Suzuki
Created:
2018-05-06 19:49:57 PDT
Size:
5.40 KB
patch
obsolete
>Subversion Revision: 231401 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index b2bea75c04d9732b15e5a64daf9d3a7cd65c2d11..613fadd3e3a31e0352fe4e73e3e0a1493f32badb 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,24 @@ >+2018-05-06 Yusuke Suzuki <utatane.tea@gmail.com> >+ >+ [WTF] Embed default atomic string table in Thread >+ https://bugs.webkit.org/show_bug.cgi?id=185349 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Do not need to allocate AtomicStringTable separate from Thread >+ since the table's lifetime is completely the same as Thread. >+ >+ This patch just embeds it as a data member of Thread. >+ >+ * wtf/Threading.cpp: >+ (WTF::Thread::initializeInThread): >+ (WTF::Thread::didExit): >+ * wtf/Threading.h: >+ * wtf/text/AtomicStringTable.cpp: >+ (WTF::AtomicStringTable::create): Deleted. >+ (WTF::AtomicStringTable::destroy): Deleted. >+ * wtf/text/AtomicStringTable.h: >+ > 2018-05-04 Tim Horton <timothy_horton@apple.com> > > Shift to a lower-level framework for simplifying URLs >diff --git a/Source/WTF/wtf/Threading.cpp b/Source/WTF/wtf/Threading.cpp >index d4ce4fc5264ee5c29bea6ad161c0398ee480663a..078f73ac8100e89f72f2004efdd005504414bfa7 100644 >--- a/Source/WTF/wtf/Threading.cpp >+++ b/Source/WTF/wtf/Threading.cpp >@@ -98,8 +98,15 @@ void Thread::initializeInThread() > if (m_stack.isEmpty()) > m_stack = StackBounds::currentThreadStackBounds(); > m_savedLastStackTop = stack().origin(); >- AtomicStringTable::create(*this); >- m_currentAtomicStringTable = m_defaultAtomicStringTable; >+ >+ m_currentAtomicStringTable = &m_defaultAtomicStringTable; >+#if USE(WEB_THREAD) >+ // On iOS, one AtomicStringTable is shared between the main UI thread and the WebThread. >+ if (isWebThread() || isUIThread()) { >+ static NeverDestroyed<AtomicStringTable> sharedStringTable; >+ m_currentAtomicStringTable = &sharedStringTable.get(); >+ } >+#endif > } > > void Thread::entryPoint(NewThreadContext* newThreadContext) >@@ -196,8 +203,6 @@ void Thread::didExit() > } > } > >- AtomicStringTable::destroy(m_defaultAtomicStringTable); >- > // We would like to say "thread is exited" after unregistering threads from thread groups. > // So we need to separate m_isShuttingDown from m_didExit. > auto locker = holdLock(m_mutex); >diff --git a/Source/WTF/wtf/Threading.h b/Source/WTF/wtf/Threading.h >index 47e019fb95c88d454fc1b54f914d633f57b64417..aa6630573c60d9827bde082590efffade7bad0fe 100644 >--- a/Source/WTF/wtf/Threading.h >+++ b/Source/WTF/wtf/Threading.h >@@ -46,6 +46,7 @@ > #include <wtf/ThreadSpecific.h> > #include <wtf/Vector.h> > #include <wtf/WordLock.h> >+#include <wtf/text/AtomicStringTable.h> > > #if USE(PTHREADS) && !OS(DARWIN) > #include <signal.h> >@@ -54,7 +55,6 @@ > namespace WTF { > > class AbstractLocker; >-class AtomicStringTable; > class ThreadMessageData; > > enum class ThreadGroupAddResult; >@@ -77,7 +77,6 @@ WTF_EXPORT_PRIVATE int waitForThreadCompletion(ThreadIdentifier); > class Thread : public ThreadSafeRefCounted<Thread> { > public: > friend class ThreadGroup; >- friend class AtomicStringTable; > friend WTF_EXPORT_PRIVATE void initializeThreading(); > #if OS(WINDOWS) > friend WTF_EXPORT_PRIVATE int waitForThreadCompletion(ThreadIdentifier); >@@ -290,7 +289,7 @@ class Thread : public ThreadSafeRefCounted<Thread> { > #endif > > AtomicStringTable* m_currentAtomicStringTable { nullptr }; >- AtomicStringTable* m_defaultAtomicStringTable { nullptr }; >+ AtomicStringTable m_defaultAtomicStringTable; > > #if ENABLE(STACK_STATS) > StackStats::PerThreadStats m_stackStats; >diff --git a/Source/WTF/wtf/text/AtomicStringTable.cpp b/Source/WTF/wtf/text/AtomicStringTable.cpp >index d422b054eb68846358ac7cab250c2008f552ec43..f0630d9bfea823e511a9034b2da432f2bdd7816f 100644 >--- a/Source/WTF/wtf/text/AtomicStringTable.cpp >+++ b/Source/WTF/wtf/text/AtomicStringTable.cpp >@@ -29,35 +29,10 @@ > > namespace WTF { > >-void AtomicStringTable::create(Thread& thread) >-{ >-#if USE(WEB_THREAD) >- // On iOS, one AtomicStringTable is shared between the main UI thread and the WebThread. >- static AtomicStringTable* sharedStringTable = new AtomicStringTable; >- >- if (isWebThread() || isUIThread()) { >- thread.m_defaultAtomicStringTable = sharedStringTable; >- return; >- } >-#endif // USE(WEB_THREAD) >- thread.m_defaultAtomicStringTable = new AtomicStringTable; >-} >- > AtomicStringTable::~AtomicStringTable() > { > for (auto* string : m_table) > string->setIsAtomic(false); > } > >-void AtomicStringTable::destroy(AtomicStringTable* table) >-{ >-#if USE(WEB_THREAD) >- // We do the following so that destruction of default atomic string table happens only >- // once - on the main UI thread. >- if (isWebThread()) >- return; >-#endif // USE(WEB_THREAD) >- delete table; >-} >- > } >diff --git a/Source/WTF/wtf/text/AtomicStringTable.h b/Source/WTF/wtf/text/AtomicStringTable.h >index 4fd97f25cb7e9b94d1d24e1068c5b21189d73013..6b57f7c10eb366e999432b3407d88c774eb4cd34 100644 >--- a/Source/WTF/wtf/text/AtomicStringTable.h >+++ b/Source/WTF/wtf/text/AtomicStringTable.h >@@ -29,15 +29,12 @@ > namespace WTF { > > class StringImpl; >-class Thread; > > class AtomicStringTable { > WTF_MAKE_FAST_ALLOCATED; > public: > WTF_EXPORT_PRIVATE ~AtomicStringTable(); > >- static void create(Thread&); >- static void destroy(AtomicStringTable*); > HashSet<StringImpl*>& table() { return m_table; } > > private:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
darin
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185349
:
339640
|
339643
|
339644
| 339702