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

Unified Diff: Source/modules/serviceworkers/StashedMessagePort.h

Issue 1008533005: Initial implementation of stashed message ports, blink side (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase 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
Index: Source/modules/serviceworkers/StashedMessagePort.h
diff --git a/Source/modules/serviceworkers/StashedMessagePort.h b/Source/modules/serviceworkers/StashedMessagePort.h
new file mode 100644
index 0000000000000000000000000000000000000000..d442f483cd09e615bc6e7463c972f25351ca7aaa
--- /dev/null
+++ b/Source/modules/serviceworkers/StashedMessagePort.h
@@ -0,0 +1,45 @@
+// 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 StashedMessagePort_h
+#define StashedMessagePort_h
+
+#include "bindings/core/v8/ScriptWrappable.h"
+#include "core/dom/MessagePort.h"
+
+namespace blink {
+class ExecutionContext;
+class StashedMessagePort;
+
+using StashedMessagePortArray = WillBeHeapVector<RefPtrWillBeMember<StashedMessagePort>, 1>;
+
+// Represents a message port that has been stashed. Overrides messageAvailable
+// to dispatch messages as a global event instead of as events on this port.
+class StashedMessagePort final : public MessagePort {
+ DEFINE_WRAPPERTYPEINFO();
+ WTF_MAKE_NONCOPYABLE(StashedMessagePort);
+public:
+ static PassRefPtrWillBeRawPtr<StashedMessagePort> create(ExecutionContext&, PassOwnPtr<WebMessagePortChannel>, const String& name);
+ virtual ~StashedMessagePort();
+
+ static PassOwnPtrWillBeRawPtr<StashedMessagePortArray> toStashedMessagePortArray(ExecutionContext*, const WebMessagePortChannelArray&, const WebVector<WebString>& channelKeys);
+
+ // StashedMessagePort.idl
+ String name() const;
+
+ DEFINE_INLINE_VIRTUAL_TRACE() { MessagePort::trace(visitor); }
+
+private:
+ StashedMessagePort(ExecutionContext&, PassOwnPtr<WebMessagePortChannel>, const String& name);
+
+ void messageAvailable() override;
+ void dispatchMessages();
+
+ String m_name;
+ WeakPtrFactory<StashedMessagePort> m_weakFactory;
+};
+
+} // namespace blink
+
+#endif // StashedMessagePort_h
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorkerGlobalScopeClient.h ('k') | Source/modules/serviceworkers/StashedMessagePort.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698