| 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 14 matching lines...) Expand all Loading... |
| 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 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/dom/custom/CustomElementMicrotaskImportStep.h" | 32 #include "core/dom/custom/CustomElementMicrotaskImportStep.h" |
| 33 | 33 |
| 34 #include "core/dom/custom/CustomElementMicrotaskDispatcher.h" | 34 #include "core/dom/custom/CustomElementMicrotaskDispatcher.h" |
| 35 #include "core/dom/custom/CustomElementMicrotaskQueue.h" |
| 35 | 36 |
| 36 namespace WebCore { | 37 namespace WebCore { |
| 37 | 38 |
| 38 PassOwnPtr<CustomElementMicrotaskImportStep> CustomElementMicrotaskImportStep::c
reate() | 39 PassOwnPtr<CustomElementMicrotaskImportStep> CustomElementMicrotaskImportStep::c
reate(PassRefPtr<CustomElementMicrotaskQueue> queue) |
| 39 { | 40 { |
| 40 return adoptPtr(new CustomElementMicrotaskImportStep()); | 41 return adoptPtr(new CustomElementMicrotaskImportStep(queue)); |
| 41 } | 42 } |
| 42 | 43 |
| 43 void CustomElementMicrotaskImportStep::enqueue(PassOwnPtr<CustomElementMicrotask
Step> step) | 44 CustomElementMicrotaskImportStep::CustomElementMicrotaskImportStep(PassRefPtr<Cu
stomElementMicrotaskQueue> queue) |
| 45 : m_importFinished(false) |
| 46 , m_queue(queue) |
| 44 { | 47 { |
| 45 // work should not be being created after the import is done | 48 } |
| 46 // because the parser is done | 49 |
| 47 ASSERT(!m_importFinished); | 50 CustomElementMicrotaskImportStep::~CustomElementMicrotaskImportStep() |
| 48 m_queue.enqueue(step); | 51 { |
| 49 } | 52 } |
| 50 | 53 |
| 51 void CustomElementMicrotaskImportStep::importDidFinish() | 54 void CustomElementMicrotaskImportStep::importDidFinish() |
| 52 { | 55 { |
| 53 // imports should only "finish" once | 56 // imports should only "finish" once |
| 54 ASSERT(!m_importFinished); | 57 ASSERT(!m_importFinished); |
| 55 m_importFinished = true; | 58 m_importFinished = true; |
| 56 CustomElementMicrotaskDispatcher::instance().importDidFinish(this); | 59 CustomElementMicrotaskDispatcher::instance().importDidFinish(this); |
| 57 } | 60 } |
| 58 | 61 |
| 59 CustomElementMicrotaskStep::Result CustomElementMicrotaskImportStep::process() | 62 CustomElementMicrotaskStep::Result CustomElementMicrotaskImportStep::process() |
| 60 { | 63 { |
| 61 Result result = m_queue.dispatch(); | 64 Result result = m_queue->dispatch(); |
| 62 if (!m_importFinished) | 65 if (!m_importFinished) |
| 63 result = Result(result | ShouldStop); | 66 result = Result(result | ShouldStop); |
| 64 return result; | 67 return result; |
| 65 } | 68 } |
| 66 | 69 |
| 67 } // namespace WebCore | 70 } // namespace WebCore |
| OLD | NEW |