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

Unified Diff: Source/core/dom/CustomElementCallbackDispatcher.cpp

Issue 14660019: Run Mutation Observer and Custom Element callbacks consistently at microtask checkpoint (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Patch for landing. Created 7 years, 6 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
« no previous file with comments | « Source/core/dom/CustomElementCallbackDispatcher.h ('k') | Source/core/dom/CustomElementRegistry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/CustomElementCallbackDispatcher.cpp
diff --git a/Source/core/platform/mediastream/RTCSessionDescriptionRequest.h b/Source/core/dom/CustomElementCallbackDispatcher.cpp
similarity index 58%
copy from Source/core/platform/mediastream/RTCSessionDescriptionRequest.h
copy to Source/core/dom/CustomElementCallbackDispatcher.cpp
index 506f8607df76271685b3cab4d120351032e23c9d..667c6c2c5efbfe95048d1696fdcebb4611476c1a 100644
--- a/Source/core/platform/mediastream/RTCSessionDescriptionRequest.h
+++ b/Source/core/dom/CustomElementCallbackDispatcher.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -28,42 +28,47 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef RTCSessionDescriptionRequest_h
-#define RTCSessionDescriptionRequest_h
+#include "config.h"
+#include "CustomElementCallbackDispatcher.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-#include <wtf/text/WTFString.h>
+#include "CustomElementCallback.h"
-namespace WebKit {
-class WebRTCSessionDescription;
+namespace WebCore {
+
+CustomElementCallbackDispatcher& CustomElementCallbackDispatcher::instance()
+{
+ DEFINE_STATIC_LOCAL(CustomElementCallbackDispatcher, instance, ());
+ return instance;
}
-namespace WebCore {
+CustomElementCallbackDispatcher::ReadyInvocation::ReadyInvocation(PassRefPtr<CustomElementCallback> callback, PassRefPtr<Element> element)
+ : m_callback(callback)
+ , m_element(element)
+{
+}
-class RTCSessionDescriptionRequest : public RefCounted<RTCSessionDescriptionRequest> {
-public:
- class ExtraData : public RefCounted<ExtraData> {
- public:
- virtual ~ExtraData() { }
- };
+bool CustomElementCallbackDispatcher::dispatch()
+{
+ if (m_invocations.isEmpty())
+ return false;
- virtual ~RTCSessionDescriptionRequest() { }
+ do {
+ Vector<ReadyInvocation> invocations;
+ m_invocations.swap(invocations);
- virtual void requestSucceeded(const WebKit::WebRTCSessionDescription&) = 0;
- virtual void requestFailed(const String& error) = 0;
+ for (Vector<ReadyInvocation>::iterator it = invocations.begin(); it != invocations.end(); ++it)
+ it->invoke();
+ } while (!m_invocations.isEmpty());
- PassRefPtr<ExtraData> extraData() const { return m_extraData; }
- void setExtraData(PassRefPtr<ExtraData> extraData) { m_extraData = extraData; }
+ return true;
+}
-protected:
- RTCSessionDescriptionRequest() { }
+void CustomElementCallbackDispatcher::enqueueReadyCallback(CustomElementCallback* callback, Element* element)
+{
+ if (!callback->hasReady())
+ return;
-private:
- RefPtr<ExtraData> m_extraData;
-};
+ m_invocations.append(ReadyInvocation(callback, element));
+}
} // namespace WebCore
-
-#endif // RTCSessionDescriptionRequest_h
« no previous file with comments | « Source/core/dom/CustomElementCallbackDispatcher.h ('k') | Source/core/dom/CustomElementRegistry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698