| 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 10 matching lines...) Expand all Loading... |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 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 #include "core/dom/custom/CustomElementMicrotaskImportStep.h" | 31 #include "core/dom/custom/V0CustomElementMicrotaskImportStep.h" |
| 32 | 32 |
| 33 #include "core/dom/custom/CustomElementMicrotaskDispatcher.h" | 33 #include "core/dom/custom/V0CustomElementMicrotaskDispatcher.h" |
| 34 #include "core/dom/custom/CustomElementSyncMicrotaskQueue.h" | 34 #include "core/dom/custom/V0CustomElementSyncMicrotaskQueue.h" |
| 35 #include "core/html/imports/HTMLImportChild.h" | 35 #include "core/html/imports/HTMLImportChild.h" |
| 36 #include "core/html/imports/HTMLImportLoader.h" | 36 #include "core/html/imports/HTMLImportLoader.h" |
| 37 #include <stdio.h> | 37 #include <stdio.h> |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 CustomElementMicrotaskImportStep::CustomElementMicrotaskImportStep(HTMLImportChi
ld* import) | 41 V0CustomElementMicrotaskImportStep::V0CustomElementMicrotaskImportStep(HTMLImpor
tChild* import) |
| 42 : m_import(import) | 42 : m_import(import) |
| 43 , m_queue(import->loader()->microtaskQueue()) | 43 , m_queue(import->loader()->microtaskQueue()) |
| 44 { | 44 { |
| 45 } | 45 } |
| 46 | 46 |
| 47 CustomElementMicrotaskImportStep::~CustomElementMicrotaskImportStep() | 47 V0CustomElementMicrotaskImportStep::~V0CustomElementMicrotaskImportStep() |
| 48 { | 48 { |
| 49 } | 49 } |
| 50 | 50 |
| 51 void CustomElementMicrotaskImportStep::invalidate() | 51 void V0CustomElementMicrotaskImportStep::invalidate() |
| 52 { | 52 { |
| 53 m_queue = CustomElementSyncMicrotaskQueue::create(); | 53 m_queue = V0CustomElementSyncMicrotaskQueue::create(); |
| 54 m_import.clear(); | 54 m_import.clear(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool CustomElementMicrotaskImportStep::shouldWaitForImport() const | 57 bool V0CustomElementMicrotaskImportStep::shouldWaitForImport() const |
| 58 { | 58 { |
| 59 return m_import && !m_import->loader()->isDone(); | 59 return m_import && !m_import->loader()->isDone(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void CustomElementMicrotaskImportStep::didUpgradeAllCustomElements() | 62 void V0CustomElementMicrotaskImportStep::didUpgradeAllCustomElements() |
| 63 { | 63 { |
| 64 DCHECK(m_queue); | 64 DCHECK(m_queue); |
| 65 if (m_import) | 65 if (m_import) |
| 66 m_import->didFinishUpgradingCustomElements(); | 66 m_import->didFinishUpgradingCustomElements(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 CustomElementMicrotaskStep::Result CustomElementMicrotaskImportStep::process() | 69 V0CustomElementMicrotaskStep::Result V0CustomElementMicrotaskImportStep::process
() |
| 70 { | 70 { |
| 71 m_queue->dispatch(); | 71 m_queue->dispatch(); |
| 72 if (!m_queue->isEmpty() || shouldWaitForImport()) | 72 if (!m_queue->isEmpty() || shouldWaitForImport()) |
| 73 return Processing; | 73 return Processing; |
| 74 | 74 |
| 75 didUpgradeAllCustomElements(); | 75 didUpgradeAllCustomElements(); |
| 76 return FinishedProcessing; | 76 return FinishedProcessing; |
| 77 } | 77 } |
| 78 | 78 |
| 79 DEFINE_TRACE(CustomElementMicrotaskImportStep) | 79 DEFINE_TRACE(V0CustomElementMicrotaskImportStep) |
| 80 { | 80 { |
| 81 visitor->trace(m_import); | 81 visitor->trace(m_import); |
| 82 visitor->trace(m_queue); | 82 visitor->trace(m_queue); |
| 83 CustomElementMicrotaskStep::trace(visitor); | 83 V0CustomElementMicrotaskStep::trace(visitor); |
| 84 } | 84 } |
| 85 | 85 |
| 86 #if !defined(NDEBUG) | 86 #if !defined(NDEBUG) |
| 87 void CustomElementMicrotaskImportStep::show(unsigned indent) | 87 void V0CustomElementMicrotaskImportStep::show(unsigned indent) |
| 88 { | 88 { |
| 89 fprintf(stderr, "%*sImport(wait=%d sync=%d, url=%s)\n", indent, "", shouldWa
itForImport(), m_import && m_import->isSync(), m_import ? m_import->url().getStr
ing().utf8().data() : "null"); | 89 fprintf(stderr, "%*sImport(wait=%d sync=%d, url=%s)\n", indent, "", shouldWa
itForImport(), m_import && m_import->isSync(), m_import ? m_import->url().getStr
ing().utf8().data() : "null"); |
| 90 m_queue->show(indent + 1); | 90 m_queue->show(indent + 1); |
| 91 } | 91 } |
| 92 #endif | 92 #endif |
| 93 | 93 |
| 94 } // namespace blink | 94 } // namespace blink |
| OLD | NEW |