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

Side by Side Diff: sky/engine/core/dom/custom/CustomElementMicrotaskRunQueue.cpp

Issue 709203002: Remove more oilpan. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 "config.h" 5 #include "config.h"
6 #include "core/dom/custom/CustomElementMicrotaskRunQueue.h" 6 #include "core/dom/custom/CustomElementMicrotaskRunQueue.h"
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "core/dom/Microtask.h" 9 #include "core/dom/Microtask.h"
10 #include "core/dom/custom/CustomElementAsyncImportMicrotaskQueue.h" 10 #include "core/dom/custom/CustomElementAsyncImportMicrotaskQueue.h"
11 #include "core/dom/custom/CustomElementSyncMicrotaskQueue.h" 11 #include "core/dom/custom/CustomElementSyncMicrotaskQueue.h"
12 #include "core/html/imports/HTMLImportLoader.h" 12 #include "core/html/imports/HTMLImportLoader.h"
13 13
14 #include <stdio.h> 14 #include <stdio.h>
15 15
16 namespace blink { 16 namespace blink {
17 17
18 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(CustomElementMicrotaskRunQueue)
19
20 CustomElementMicrotaskRunQueue::CustomElementMicrotaskRunQueue() 18 CustomElementMicrotaskRunQueue::CustomElementMicrotaskRunQueue()
21 : m_syncQueue(CustomElementSyncMicrotaskQueue::create()) 19 : m_syncQueue(CustomElementSyncMicrotaskQueue::create())
22 , m_asyncQueue(CustomElementAsyncImportMicrotaskQueue::create()) 20 , m_asyncQueue(CustomElementAsyncImportMicrotaskQueue::create())
23 , m_dispatchIsPending(false) 21 , m_dispatchIsPending(false)
24 , m_weakFactory(this) 22 , m_weakFactory(this)
25 { 23 {
26 } 24 }
27 25
26 CustomElementMicrotaskRunQueue::~CustomElementMicrotaskRunQueue()
27 {
28 }
29
28 void CustomElementMicrotaskRunQueue::enqueue(HTMLImportLoader* parentLoader, Pas sOwnPtr<CustomElementMicrotaskStep> step, bool importIsSync) 30 void CustomElementMicrotaskRunQueue::enqueue(HTMLImportLoader* parentLoader, Pas sOwnPtr<CustomElementMicrotaskStep> step, bool importIsSync)
29 { 31 {
30 if (importIsSync) { 32 if (importIsSync) {
31 if (parentLoader) 33 if (parentLoader)
32 parentLoader->microtaskQueue()->enqueue(step); 34 parentLoader->microtaskQueue()->enqueue(step);
33 else 35 else
34 m_syncQueue->enqueue(step); 36 m_syncQueue->enqueue(step);
35 } else { 37 } else {
36 m_asyncQueue->enqueue(step); 38 m_asyncQueue->enqueue(step);
37 } 39 }
38 40
39 requestDispatchIfNeeded(); 41 requestDispatchIfNeeded();
40 } 42 }
41 43
42 void CustomElementMicrotaskRunQueue::requestDispatchIfNeeded() 44 void CustomElementMicrotaskRunQueue::requestDispatchIfNeeded()
43 { 45 {
44 if (m_dispatchIsPending || isEmpty()) 46 if (m_dispatchIsPending || isEmpty())
45 return; 47 return;
46 Microtask::enqueueMicrotask(base::Bind(&CustomElementMicrotaskRunQueue::disp atch, m_weakFactory.GetWeakPtr())); 48 Microtask::enqueueMicrotask(base::Bind(&CustomElementMicrotaskRunQueue::disp atch, m_weakFactory.GetWeakPtr()));
47 m_dispatchIsPending = true; 49 m_dispatchIsPending = true;
48 } 50 }
49 51
50 void CustomElementMicrotaskRunQueue::trace(Visitor* visitor)
51 {
52 visitor->trace(m_syncQueue);
53 visitor->trace(m_asyncQueue);
54 }
55
56 void CustomElementMicrotaskRunQueue::dispatch() 52 void CustomElementMicrotaskRunQueue::dispatch()
57 { 53 {
58 m_dispatchIsPending = false; 54 m_dispatchIsPending = false;
59 m_syncQueue->dispatch(); 55 m_syncQueue->dispatch();
60 if (m_syncQueue->isEmpty()) 56 if (m_syncQueue->isEmpty())
61 m_asyncQueue->dispatch(); 57 m_asyncQueue->dispatch();
62 } 58 }
63 59
64 bool CustomElementMicrotaskRunQueue::isEmpty() const 60 bool CustomElementMicrotaskRunQueue::isEmpty() const
65 { 61 {
66 return m_syncQueue->isEmpty() && m_asyncQueue->isEmpty(); 62 return m_syncQueue->isEmpty() && m_asyncQueue->isEmpty();
67 } 63 }
68 64
69 } // namespace blink 65 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/dom/custom/CustomElementMicrotaskRunQueue.h ('k') | sky/engine/core/dom/custom/CustomElementMicrotaskStep.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698