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

Side by Side Diff: third_party/WebKit/Source/core/events/MessageEvent.h

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Address feedback from yusuf Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Henry Mason (hmason@mac.com) 2 * Copyright (C) 2007 Henry Mason (hmason@mac.com)
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights
4 * reserved. 4 * reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 static MessageEvent* create(MessagePortArray* ports, 57 static MessageEvent* create(MessagePortArray* ports,
58 PassRefPtr<SerializedScriptValue> data, 58 PassRefPtr<SerializedScriptValue> data,
59 const String& origin = String(), 59 const String& origin = String(),
60 const String& lastEventId = String(), 60 const String& lastEventId = String(),
61 EventTarget* source = nullptr, 61 EventTarget* source = nullptr,
62 const String& suborigin = String()) { 62 const String& suborigin = String()) {
63 return new MessageEvent(std::move(data), origin, lastEventId, source, ports, 63 return new MessageEvent(std::move(data), origin, lastEventId, source, ports,
64 suborigin); 64 suborigin);
65 } 65 }
66 static MessageEvent* create(std::unique_ptr<MessagePortChannelArray> channels, 66 static MessageEvent* create(MessagePortChannelArray channels,
67 PassRefPtr<SerializedScriptValue> data, 67 PassRefPtr<SerializedScriptValue> data,
68 const String& origin = String(), 68 const String& origin = String(),
69 const String& lastEventId = String(), 69 const String& lastEventId = String(),
70 EventTarget* source = nullptr, 70 EventTarget* source = nullptr,
71 const String& suborigin = String()) { 71 const String& suborigin = String()) {
72 return new MessageEvent(std::move(data), origin, lastEventId, source, 72 return new MessageEvent(std::move(data), origin, lastEventId, source,
73 std::move(channels), suborigin); 73 std::move(channels), suborigin);
74 } 74 }
75 static MessageEvent* create(const String& data, 75 static MessageEvent* create(const String& data,
76 const String& origin = String(), 76 const String& origin = String(),
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 const String& lastEventId, 108 const String& lastEventId,
109 EventTarget* source, 109 EventTarget* source,
110 MessagePortArray*); 110 MessagePortArray*);
111 111
112 const String& origin() const { return m_origin; } 112 const String& origin() const { return m_origin; }
113 const String& suborigin() const { return m_suborigin; } 113 const String& suborigin() const { return m_suborigin; }
114 const String& lastEventId() const { return m_lastEventId; } 114 const String& lastEventId() const { return m_lastEventId; }
115 EventTarget* source() const { return m_source.get(); } 115 EventTarget* source() const { return m_source.get(); }
116 MessagePortArray ports(bool& isNull) const; 116 MessagePortArray ports(bool& isNull) const;
117 MessagePortArray ports() const; 117 MessagePortArray ports() const;
118 MessagePortChannelArray* channels() const { 118
119 return m_channels ? m_channels.get() : nullptr; 119 MessagePortChannelArray releaseChannels() { return std::move(m_channels); }
120 }
121 120
122 const AtomicString& interfaceName() const override; 121 const AtomicString& interfaceName() const override;
123 122
124 enum DataType { 123 enum DataType {
125 DataTypeScriptValue, 124 DataTypeScriptValue,
126 DataTypeSerializedScriptValue, 125 DataTypeSerializedScriptValue,
127 DataTypeString, 126 DataTypeString,
128 DataTypeBlob, 127 DataTypeBlob,
129 DataTypeArrayBuffer 128 DataTypeArrayBuffer
130 }; 129 };
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 MessageEvent(PassRefPtr<SerializedScriptValue> data, 174 MessageEvent(PassRefPtr<SerializedScriptValue> data,
176 const String& origin, 175 const String& origin,
177 const String& lastEventId, 176 const String& lastEventId,
178 EventTarget* source, 177 EventTarget* source,
179 MessagePortArray*, 178 MessagePortArray*,
180 const String& suborigin); 179 const String& suborigin);
181 MessageEvent(PassRefPtr<SerializedScriptValue> data, 180 MessageEvent(PassRefPtr<SerializedScriptValue> data,
182 const String& origin, 181 const String& origin,
183 const String& lastEventId, 182 const String& lastEventId,
184 EventTarget* source, 183 EventTarget* source,
185 std::unique_ptr<MessagePortChannelArray>, 184 MessagePortChannelArray,
186 const String& suborigin); 185 const String& suborigin);
187 186
188 MessageEvent(const String& data, 187 MessageEvent(const String& data,
189 const String& origin, 188 const String& origin,
190 const String& suborigin); 189 const String& suborigin);
191 MessageEvent(Blob* data, const String& origin, const String& suborigin); 190 MessageEvent(Blob* data, const String& origin, const String& suborigin);
192 MessageEvent(DOMArrayBuffer* data, 191 MessageEvent(DOMArrayBuffer* data,
193 const String& origin, 192 const String& origin,
194 const String& suborigin); 193 const String& suborigin);
195 194
196 DataType m_dataType; 195 DataType m_dataType;
197 ScriptValue m_dataAsScriptValue; 196 ScriptValue m_dataAsScriptValue;
198 RefPtr<SerializedScriptValue> m_dataAsSerializedScriptValue; 197 RefPtr<SerializedScriptValue> m_dataAsSerializedScriptValue;
199 String m_dataAsString; 198 String m_dataAsString;
200 Member<Blob> m_dataAsBlob; 199 Member<Blob> m_dataAsBlob;
201 Member<DOMArrayBuffer> m_dataAsArrayBuffer; 200 Member<DOMArrayBuffer> m_dataAsArrayBuffer;
202 String m_origin; 201 String m_origin;
203 String m_lastEventId; 202 String m_lastEventId;
204 Member<EventTarget> m_source; 203 Member<EventTarget> m_source;
205 // m_ports are the MessagePorts in an engtangled state, and m_channels are 204 // m_ports are the MessagePorts in an entangled state, and m_channels are
206 // the MessageChannels in a disentangled state. Only one of them can be 205 // the MessageChannels in a disentangled state. Only one of them can be
207 // non-empty at a time. entangleMessagePorts() moves between the states. 206 // non-empty at a time. entangleMessagePorts() moves between the states.
208 Member<MessagePortArray> m_ports; 207 Member<MessagePortArray> m_ports;
209 std::unique_ptr<MessagePortChannelArray> m_channels; 208 MessagePortChannelArray m_channels;
210 String m_suborigin; 209 String m_suborigin;
211 }; 210 };
212 211
213 } // namespace blink 212 } // namespace blink
214 213
215 #endif // MessageEvent_h 214 #endif // MessageEvent_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698