| 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
|
|
|