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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 CustomElementMicrotaskImportStep::~CustomElementMicrotaskImportStep() | 54 CustomElementMicrotaskImportStep::~CustomElementMicrotaskImportStep() |
55 { | 55 { |
56 } | 56 } |
57 | 57 |
58 bool CustomElementMicrotaskImportStep::shouldWaitForImport() const | 58 bool CustomElementMicrotaskImportStep::shouldWaitForImport() const |
59 { | 59 { |
60 return m_import && !m_import->isLoaded(); | 60 return m_import && !m_import->isLoaded(); |
61 } | 61 } |
62 | 62 |
| 63 bool CustomElementMicrotaskImportStep::shouldStopProcessing() const |
| 64 { |
| 65 return m_import && m_import->isSync(); |
| 66 } |
| 67 |
63 void CustomElementMicrotaskImportStep::didUpgradeAllCustomElements() | 68 void CustomElementMicrotaskImportStep::didUpgradeAllCustomElements() |
64 { | 69 { |
65 ASSERT(m_queue); | 70 ASSERT(m_queue); |
66 if (m_import) | 71 if (m_import) |
67 m_import->didFinishUpgradingCustomElements(); | 72 m_import->didFinishUpgradingCustomElements(); |
68 m_queue.clear(); | |
69 } | 73 } |
70 | 74 |
71 CustomElementMicrotaskStep::Result CustomElementMicrotaskImportStep::process() | 75 CustomElementMicrotaskStep::Result CustomElementMicrotaskImportStep::process() |
72 { | 76 { |
73 if (!m_queue) | |
74 return CustomElementMicrotaskStep::Continue; | |
75 Result result = m_queue->dispatch(); | 77 Result result = m_queue->dispatch(); |
76 if (m_queue->isEmpty() && !shouldWaitForImport()) | 78 if (!(result & ShouldStop) && !shouldWaitForImport()) |
77 didUpgradeAllCustomElements(); | 79 didUpgradeAllCustomElements(); |
78 return Result(result | (shouldWaitForImport() ? ShouldStop : Continue)); | 80 |
| 81 if (shouldWaitForImport()) |
| 82 result = Result(result | ShouldRemain | ShouldStop); |
| 83 if (!shouldStopProcessing()) |
| 84 result = Result(result & ~ShouldStop); |
| 85 return result; |
79 } | 86 } |
80 | 87 |
81 #if !defined(NDEBUG) | 88 #if !defined(NDEBUG) |
82 void CustomElementMicrotaskImportStep::show(unsigned indent) | 89 void CustomElementMicrotaskImportStep::show(unsigned indent) |
83 { | 90 { |
84 fprintf(stderr, "indent: %d\n", indent); | 91 fprintf(stderr, "%*sImport(wait=%d sync=%d, url=%s)\n", indent, "", shouldWa
itForImport(), shouldStopProcessing(), m_import ? m_import->url().string().utf8(
).data() : "null"); |
85 fprintf(stderr, "%*sImport\n", indent, ""); | |
86 m_queue->show(indent + 1); | 92 m_queue->show(indent + 1); |
87 } | 93 } |
88 #endif | 94 #endif |
89 | 95 |
90 } // namespace WebCore | 96 } // namespace WebCore |
OLD | NEW |