| 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
|
|
|