OLD | NEW |
(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 |
OLD | NEW |