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

Side by Side Diff: Source/core/dom/custom/CustomElementMicrotaskQueue.h

Issue 334253005: Custom Elements: Encapsulates Async and Sync Queues into one class. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef CustomElementMicrotaskQueue_h 31 #ifndef CustomElementMicrotaskQueue_h
32 #define CustomElementMicrotaskQueue_h 32 #define CustomElementMicrotaskQueue_h
33 33
34 #include "core/dom/custom/CustomElementMicrotaskStep.h" 34 #include "core/dom/custom/CustomElementAsyncImportMicrotaskQueue.h"
35 #include "platform/heap/Handle.h" 35 #include "core/dom/custom/CustomElementSyncMicrotaskQueue.h"
36 #include "wtf/OwnPtr.h"
37 #include "wtf/PassOwnPtr.h"
38 #include "wtf/PassRefPtr.h"
39 #include "wtf/RefCounted.h"
40 #include "wtf/RefPtr.h"
41 #include "wtf/Vector.h"
42 36
43 namespace WebCore { 37 namespace WebCore {
44 38
45 class CustomElementMicrotaskQueueBase : public RefCountedWillBeGarbageCollectedF inalized<CustomElementMicrotaskQueueBase> { 39 class HTMLImportLoader;
46 WTF_MAKE_NONCOPYABLE(CustomElementMicrotaskQueueBase); 40
41 class CustomElementMicrotaskQueue : public RefCountedWillBeGarbageCollectedFinal ized<CustomElementMicrotaskQueue> {
dominicc (has gone to gerrit) 2014/06/17 00:29:23 Shouldn't you IWYU RefCountedWillBeGarbageCollecte
dominicc (has gone to gerrit) 2014/06/17 00:29:23 I think the naming of these types is wrong. Given
Hajime Morrita 2014/06/17 17:19:51 Done.
Hajime Morrita 2014/06/17 17:19:51 Well, right. This isn't queue at all. Renaed to Qu
42 WTF_MAKE_NONCOPYABLE(CustomElementMicrotaskQueue);
47 public: 43 public:
48 virtual ~CustomElementMicrotaskQueueBase() { } 44 static PassRefPtrWillBeRawPtr<CustomElementMicrotaskQueue> create() { return adoptRefWillBeNoop(new CustomElementMicrotaskQueue()); }
49 45
50 bool isEmpty() const { return m_queue.isEmpty(); } 46 CustomElementMicrotaskQueue();
dominicc (has gone to gerrit) 2014/06/17 00:29:23 Why is this visible?
Hajime Morrita 2014/06/17 17:19:51 Done.
47
48 void enqueue(HTMLImportLoader* parentLoader, PassOwnPtrWillBeRawPtr<CustomEl ementMicrotaskStep>);
49 void enqueue(HTMLImportLoader* parentLoader, PassOwnPtrWillBeRawPtr<CustomEl ementMicrotaskImportStep>, bool importIsSync);
50
51 void dispatch(); 51 void dispatch();
52
53 void trace(Visitor*); 52 void trace(Visitor*);
54 53
55 #if !defined(NDEBUG) 54 #if !defined(NDEBUG)
56 void show(unsigned indent); 55 void show(unsigned indent);
57 #endif 56 #endif
58 57
59 protected:
60 CustomElementMicrotaskQueueBase() { }
61 virtual void doDispatch() = 0;
62
63 WillBeHeapVector<OwnPtrWillBeMember<CustomElementMicrotaskStep> > m_queue;
64 };
65
66 class CustomElementMicrotaskQueue : public CustomElementMicrotaskQueueBase {
67 public:
68 static PassRefPtrWillBeRawPtr<CustomElementMicrotaskQueue> create() { return adoptRefWillBeNoop(new CustomElementMicrotaskQueue()); }
69
70 void enqueue(PassOwnPtrWillBeRawPtr<CustomElementMicrotaskStep>);
71
72 private: 58 private:
73 CustomElementMicrotaskQueue() { } 59 RefPtrWillBeMember<CustomElementSyncMicrotaskQueue> m_syncQueue;
dominicc (has gone to gerrit) 2014/06/17 00:29:23 Why do these need to be pointers? Are they shared
Hajime Morrita 2014/06/17 17:19:51 Yes. They are ref counted objects and one of them
74 virtual void doDispatch(); 60 RefPtrWillBeMember<CustomElementAsyncImportMicrotaskQueue> m_asyncQueue;
75 }; 61 };
76 62
77 } 63 }
78 64
79 #endif // CustomElementMicrotaskQueue_h 65 #endif // CustomElementMicrotaskQueue_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698