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

Unified 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, 6 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/modules/serviceworkers/ServiceWorkerMessageEvent.h
diff --git a/Source/modules/serviceworkers/ServiceWorkerMessageEvent.h b/Source/modules/serviceworkers/ServiceWorkerMessageEvent.h
new file mode 100644
index 0000000000000000000000000000000000000000..16c3f43cd1873ef14fb089156dd7c3e656a7725d
--- /dev/null
+++ b/Source/modules/serviceworkers/ServiceWorkerMessageEvent.h
@@ -0,0 +1,64 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ServiceWorkerMessageEvent_h
+#define ServiceWorkerMessageEvent_h
+
+#include "core/dom/DOMArrayBuffer.h"
+#include "core/dom/MessagePort.h"
+#include "modules/EventModules.h"
+#include "modules/ModulesExport.h"
+#include "modules/serviceworkers/ServiceWorkerMessageEventInit.h"
+
+namespace blink {
+
+class MODULES_EXPORT ServiceWorkerMessageEvent final : public Event {
+ DEFINE_WRAPPERTYPEINFO();
+public:
+ static PassRefPtrWillBeRawPtr<ServiceWorkerMessageEvent> create()
+ {
+ return adoptRefWillBeNoop(new ServiceWorkerMessageEvent);
+ }
+
+ static PassRefPtrWillBeRawPtr<ServiceWorkerMessageEvent> create(const AtomicString& type, const ServiceWorkerMessageEventInit& initializer)
+ {
+ return adoptRefWillBeNoop(new ServiceWorkerMessageEvent(type, initializer));
+ }
+
+ static PassRefPtrWillBeRawPtr<ServiceWorkerMessageEvent> create(PassOwnPtrWillBeRawPtr<MessagePortArray> ports, PassRefPtr<SerializedScriptValue> data, PassRefPtrWillBeRawPtr<ServiceWorker> source)
+ {
+ return adoptRefWillBeNoop(new ServiceWorkerMessageEvent(data, String(), String(), source, ports));
+ }
+
+ virtual ~ServiceWorkerMessageEvent();
+
+ ScriptValue data() const { return m_data; }
+ SerializedScriptValue* serializedData() const { return m_serializedData.get(); }
+ const String& origin() const { return m_origin; }
+ const String& lastEventId() const { return m_lastEventId; }
+ MessagePortArray ports(bool& isNull) const;
+ MessagePortArray ports() const;
+ void source(ServiceWorkerOrMessagePort& result) const;
+
+ virtual const AtomicString& interfaceName() const override;
+
+ DECLARE_VIRTUAL_TRACE();
+
+private:
+ ServiceWorkerMessageEvent();
+ ServiceWorkerMessageEvent(const AtomicString& type, const ServiceWorkerMessageEventInit& initializer);
+ ServiceWorkerMessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtrWillBeRawPtr<ServiceWorker> source, PassOwnPtrWillBeRawPtr<MessagePortArray> ports);
+
+ ScriptValue m_data;
+ RefPtr<SerializedScriptValue> m_serializedData;
+ String m_origin;
+ String m_lastEventId;
+ RefPtrWillBeMember<ServiceWorker> m_sourceAsServiceWorker;
+ RefPtrWillBeMember<MessagePort> m_sourceAsMessagePort;
+ OwnPtrWillBeMember<MessagePortArray> m_ports;
+};
+
+} // namespace blink
+
+#endif // ServiceWorkerMessageEvent_h
« 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