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

Unified Diff: Source/core/dom/MessageEvent.h

Issue 23319002: Set MessageEvent.source to the newly created port for shared workers' connect events (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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/MessageEvent.h
diff --git a/Source/core/dom/MessageEvent.h b/Source/core/dom/MessageEvent.h
index 7f54232288715596bde0a5bc36702584c84b1b9b..948f98bd01bd7604cbe5b47f96f073b8e7d9670e 100644
--- a/Source/core/dom/MessageEvent.h
+++ b/Source/core/dom/MessageEvent.h
@@ -30,6 +30,7 @@
#include "bindings/v8/SerializedScriptValue.h"
#include "core/dom/Event.h"
+#include "core/dom/EventTarget.h"
#include "core/dom/MessagePort.h"
#include "core/fileapi/Blob.h"
#include "core/page/DOMWindow.h"
@@ -37,8 +38,6 @@
namespace WebCore {
-class DOMWindow;
-
struct MessageEventInit : public EventInit {
MessageEventInit();
@@ -54,6 +53,10 @@ public:
{
return adoptRef(new MessageEvent);
}
+ static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, PassRefPtr<MessagePort> source = 0)
do-not-use 2013/08/19 19:45:57 This factory takes a MessagePort, the others take
+ {
+ return adoptRef(new MessageEvent("", "", source, ports));
+ }
static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, const String& origin = "", const String& lastEventId = "", PassRefPtr<DOMWindow> source = 0)
{
return adoptRef(new MessageEvent(origin, lastEventId, source, ports));
@@ -85,7 +88,7 @@ public:
const String& origin() const { return m_origin; }
const String& lastEventId() const { return m_lastEventId; }
- DOMWindow* source() const { return m_source.get(); }
+ EventTarget* source() const { return m_source.get(); }
MessagePortArray ports() const { return m_ports ? *m_ports : MessagePortArray(); }
virtual const AtomicString& interfaceName() const;
@@ -112,8 +115,8 @@ public:
private:
MessageEvent();
MessageEvent(const AtomicString&, const MessageEventInit&);
- MessageEvent(const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray>);
- MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray>);
+ MessageEvent(const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, PassOwnPtr<MessagePortArray>);
+ MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<EventTarget> source, PassOwnPtr<MessagePortArray>);
explicit MessageEvent(const String& data, const String& origin);
explicit MessageEvent(PassRefPtr<Blob> data, const String& origin);
@@ -126,7 +129,7 @@ private:
RefPtr<ArrayBuffer> m_dataAsArrayBuffer;
String m_origin;
String m_lastEventId;
- RefPtr<DOMWindow> m_source;
+ RefPtr<EventTarget> m_source; // A Window or a MessagePort.
abarth-chromium 2013/08/19 19:24:58 Can we ASSERT this fact somewhere rather than havi
do-not-use 2013/08/19 19:45:57 Yes, I can add an assertion but this would mean ad
OwnPtr<MessagePortArray> m_ports;
};

Powered by Google App Engine
This is Rietveld 408576698