WebKit Bugzilla
Attachment 346417 Details for
Bug 188277
: Move queue processing logic from CustomElementReactionStack to CustomElementReactionQueue
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Cleanup
bug-188277-20180802142228.patch (text/plain), 8.70 KB, created by
Ryosuke Niwa
on 2018-08-02 14:22:28 PDT
(
hide
)
Description:
Cleanup
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2018-08-02 14:22:28 PDT
Size:
8.70 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 234514) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,30 @@ >+2018-08-02 Ryosuke Niwa <rniwa@webkit.org> >+ >+ Move queue processing logic from CustomElementReactionStack to CustomElementReactionQueue >+ https://bugs.webkit.org/show_bug.cgi?id=188277 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Moved ensureCurrentQueue, processBackupQueue, ElementQueue, ensureBackupQueue, and backupElementQueue >+ from CustomElementReactionStack to CustomElementReactionQueue to simplify CustomElementReactionStack. >+ >+ No new tests since there is no behavior change. >+ >+ * dom/CustomElementReactionQueue.cpp: >+ (WebCore::CustomElementReactionQueue::enqueueElementUpgrade): >+ (WebCore::CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded): >+ (WebCore::CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded): >+ (WebCore::CustomElementReactionQueue::enqueueAdoptedCallbackIfNeeded): >+ (WebCore::CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded): >+ (WebCore::CustomElementReactionQueue::ElementQueue::add): Moved from CustomElementReactionStack. >+ (WebCore::CustomElementReactionQueue::ElementQueue::invokeAll): Ditto. >+ (WebCore::CustomElementReactionQueue::ensureCurrentQueue): Ditto. >+ (WebCore::CustomElementReactionQueue::ensureBackupQueue): Ditto. >+ (WebCore::CustomElementReactionQueue::processBackupQueue): Ditto. >+ (WebCore::CustomElementReactionQueue::backupElementQueue): Ditto. >+ * dom/CustomElementReactionQueue.h: >+ (WebCore::CustomElementReactionStack::hasCurrentProcessingStack): Deleted. It was never called. >+ > 2018-08-02 Timothy Hatcher <timothy@apple.com> > > Text selection color is hard to see in dark mode web views. >Index: Source/WebCore/dom/CustomElementReactionQueue.cpp >=================================================================== >--- Source/WebCore/dom/CustomElementReactionQueue.cpp (revision 234507) >+++ Source/WebCore/dom/CustomElementReactionQueue.cpp (working copy) >@@ -116,7 +116,7 @@ void CustomElementReactionQueue::clear() > > void CustomElementReactionQueue::enqueueElementUpgrade(Element& element) > { >- auto& queue = CustomElementReactionStack::ensureCurrentQueue(element); >+ auto& queue = ensureCurrentQueue(element); > queue.m_items.append({CustomElementReactionQueueItem::Type::ElementUpgrade}); > } > >@@ -142,7 +142,7 @@ void CustomElementReactionQueue::enqueue > { > ASSERT(element.isDefinedCustomElement()); > ASSERT(element.document().refCount() > 0); >- auto& queue = CustomElementReactionStack::ensureCurrentQueue(element); >+ auto& queue = ensureCurrentQueue(element); > if (queue.m_interface->hasConnectedCallback()) > queue.m_items.append({CustomElementReactionQueueItem::Type::Connected}); > } >@@ -152,7 +152,7 @@ void CustomElementReactionQueue::enqueue > ASSERT(element.isDefinedCustomElement()); > if (element.document().refCount() <= 0) > return; // Don't enqueue disconnectedCallback if the entire document is getting destructed. >- auto& queue = CustomElementReactionStack::ensureCurrentQueue(element); >+ auto& queue = ensureCurrentQueue(element); > if (queue.m_interface->hasDisconnectedCallback()) > queue.m_items.append({CustomElementReactionQueueItem::Type::Disconnected}); > } >@@ -161,7 +161,7 @@ void CustomElementReactionQueue::enqueue > { > ASSERT(element.isDefinedCustomElement()); > ASSERT(element.document().refCount() > 0); >- auto& queue = CustomElementReactionStack::ensureCurrentQueue(element); >+ auto& queue = ensureCurrentQueue(element); > if (queue.m_interface->hasAdoptedCallback()) > queue.m_items.append({oldDocument, newDocument}); > } >@@ -170,7 +170,7 @@ void CustomElementReactionQueue::enqueue > { > ASSERT(element.isDefinedCustomElement()); > ASSERT(element.document().refCount() > 0); >- auto& queue = CustomElementReactionStack::ensureCurrentQueue(element); >+ auto& queue = ensureCurrentQueue(element); > if (queue.m_interface->observesAttribute(attributeName.localName())) > queue.m_items.append({attributeName, oldValue, newValue}); > } >@@ -209,14 +209,14 @@ void CustomElementReactionQueue::invokeA > } > } > >-inline void CustomElementReactionStack::ElementQueue::add(Element& element) >+inline void CustomElementReactionQueue::ElementQueue::add(Element& element) > { > RELEASE_ASSERT(!m_invoking); > // FIXME: Avoid inserting the same element multiple times. > m_elements.append(element); > } > >-inline void CustomElementReactionStack::ElementQueue::invokeAll() >+inline void CustomElementReactionQueue::ElementQueue::invokeAll() > { > RELEASE_ASSERT(!m_invoking); > SetForScope<bool> invoking(m_invoking, true); >@@ -231,16 +231,16 @@ inline void CustomElementReactionStack:: > RELEASE_ASSERT(m_elements.isEmpty()); > } > >-CustomElementReactionQueue& CustomElementReactionStack::ensureCurrentQueue(Element& element) >+CustomElementReactionQueue& CustomElementReactionQueue::ensureCurrentQueue(Element& element) > { > ASSERT(element.reactionQueue()); >- if (!s_currentProcessingStack) { >- auto& queue = CustomElementReactionStack::ensureBackupQueue(); >+ if (!CustomElementReactionStack::s_currentProcessingStack) { >+ auto& queue = ensureBackupQueue(); > queue.add(element); > return *element.reactionQueue(); > } > >- auto*& queue = s_currentProcessingStack->m_queue; >+ auto*& queue = CustomElementReactionStack::s_currentProcessingStack->m_queue; > if (!queue) // We use a raw pointer to avoid genearing code to delete it in ~CustomElementReactionStack. > queue = new ElementQueue; > queue->add(element); >@@ -262,14 +262,14 @@ class BackupElementQueueMicrotask final > private: > Result run() final > { >- CustomElementReactionStack::processBackupQueue(); >+ CustomElementReactionQueue::processBackupQueue(); > return Result::Done; > } > }; > > static bool s_processingBackupElementQueue = false; > >-CustomElementReactionStack::ElementQueue& CustomElementReactionStack::ensureBackupQueue() >+CustomElementReactionQueue::ElementQueue& CustomElementReactionQueue::ensureBackupQueue() > { > if (!s_processingBackupElementQueue) { > s_processingBackupElementQueue = true; >@@ -278,13 +278,13 @@ CustomElementReactionStack::ElementQueue > return backupElementQueue(); > } > >-void CustomElementReactionStack::processBackupQueue() >+void CustomElementReactionQueue::processBackupQueue() > { > backupElementQueue().invokeAll(); > s_processingBackupElementQueue = false; > } > >-CustomElementReactionStack::ElementQueue& CustomElementReactionStack::backupElementQueue() >+CustomElementReactionQueue::ElementQueue& CustomElementReactionQueue::backupElementQueue() > { > static NeverDestroyed<ElementQueue> queue; > return queue.get(); >Index: Source/WebCore/dom/CustomElementReactionQueue.h >=================================================================== >--- Source/WebCore/dom/CustomElementReactionQueue.h (revision 234507) >+++ Source/WebCore/dom/CustomElementReactionQueue.h (working copy) >@@ -55,7 +55,23 @@ public: > void invokeAll(Element&); > void clear(); > >+ static void processBackupQueue(); >+ >+ class ElementQueue { >+ public: >+ void add(Element&); >+ void invokeAll(); >+ >+ private: >+ Vector<Ref<Element>> m_elements; >+ bool m_invoking { false }; >+ }; >+ > private: >+ static CustomElementReactionQueue& ensureCurrentQueue(Element&); >+ static ElementQueue& ensureBackupQueue(); >+ static ElementQueue& backupElementQueue(); >+ > Ref<JSCustomElementInterface> m_interface; > Vector<CustomElementReactionQueueItem> m_items; > }; >@@ -75,32 +91,15 @@ public: > s_currentProcessingStack = m_previousProcessingStack; > } > >- static CustomElementReactionQueue& ensureCurrentQueue(Element&); >- >- static bool hasCurrentProcessingStack() { return s_currentProcessingStack; } >- >- static void processBackupQueue(); >- > private: >- class ElementQueue { >- public: >- void add(Element&); >- void invokeAll(); >- >- private: >- Vector<Ref<Element>> m_elements; >- bool m_invoking { false }; >- }; >- > WEBCORE_EXPORT void processQueue(); > >- static ElementQueue& ensureBackupQueue(); >- static ElementQueue& backupElementQueue(); >- >- ElementQueue* m_queue { nullptr }; >+ CustomElementReactionQueue::ElementQueue* m_queue { nullptr }; // Use raw pointer to avoid generarting delete in the destructor. > CustomElementReactionStack* m_previousProcessingStack; > > WEBCORE_EXPORT static CustomElementReactionStack* s_currentProcessingStack; >+ >+ friend CustomElementReactionQueue; > }; > > }
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:
wenson_hsieh
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188277
: 346417