Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(597)

Unified Diff: Source/core/dom/custom/CustomElementScheduler.cpp

Issue 296703009: Oilpan: move custom element objects to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use LinkedHashSet for ElementSet instead. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/custom/CustomElementScheduler.cpp
diff --git a/Source/core/dom/custom/CustomElementScheduler.cpp b/Source/core/dom/custom/CustomElementScheduler.cpp
index 1980496aa6322749dc9bc9e54466e5413e502078..852455e28a37bbe0de5d7300c6bef31812a820c6 100644
--- a/Source/core/dom/custom/CustomElementScheduler.cpp
+++ b/Source/core/dom/custom/CustomElementScheduler.cpp
@@ -47,7 +47,7 @@ namespace WebCore {
class HTMLImport;
-void CustomElementScheduler::scheduleCallback(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, PassRefPtr<Element> element, CustomElementLifecycleCallbacks::CallbackType type)
+void CustomElementScheduler::scheduleCallback(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, PassRefPtrWillBeRawPtr<Element> element, CustomElementLifecycleCallbacks::CallbackType type)
{
ASSERT(type != CustomElementLifecycleCallbacks::AttributeChanged);
@@ -58,7 +58,7 @@ void CustomElementScheduler::scheduleCallback(PassRefPtr<CustomElementLifecycleC
queue.append(CustomElementCallbackInvocation::createInvocation(callbacks, type));
}
-void CustomElementScheduler::scheduleAttributeChangedCallback(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, PassRefPtr<Element> element, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue)
+void CustomElementScheduler::scheduleAttributeChangedCallback(PassRefPtr<CustomElementLifecycleCallbacks> callbacks, PassRefPtrWillBeRawPtr<Element> element, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue)
{
if (!callbacks->hasCallback(CustomElementLifecycleCallbacks::AttributeChanged))
return;
@@ -67,7 +67,7 @@ void CustomElementScheduler::scheduleAttributeChangedCallback(PassRefPtr<CustomE
queue.append(CustomElementCallbackInvocation::createAttributeChangedInvocation(callbacks, name, oldValue, newValue));
}
-void CustomElementScheduler::resolveOrScheduleResolution(PassRefPtr<CustomElementRegistrationContext> context, PassRefPtr<Element> element, const CustomElementDescriptor& descriptor)
+void CustomElementScheduler::resolveOrScheduleResolution(PassRefPtrWillBeRawPtr<CustomElementRegistrationContext> context, PassRefPtrWillBeRawPtr<Element> element, const CustomElementDescriptor& descriptor)
{
if (CustomElementCallbackDispatcher::inCallbackDeliveryScope()) {
context->resolve(element.get(), descriptor);
@@ -75,7 +75,7 @@ void CustomElementScheduler::resolveOrScheduleResolution(PassRefPtr<CustomElemen
}
HTMLImportLoader* loader = element->document().importLoader();
- OwnPtr<CustomElementMicrotaskResolutionStep> step = CustomElementMicrotaskResolutionStep::create(context, element, descriptor);
+ OwnPtrWillBeRawPtr<CustomElementMicrotaskResolutionStep> step = CustomElementMicrotaskResolutionStep::create(context, element, descriptor);
CustomElementMicrotaskDispatcher::instance().enqueue(loader, step.release());
}
@@ -84,7 +84,7 @@ CustomElementMicrotaskImportStep* CustomElementScheduler::scheduleImport(HTMLImp
ASSERT(!import->isDone());
ASSERT(import->parent());
- OwnPtr<CustomElementMicrotaskImportStep> step = CustomElementMicrotaskImportStep::create(import);
+ OwnPtrWillBeRawPtr<CustomElementMicrotaskImportStep> step = CustomElementMicrotaskImportStep::create(import);
CustomElementMicrotaskImportStep* rawStep = step.get();
// Ownership of the new step is transferred to the parent
@@ -96,11 +96,16 @@ CustomElementMicrotaskImportStep* CustomElementScheduler::scheduleImport(HTMLImp
CustomElementScheduler& CustomElementScheduler::instance()
{
+#if ENABLE(OILPAN)
+ DEFINE_STATIC_LOCAL(Persistent<CustomElementScheduler>, instance, (new CustomElementScheduler()));
+ return *instance;
+#else
DEFINE_STATIC_LOCAL(CustomElementScheduler, instance, ());
return instance;
+#endif
}
-CustomElementCallbackQueue& CustomElementScheduler::ensureCallbackQueue(PassRefPtr<Element> element)
+CustomElementCallbackQueue& CustomElementScheduler::ensureCallbackQueue(PassRefPtrWillBeRawPtr<Element> element)
{
ElementCallbackQueueMap::ValueType* it = m_elementCallbackQueueMap.add(element.get(), nullptr).storedValue;
if (!it->value)
@@ -127,9 +132,9 @@ void CustomElementScheduler::clearElementCallbackQueueMap()
}
// Finds or creates the callback queue for element.
-CustomElementCallbackQueue& CustomElementScheduler::schedule(PassRefPtr<Element> passElement)
+CustomElementCallbackQueue& CustomElementScheduler::schedule(PassRefPtrWillBeRawPtr<Element> passElement)
{
- RefPtr<Element> element(passElement);
+ RefPtrWillBeRawPtr<Element> element(passElement);
CustomElementCallbackQueue& callbackQueue = ensureCallbackQueue(element);
if (callbackQueue.inCreatedCallback()) {
@@ -150,4 +155,9 @@ CustomElementCallbackQueue& CustomElementScheduler::schedule(PassRefPtr<Element>
return callbackQueue;
}
+void CustomElementScheduler::trace(Visitor* visitor)
+{
+ visitor->trace(m_elementCallbackQueueMap);
+}
+
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698