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

Side by Side 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 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 StashedMessagePort_h
6 #define StashedMessagePort_h
7
8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "core/dom/MessagePort.h"
10
11 namespace blink {
12 class ExecutionContext;
13 class StashedMessagePort;
14
15 using StashedMessagePortArray = WillBeHeapVector<RefPtrWillBeMember<StashedMessa gePort>, 1>;
16
17 // Represents a message port that has been stashed. Overrides messageAvailable
18 // to dispatch messages as a global event instead of as events on this port.
19 class StashedMessagePort final : public MessagePort {
20 DEFINE_WRAPPERTYPEINFO();
21 WTF_MAKE_NONCOPYABLE(StashedMessagePort);
22 public:
23 static PassRefPtrWillBeRawPtr<StashedMessagePort> create(ExecutionContext&, PassOwnPtr<WebMessagePortChannel>, const String& name);
24 virtual ~StashedMessagePort();
25
26 static PassOwnPtrWillBeRawPtr<StashedMessagePortArray> toStashedMessagePortA rray(ExecutionContext*, const WebMessagePortChannelArray&, const WebVector<WebSt ring>& channelKeys);
27
28 // StashedMessagePort.idl
29 String name() const;
30
31 DEFINE_INLINE_VIRTUAL_TRACE() { MessagePort::trace(visitor); }
32
33 private:
34 StashedMessagePort(ExecutionContext&, PassOwnPtr<WebMessagePortChannel>, con st String& name);
35
36 void messageAvailable() override;
37 void dispatchMessages();
38
39 String m_name;
40 WeakPtrFactory<StashedMessagePort> m_weakFactory;
41 };
42
43 } // namespace blink
44
45 #endif // StashedMessagePort_h
OLDNEW
« 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