Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / dom / MessagePort.h
index 0e6e052..1e7f49e 100644 (file)
@@ -27,7 +27,6 @@
 #ifndef MessagePort_h
 #define MessagePort_h
 
-#include "bindings/v8/ScriptWrappable.h"
 #include "core/dom/ActiveDOMObject.h"
 #include "core/events/EventListener.h"
 #include "core/events/EventTarget.h"
 #include "wtf/Vector.h"
 #include "wtf/WeakPtr.h"
 
-namespace WebCore {
+namespace blink {
 
-class Event;
 class ExceptionState;
-class Frame;
 class MessagePort;
 class ExecutionContext;
 class SerializedScriptValue;
 
 // The overwhelmingly common case is sending a single port, so handle that efficiently with an inline buffer of size 1.
-typedef Vector<RefPtr<MessagePort>, 1> MessagePortArray;
+typedef WillBeHeapVector<RefPtrWillBeMember<MessagePort>, 1> MessagePortArray;
 
-// Not to be confused with blink::WebMessagePortChannelArray; this one uses Vector and OwnPtr instead of WebVector and raw pointers.
-typedef Vector<OwnPtr<blink::WebMessagePortChannel>, 1> MessagePortChannelArray;
+// Not to be confused with WebMessagePortChannelArray; this one uses Vector and OwnPtr instead of WebVector and raw pointers.
+typedef Vector<OwnPtr<WebMessagePortChannel>, 1> MessagePortChannelArray;
 
-class MessagePort FINAL : public RefCounted<MessagePort>
+class MessagePort final : public RefCountedWillBeGarbageCollectedFinalized<MessagePort>
     , public ActiveDOMObject
     , public EventTargetWithInlineData
-    , public ScriptWrappable
-    , public blink::WebMessagePortChannelClient {
+    , public WebMessagePortChannelClient {
+    DEFINE_WRAPPERTYPEINFO();
     REFCOUNTED_EVENT_TARGET(MessagePort);
+    WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MessagePort);
 public:
-    static PassRefPtr<MessagePort> create(ExecutionContext&);
+    static PassRefPtrWillBeRawPtr<MessagePort> create(ExecutionContext&);
     virtual ~MessagePort();
 
-    void postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, ExceptionState&);
+    void postMessage(ExecutionContext*, PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, ExceptionState&);
 
     void start();
     void close();
 
-    void entangle(PassOwnPtr<blink::WebMessagePortChannel>);
-    PassOwnPtr<blink::WebMessagePortChannel> disentangle();
+    void entangle(PassOwnPtr<WebMessagePortChannel>);
+    PassOwnPtr<WebMessagePortChannel> disentangle();
+
+    static PassOwnPtr<WebMessagePortChannelArray> toWebMessagePortChannelArray(PassOwnPtr<MessagePortChannelArray>);
+    static PassOwnPtrWillBeRawPtr<MessagePortArray> toMessagePortArray(ExecutionContext*, const WebMessagePortChannelArray&);
 
     // Returns 0 if there is an exception, or if the passed-in array is 0/empty.
     static PassOwnPtr<MessagePortChannelArray> disentanglePorts(const MessagePortArray*, ExceptionState&);
 
     // Returns 0 if the passed array is 0/empty.
-    static PassOwnPtr<MessagePortArray> entanglePorts(ExecutionContext&, PassOwnPtr<MessagePortChannelArray>);
+    static PassOwnPtrWillBeRawPtr<MessagePortArray> entanglePorts(ExecutionContext&, PassOwnPtr<MessagePortChannelArray>);
 
     bool started() const { return m_started; }
 
-    virtual const AtomicString& interfaceName() const OVERRIDE;
-    virtual ExecutionContext* executionContext() const OVERRIDE { return ActiveDOMObject::executionContext(); }
-    virtual MessagePort* toMessagePort() OVERRIDE { return this; }
+    virtual const AtomicString& interfaceName() const override;
+    virtual ExecutionContext* executionContext() const override { return ActiveDOMObject::executionContext(); }
+    virtual MessagePort* toMessagePort() override { return this; }
 
     // ActiveDOMObject implementation.
-    virtual bool hasPendingActivity() const OVERRIDE;
-    virtual void stop() OVERRIDE { close(); }
+    virtual bool hasPendingActivity() const override;
+    virtual void stop() override { close(); }
 
-    void setOnmessage(PassRefPtr<EventListener> listener, DOMWrapperWorld* world)
+    void setOnmessage(PassRefPtr<EventListener> listener)
     {
-        setAttributeEventListener(EventTypeNames::message, listener, world);
+        setAttributeEventListener(EventTypeNames::message, listener);
         start();
     }
-    EventListener* onmessage(DOMWrapperWorld* world) { return getAttributeEventListener(EventTypeNames::message, world); }
+    EventListener* onmessage() { return getAttributeEventListener(EventTypeNames::message); }
 
     // A port starts out its life entangled, and remains entangled until it is closed or is cloned.
     bool isEntangled() const { return !m_closed && !isNeutered(); }
@@ -107,10 +108,10 @@ private:
     explicit MessagePort(ExecutionContext&);
 
     // WebMessagePortChannelClient implementation.
-    virtual void messageAvailable() OVERRIDE;
+    virtual void messageAvailable() override;
     void dispatchMessages();
 
-    OwnPtr<blink::WebMessagePortChannel> m_entangledChannel;
+    OwnPtr<WebMessagePortChannel> m_entangledChannel;
 
     bool m_started;
     bool m_closed;
@@ -118,6 +119,6 @@ private:
     WeakPtrFactory<MessagePort> m_weakFactory;
 };
 
-} // namespace WebCore
+} // namespace blink
 
 #endif // MessagePort_h