| 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 20 matching lines...) Expand all Loading... |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/dom/custom/CustomElementScheduler.h" | 32 #include "core/dom/custom/CustomElementScheduler.h" |
| 33 | 33 |
| 34 #include "core/dom/Document.h" | 34 #include "core/dom/Document.h" |
| 35 #include "core/dom/Element.h" | 35 #include "core/dom/Element.h" |
| 36 #include "core/dom/custom/CustomElementCallbackDispatcher.h" | 36 #include "core/dom/custom/CustomElementCallbackDispatcher.h" |
| 37 #include "core/dom/custom/CustomElementCallbackInvocation.h" | 37 #include "core/dom/custom/CustomElementCallbackInvocation.h" |
| 38 #include "core/dom/custom/CustomElementLifecycleCallbacks.h" | 38 #include "core/dom/custom/CustomElementLifecycleCallbacks.h" |
| 39 #include "core/dom/custom/CustomElementMicrotaskDispatcher.h" | 39 #include "core/dom/custom/CustomElementMicrotaskDispatcher.h" |
| 40 #include "core/dom/custom/CustomElementMicrotaskImportStep.h" | 40 #include "core/dom/custom/CustomElementMicrotaskImportStep.h" |
| 41 #include "core/dom/custom/CustomElementMicrotaskQueue.h" |
| 41 #include "core/dom/custom/CustomElementMicrotaskResolutionStep.h" | 42 #include "core/dom/custom/CustomElementMicrotaskResolutionStep.h" |
| 42 #include "core/dom/custom/CustomElementRegistrationContext.h" | 43 #include "core/dom/custom/CustomElementRegistrationContext.h" |
| 43 #include "core/html/imports/HTMLImportChild.h" | 44 #include "core/html/imports/HTMLImportChild.h" |
| 44 #include "core/html/imports/HTMLImportLoader.h" | 45 #include "core/html/imports/HTMLImportLoader.h" |
| 45 | 46 |
| 46 namespace WebCore { | 47 namespace WebCore { |
| 47 | 48 |
| 48 class HTMLImport; | 49 class HTMLImport; |
| 49 | 50 |
| 50 void CustomElementScheduler::scheduleCallback(PassRefPtr<CustomElementLifecycleC
allbacks> callbacks, PassRefPtr<Element> element, CustomElementLifecycleCallback
s::CallbackType type) | 51 void CustomElementScheduler::scheduleCallback(PassRefPtr<CustomElementLifecycleC
allbacks> callbacks, PassRefPtr<Element> element, CustomElementLifecycleCallback
s::CallbackType type) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 69 | 70 |
| 70 void CustomElementScheduler::resolveOrScheduleResolution(PassRefPtr<CustomElemen
tRegistrationContext> context, PassRefPtr<Element> element, const CustomElementD
escriptor& descriptor) | 71 void CustomElementScheduler::resolveOrScheduleResolution(PassRefPtr<CustomElemen
tRegistrationContext> context, PassRefPtr<Element> element, const CustomElementD
escriptor& descriptor) |
| 71 { | 72 { |
| 72 if (CustomElementCallbackDispatcher::inCallbackDeliveryScope()) { | 73 if (CustomElementCallbackDispatcher::inCallbackDeliveryScope()) { |
| 73 context->resolve(element.get(), descriptor); | 74 context->resolve(element.get(), descriptor); |
| 74 return; | 75 return; |
| 75 } | 76 } |
| 76 | 77 |
| 77 HTMLImportLoader* loader = element->document().importLoader(); | 78 HTMLImportLoader* loader = element->document().importLoader(); |
| 78 OwnPtr<CustomElementMicrotaskResolutionStep> step = CustomElementMicrotaskRe
solutionStep::create(context, element, descriptor); | 79 OwnPtr<CustomElementMicrotaskResolutionStep> step = CustomElementMicrotaskRe
solutionStep::create(context, element, descriptor); |
| 79 CustomElementMicrotaskDispatcher::instance().enqueue(loader ? loader->firstI
mport() : 0, step.release()); | 80 CustomElementMicrotaskDispatcher::instance().enqueue(loader, step.release())
; |
| 80 } | 81 } |
| 81 | 82 |
| 82 CustomElementMicrotaskImportStep* CustomElementScheduler::scheduleImport(HTMLImp
ortChild* import) | 83 CustomElementMicrotaskImportStep* CustomElementScheduler::scheduleImport(HTMLImp
ortChild* import) |
| 83 { | 84 { |
| 84 ASSERT(!import->isDone()); | 85 ASSERT(!import->isDone()); |
| 85 ASSERT(import->parent()); | 86 ASSERT(import->parent()); |
| 86 | 87 |
| 87 OwnPtr<CustomElementMicrotaskImportStep> step = CustomElementMicrotaskImport
Step::create(); | 88 OwnPtr<CustomElementMicrotaskImportStep> step = CustomElementMicrotaskImport
Step::create(import->loader()->microtaskQueue()); |
| 88 CustomElementMicrotaskImportStep* rawStep = step.get(); | 89 CustomElementMicrotaskImportStep* rawStep = step.get(); |
| 89 | 90 |
| 90 // Ownership of the new step is transferred to the parent | 91 // Ownership of the new step is transferred to the parent |
| 91 // processing step, or the base queue. | 92 // processing step, or the base queue. |
| 92 CustomElementMicrotaskDispatcher::instance().enqueue(import->parent(), step.
release()); | 93 CustomElementMicrotaskDispatcher::instance().enqueue(import->parent()->loade
r(), step.release()); |
| 93 | 94 |
| 94 return rawStep; | 95 return rawStep; |
| 95 } | 96 } |
| 96 | 97 |
| 97 CustomElementScheduler& CustomElementScheduler::instance() | 98 CustomElementScheduler& CustomElementScheduler::instance() |
| 98 { | 99 { |
| 99 DEFINE_STATIC_LOCAL(CustomElementScheduler, instance, ()); | 100 DEFINE_STATIC_LOCAL(CustomElementScheduler, instance, ()); |
| 100 return instance; | 101 return instance; |
| 101 } | 102 } |
| 102 | 103 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // The processing stack is active. | 145 // The processing stack is active. |
| 145 CustomElementCallbackDispatcher::instance().enqueue(&callbackQueue); | 146 CustomElementCallbackDispatcher::instance().enqueue(&callbackQueue); |
| 146 return callbackQueue; | 147 return callbackQueue; |
| 147 } | 148 } |
| 148 | 149 |
| 149 CustomElementMicrotaskDispatcher::instance().enqueue(&callbackQueue); | 150 CustomElementMicrotaskDispatcher::instance().enqueue(&callbackQueue); |
| 150 return callbackQueue; | 151 return callbackQueue; |
| 151 } | 152 } |
| 152 | 153 |
| 153 } // namespace WebCore | 154 } // namespace WebCore |
| OLD | NEW |