Chromium Code Reviews| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 { | 59 { |
| 60 m_queue = CustomElementMicrotaskQueue::create(); | 60 m_queue = CustomElementMicrotaskQueue::create(); |
| 61 m_import.clear(); | 61 m_import.clear(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 bool CustomElementMicrotaskImportStep::shouldWaitForImport() const | 64 bool CustomElementMicrotaskImportStep::shouldWaitForImport() const |
| 65 { | 65 { |
| 66 return m_import && !m_import->isLoaded(); | 66 return m_import && !m_import->isLoaded(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool CustomElementMicrotaskImportStep::shouldStopProcessing() const | 69 bool CustomElementMicrotaskImportStep::isSync() const |
|
dominicc (has gone to gerrit)
2014/05/27 23:41:25
It looks like this is only used during that initia
Hajime Morrita
2014/05/28 00:41:37
Probably that's better. Will do.
| |
| 70 { | 70 { |
| 71 return m_import && m_import->isSync(); | 71 return m_import && m_import->isSync(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void CustomElementMicrotaskImportStep::didUpgradeAllCustomElements() | 74 void CustomElementMicrotaskImportStep::didUpgradeAllCustomElements() |
| 75 { | 75 { |
| 76 ASSERT(m_queue); | 76 ASSERT(m_queue); |
| 77 if (m_import) | 77 if (m_import) |
| 78 m_import->didFinishUpgradingCustomElements(); | 78 m_import->didFinishUpgradingCustomElements(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 CustomElementMicrotaskStep::Result CustomElementMicrotaskImportStep::process() | 81 CustomElementMicrotaskStep::Result CustomElementMicrotaskImportStep::process() |
| 82 { | 82 { |
| 83 Result result = m_queue->dispatch(); | 83 m_queue->dispatch(); |
| 84 if (!(result & ShouldStop) && !shouldWaitForImport()) | 84 if (!m_queue->isEmpty() || shouldWaitForImport()) |
| 85 didUpgradeAllCustomElements(); | 85 return Processing; |
| 86 | 86 |
| 87 if (shouldWaitForImport()) | 87 didUpgradeAllCustomElements(); |
| 88 result = Result(result | ShouldRemain | ShouldStop); | 88 return FinishedProcessing; |
| 89 if (!shouldStopProcessing()) | |
| 90 result = Result(result & ~ShouldStop); | |
| 91 return result; | |
| 92 } | |
| 93 | |
| 94 bool CustomElementMicrotaskImportStep::needsProcessOrStop() const | |
| 95 { | |
| 96 return shouldStopProcessing() || m_queue->needsProcessOrStop(); | |
| 97 } | 89 } |
| 98 | 90 |
| 99 #if !defined(NDEBUG) | 91 #if !defined(NDEBUG) |
| 100 void CustomElementMicrotaskImportStep::show(unsigned indent) | 92 void CustomElementMicrotaskImportStep::show(unsigned indent) |
| 101 { | 93 { |
| 102 fprintf(stderr, "%*sImport(wait=%d sync=%d, url=%s)\n", indent, "", shouldWa itForImport(), shouldStopProcessing(), m_import ? m_import->url().string().utf8( ).data() : "null"); | 94 fprintf(stderr, "%*sImport(wait=%d sync=%d, url=%s)\n", indent, "", shouldWa itForImport(), m_import && m_import->isSync(), m_import ? m_import->url().string ().utf8().data() : "null"); |
| 103 m_queue->show(indent + 1); | 95 m_queue->show(indent + 1); |
| 104 } | 96 } |
| 105 #endif | 97 #endif |
| 106 | 98 |
| 107 } // namespace WebCore | 99 } // namespace WebCore |
| OLD | NEW |