Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
|
nhiroki
2015/05/13 01:09:38
You might want to move StashedMessagePort.* and St
Marijn Kruisselbrink
2015/05/13 01:46:53
I'm not sure about this. It's certainly possible t
| |
| 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 typedef WillBeHeapVector<RefPtrWillBeMember<StashedMessagePort>, 1> StashedMessa gePortArray; | |
|
nhiroki
2015/05/13 01:09:38
nit: typedef -> using
Marijn Kruisselbrink
2015/05/13 01:46:53
Done.
| |
| 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 | |
| 20 : public MessagePort { | |
| 21 DEFINE_WRAPPERTYPEINFO(); | |
| 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 void messageAvailable() override; | |
| 35 void dispatchMessages(); | |
| 36 | |
| 37 explicit StashedMessagePort(ExecutionContext&, PassOwnPtr<WebMessagePortChan nel>, const String& name); | |
| 38 | |
| 39 String m_name; | |
| 40 WeakPtrFactory<StashedMessagePort> m_weakFactory; | |
| 41 }; | |
| 42 | |
| 43 } // namespace blink | |
| 44 | |
| 45 #endif // StashedMessagePort_h | |
| OLD | NEW |