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

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

Issue 1150183007: Re-land: bindings: Use MessageEventInit for MessageEvent constructor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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
« no previous file with comments | « Source/core/dom/MessagePort.cpp ('k') | Source/core/events/MessageEvent.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/events/MessageEvent.h
diff --git a/Source/core/events/MessageEvent.h b/Source/core/events/MessageEvent.h
index 1ff3d8270c1ba80e31e4493a68d59cd882c47e29..c70b50bd3de402cc477313967b301d6ec03ac999 100644
--- a/Source/core/events/MessageEvent.h
+++ b/Source/core/events/MessageEvent.h
@@ -34,20 +34,12 @@
#include "core/dom/MessagePort.h"
#include "core/events/Event.h"
#include "core/events/EventTarget.h"
+#include "core/events/MessageEventInit.h"
#include "core/fileapi/Blob.h"
#include "core/frame/DOMWindow.h"
namespace blink {
-struct MessageEventInit : public EventInit {
- MessageEventInit();
-
- String origin;
- String lastEventId;
- RefPtrWillBeMember<EventTarget> source;
- MessagePortArray ports;
-};
-
class CORE_EXPORT MessageEvent final : public Event {
DEFINE_WRAPPERTYPEINFO();
public:
@@ -82,13 +74,14 @@ public:
static PassRefPtrWillBeRawPtr<MessageEvent> create(const AtomicString& type, const MessageEventInit& initializer, ExceptionState&);
virtual ~MessageEvent();
- void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtrWillBeRawPtr<MessagePortArray>);
+ void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, ScriptValue data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtrWillBeRawPtr<MessagePortArray>);
void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtrWillBeRawPtr<MessagePortArray>);
const String& origin() const { return m_origin; }
const String& lastEventId() const { return m_lastEventId; }
EventTarget* source() const { return m_source.get(); }
- MessagePortArray ports() const { return m_ports ? *m_ports : MessagePortArray(); }
+ MessagePortArray ports(bool& isNull) const;
+ MessagePortArray ports() const;
MessagePortChannelArray* channels() const { return m_channels ? m_channels.get() : 0; }
virtual const AtomicString& interfaceName() const override;
@@ -101,7 +94,8 @@ public:
DataTypeArrayBuffer
};
DataType dataType() const { return m_dataType; }
- SerializedScriptValue* dataAsSerializedScriptValue() const { ASSERT(m_dataType == DataTypeScriptValue || m_dataType == DataTypeSerializedScriptValue); return m_dataAsSerializedScriptValue.get(); }
+ ScriptValue dataAsScriptValue() const { ASSERT(m_dataType == DataTypeScriptValue); return m_dataAsScriptValue; }
+ SerializedScriptValue* dataAsSerializedScriptValue() const { ASSERT(m_dataType == DataTypeSerializedScriptValue); return m_dataAsSerializedScriptValue.get(); }
String dataAsString() const { ASSERT(m_dataType == DataTypeString); return m_dataAsString; }
Blob* dataAsBlob() const { ASSERT(m_dataType == DataTypeBlob); return m_dataAsBlob.get(); }
DOMArrayBuffer* dataAsArrayBuffer() const { ASSERT(m_dataType == DataTypeArrayBuffer); return m_dataAsArrayBuffer.get(); }
@@ -130,6 +124,7 @@ private:
MessageEvent(PassRefPtr<DOMArrayBuffer> data, const String& origin);
DataType m_dataType;
+ ScriptValue m_dataAsScriptValue;
RefPtr<SerializedScriptValue> m_dataAsSerializedScriptValue;
String m_dataAsString;
PersistentWillBeMember<Blob> m_dataAsBlob;
« no previous file with comments | « Source/core/dom/MessagePort.cpp ('k') | Source/core/events/MessageEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698