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

Side by Side Diff: third_party/WebKit/Source/core/dom/custom/V0CustomElementMicrotaskRunQueue.cpp

Issue 1914923002: Rename all existing custom element classes as V0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CustomElementV0 -> V0CustomElement Created 4 years, 7 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/dom/custom/CustomElementMicrotaskRunQueue.h" 5 #include "core/dom/custom/V0CustomElementMicrotaskRunQueue.h"
6 6
7 #include "bindings/core/v8/Microtask.h" 7 #include "bindings/core/v8/Microtask.h"
8 #include "core/dom/custom/CustomElementAsyncImportMicrotaskQueue.h" 8 #include "core/dom/custom/V0CustomElementAsyncImportMicrotaskQueue.h"
9 #include "core/dom/custom/CustomElementSyncMicrotaskQueue.h" 9 #include "core/dom/custom/V0CustomElementSyncMicrotaskQueue.h"
10 #include "core/html/imports/HTMLImportLoader.h" 10 #include "core/html/imports/HTMLImportLoader.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 CustomElementMicrotaskRunQueue::CustomElementMicrotaskRunQueue() 14 V0CustomElementMicrotaskRunQueue::V0CustomElementMicrotaskRunQueue()
15 : m_syncQueue(CustomElementSyncMicrotaskQueue::create()) 15 : m_syncQueue(V0CustomElementSyncMicrotaskQueue::create())
16 , m_asyncQueue(CustomElementAsyncImportMicrotaskQueue::create()) 16 , m_asyncQueue(V0CustomElementAsyncImportMicrotaskQueue::create())
17 , m_dispatchIsPending(false) 17 , m_dispatchIsPending(false)
18 { 18 {
19 } 19 }
20 20
21 void CustomElementMicrotaskRunQueue::enqueue(HTMLImportLoader* parentLoader, Cus tomElementMicrotaskStep* step, bool importIsSync) 21 void V0CustomElementMicrotaskRunQueue::enqueue(HTMLImportLoader* parentLoader, V 0CustomElementMicrotaskStep* step, bool importIsSync)
22 { 22 {
23 if (importIsSync) { 23 if (importIsSync) {
24 if (parentLoader) 24 if (parentLoader)
25 parentLoader->microtaskQueue()->enqueue(step); 25 parentLoader->microtaskQueue()->enqueue(step);
26 else 26 else
27 m_syncQueue->enqueue(step); 27 m_syncQueue->enqueue(step);
28 } else { 28 } else {
29 m_asyncQueue->enqueue(step); 29 m_asyncQueue->enqueue(step);
30 } 30 }
31 31
32 requestDispatchIfNeeded(); 32 requestDispatchIfNeeded();
33 } 33 }
34 34
35 void CustomElementMicrotaskRunQueue::requestDispatchIfNeeded() 35 void V0CustomElementMicrotaskRunQueue::requestDispatchIfNeeded()
36 { 36 {
37 if (m_dispatchIsPending || isEmpty()) 37 if (m_dispatchIsPending || isEmpty())
38 return; 38 return;
39 Microtask::enqueueMicrotask(WTF::bind(&CustomElementMicrotaskRunQueue::dispa tch, WeakPersistentThisPointer<CustomElementMicrotaskRunQueue>(this))); 39 Microtask::enqueueMicrotask(WTF::bind(&V0CustomElementMicrotaskRunQueue::dis patch, WeakPersistentThisPointer<V0CustomElementMicrotaskRunQueue>(this)));
40 m_dispatchIsPending = true; 40 m_dispatchIsPending = true;
41 } 41 }
42 42
43 DEFINE_TRACE(CustomElementMicrotaskRunQueue) 43 DEFINE_TRACE(V0CustomElementMicrotaskRunQueue)
44 { 44 {
45 visitor->trace(m_syncQueue); 45 visitor->trace(m_syncQueue);
46 visitor->trace(m_asyncQueue); 46 visitor->trace(m_asyncQueue);
47 } 47 }
48 48
49 void CustomElementMicrotaskRunQueue::dispatch() 49 void V0CustomElementMicrotaskRunQueue::dispatch()
50 { 50 {
51 m_dispatchIsPending = false; 51 m_dispatchIsPending = false;
52 m_syncQueue->dispatch(); 52 m_syncQueue->dispatch();
53 if (m_syncQueue->isEmpty()) 53 if (m_syncQueue->isEmpty())
54 m_asyncQueue->dispatch(); 54 m_asyncQueue->dispatch();
55 } 55 }
56 56
57 bool CustomElementMicrotaskRunQueue::isEmpty() const 57 bool V0CustomElementMicrotaskRunQueue::isEmpty() const
58 { 58 {
59 return m_syncQueue->isEmpty() && m_asyncQueue->isEmpty(); 59 return m_syncQueue->isEmpty() && m_asyncQueue->isEmpty();
60 } 60 }
61 61
62 } // namespace blink 62 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698