| OLD | NEW |
| 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 23 matching lines...) Expand all Loading... |
| 34 #include "core/dom/custom/CustomElementMicrotaskStep.h" | 34 #include "core/dom/custom/CustomElementMicrotaskStep.h" |
| 35 #include "wtf/OwnPtr.h" | 35 #include "wtf/OwnPtr.h" |
| 36 #include "wtf/PassOwnPtr.h" | 36 #include "wtf/PassOwnPtr.h" |
| 37 #include "wtf/PassRefPtr.h" | 37 #include "wtf/PassRefPtr.h" |
| 38 #include "wtf/RefCounted.h" | 38 #include "wtf/RefCounted.h" |
| 39 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
| 40 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
| 41 | 41 |
| 42 namespace WebCore { | 42 namespace WebCore { |
| 43 | 43 |
| 44 class CustomElementMicrotaskQueue : public RefCounted<CustomElementMicrotaskQueu
e> { | 44 class CustomElementMicrotaskQueueBase : public RefCounted<CustomElementMicrotask
QueueBase> { |
| 45 WTF_MAKE_NONCOPYABLE(CustomElementMicrotaskQueue); | 45 WTF_MAKE_NONCOPYABLE(CustomElementMicrotaskQueueBase); |
| 46 public: | 46 public: |
| 47 static PassRefPtr<CustomElementMicrotaskQueue> create() { return adoptRef(ne
w CustomElementMicrotaskQueue()); } | 47 virtual ~CustomElementMicrotaskQueueBase() { } |
| 48 | |
| 49 | 48 |
| 50 bool isEmpty() const { return m_queue.isEmpty(); } | 49 bool isEmpty() const { return m_queue.isEmpty(); } |
| 51 void enqueue(PassOwnPtr<CustomElementMicrotaskStep>); | 50 void dispatch(); |
| 52 | |
| 53 typedef CustomElementMicrotaskStep::Result Result; | |
| 54 Result dispatch(); | |
| 55 bool needsProcessOrStop() const; | |
| 56 | 51 |
| 57 #if !defined(NDEBUG) | 52 #if !defined(NDEBUG) |
| 58 void show(unsigned indent); | 53 void show(unsigned indent); |
| 59 #endif | 54 #endif |
| 55 |
| 56 protected: |
| 57 CustomElementMicrotaskQueueBase() { } |
| 58 virtual void doDispatch() = 0; |
| 59 |
| 60 Vector<OwnPtr<CustomElementMicrotaskStep> > m_queue; |
| 61 }; |
| 62 |
| 63 class CustomElementMicrotaskQueue : public CustomElementMicrotaskQueueBase { |
| 64 public: |
| 65 static PassRefPtr<CustomElementMicrotaskQueue> create() { return adoptRef(ne
w CustomElementMicrotaskQueue()); } |
| 66 |
| 67 void enqueue(PassOwnPtr<CustomElementMicrotaskStep>); |
| 68 |
| 60 private: | 69 private: |
| 61 CustomElementMicrotaskQueue() { } | 70 CustomElementMicrotaskQueue() { } |
| 62 | 71 virtual void doDispatch(); |
| 63 Vector<OwnPtr<CustomElementMicrotaskStep> > m_queue; | |
| 64 }; | 72 }; |
| 65 | 73 |
| 66 } | 74 } |
| 67 | 75 |
| 68 #endif // CustomElementMicrotaskQueue_h | 76 #endif // CustomElementMicrotaskQueue_h |
| OLD | NEW |