Chromium Code Reviews| 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..b657b5afd874bb040d73407ae88ff36272d9a26e |
| --- /dev/null |
| +++ b/Source/modules/serviceworkers/StashedMessagePort.h |
| @@ -0,0 +1,45 @@ |
| +// 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
|
| +// 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; |
| + |
| +typedef WillBeHeapVector<RefPtrWillBeMember<StashedMessagePort>, 1> StashedMessagePortArray; |
|
nhiroki
2015/05/13 01:09:38
nit: typedef -> using
Marijn Kruisselbrink
2015/05/13 01:46:53
Done.
|
| + |
| +// 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(); |
| +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: |
| + void messageAvailable() override; |
| + void dispatchMessages(); |
| + |
| + explicit StashedMessagePort(ExecutionContext&, PassOwnPtr<WebMessagePortChannel>, const String& name); |
| + |
| + String m_name; |
| + WeakPtrFactory<StashedMessagePort> m_weakFactory; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // StashedMessagePort_h |