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

Side by Side Diff: Source/modules/serviceworkers/ServiceWorkerMessageEvent.h

Issue 1130113006: ServiceWorker: Introduce ServiceWorkerMessageEvent to replace MessageEvent (3/3). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: make more tests pass Created 5 years, 5 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef ServiceWorkerMessageEvent_h
6 #define ServiceWorkerMessageEvent_h
7
8 #include "core/dom/DOMArrayBuffer.h"
9 #include "core/dom/MessagePort.h"
10 #include "modules/EventModules.h"
11 #include "modules/ModulesExport.h"
12 #include "modules/serviceworkers/ServiceWorkerMessageEventInit.h"
13
14 namespace blink {
15
16 class MODULES_EXPORT ServiceWorkerMessageEvent final : public Event {
17 DEFINE_WRAPPERTYPEINFO();
18 public:
19 static PassRefPtrWillBeRawPtr<ServiceWorkerMessageEvent> create()
20 {
21 return adoptRefWillBeNoop(new ServiceWorkerMessageEvent);
22 }
23
24 static PassRefPtrWillBeRawPtr<ServiceWorkerMessageEvent> create(const Atomic String& type, const ServiceWorkerMessageEventInit& initializer)
25 {
26 return adoptRefWillBeNoop(new ServiceWorkerMessageEvent(type, initialize r));
27 }
28
29 static PassRefPtrWillBeRawPtr<ServiceWorkerMessageEvent> create(PassOwnPtrWi llBeRawPtr<MessagePortArray> ports, PassRefPtr<SerializedScriptValue> data, Pass RefPtrWillBeRawPtr<ServiceWorker> source)
30 {
31 return adoptRefWillBeNoop(new ServiceWorkerMessageEvent(data, String(), String(), source, ports));
32 }
33
34 virtual ~ServiceWorkerMessageEvent();
35
36 ScriptValue data() const { return m_data; }
37 SerializedScriptValue* serializedData() const { return m_serializedData.get( ); }
38 const String& origin() const { return m_origin; }
39 const String& lastEventId() const { return m_lastEventId; }
40 MessagePortArray ports(bool& isNull) const;
41 MessagePortArray ports() const;
42 void source(ServiceWorkerOrMessagePort& result) const;
43
44 virtual const AtomicString& interfaceName() const override;
45
46 DECLARE_VIRTUAL_TRACE();
47
48 private:
49 ServiceWorkerMessageEvent();
50 ServiceWorkerMessageEvent(const AtomicString& type, const ServiceWorkerMessa geEventInit& initializer);
51 ServiceWorkerMessageEvent(PassRefPtr<SerializedScriptValue> data, const Stri ng& origin, const String& lastEventId, PassRefPtrWillBeRawPtr<ServiceWorker> sou rce, PassOwnPtrWillBeRawPtr<MessagePortArray> ports);
52
53 ScriptValue m_data;
54 RefPtr<SerializedScriptValue> m_serializedData;
55 String m_origin;
56 String m_lastEventId;
57 RefPtrWillBeMember<ServiceWorker> m_sourceAsServiceWorker;
58 RefPtrWillBeMember<MessagePort> m_sourceAsMessagePort;
59 OwnPtrWillBeMember<MessagePortArray> m_ports;
60 };
61
62 } // namespace blink
63
64 #endif // ServiceWorkerMessageEvent_h
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorkerContainer.idl ('k') | Source/modules/serviceworkers/ServiceWorkerMessageEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698