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

Side by Side Diff: Source/core/dom/custom/CustomElementMicrotaskStepDispatcher.cpp

Issue 334253005: Custom Elements: Encapsulates Async and Sync Queues into one class. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/dom/custom/CustomElementMicrotaskStepDispatcher.h"
7
8 #include "core/dom/custom/CustomElementMicrotaskImportStep.h"
9 #include "core/html/imports/HTMLImportLoader.h"
10
11 namespace WebCore {
12
13 CustomElementMicrotaskStepDispatcher::CustomElementMicrotaskStepDispatcher()
14 : m_syncQueue(CustomElementSyncMicrotaskQueue::create())
15 , m_asyncQueue(CustomElementAsyncImportMicrotaskQueue::create())
16 {
17 }
18
19 void CustomElementMicrotaskStepDispatcher::enqueue(HTMLImportLoader* parentLoade r, PassOwnPtrWillBeRawPtr<CustomElementMicrotaskStep> step)
20 {
21 if (parentLoader)
22 parentLoader->microtaskQueue()->enqueue(step);
23 else
24 m_syncQueue->enqueue(step);
25 }
26
27 void CustomElementMicrotaskStepDispatcher::enqueue(HTMLImportLoader* parentLoade r, PassOwnPtrWillBeRawPtr<CustomElementMicrotaskImportStep> step, bool importIsS ync)
28 {
29 if (importIsSync)
30 enqueue(parentLoader, PassOwnPtrWillBeRawPtr<CustomElementMicrotaskStep> (step));
31 else
32 m_asyncQueue->enqueue(step);
33 }
34
35 void CustomElementMicrotaskStepDispatcher::dispatch()
36 {
37 m_syncQueue->dispatch();
38 if (m_syncQueue->isEmpty())
39 m_asyncQueue->dispatch();
40 }
41
42 void CustomElementMicrotaskStepDispatcher::trace(Visitor* visitor)
43 {
44 visitor->trace(m_syncQueue);
45 visitor->trace(m_asyncQueue);
46 }
47
48 #if !defined(NDEBUG)
49 void CustomElementMicrotaskStepDispatcher::show(unsigned indent)
50 {
51 fprintf(stderr, "%*sSync:\n", indent, "");
52 m_syncQueue->show(indent + 1);
53 fprintf(stderr, "%*sAsync:\n", indent, "");
54 m_asyncQueue->show(indent + 1);
55 }
56 #endif
57
58 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/custom/CustomElementMicrotaskStepDispatcher.h ('k') | Source/core/dom/custom/CustomElementScheduler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698