From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/dom/MessagePortChannel.h | 34 +++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'Source/WebCore/dom/MessagePortChannel.h') diff --git a/Source/WebCore/dom/MessagePortChannel.h b/Source/WebCore/dom/MessagePortChannel.h index 9e1b7cba6..60ed6f836 100644 --- a/Source/WebCore/dom/MessagePortChannel.h +++ b/Source/WebCore/dom/MessagePortChannel.h @@ -28,15 +28,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef MessagePortChannel_h -#define MessagePortChannel_h +#pragma once #include "SerializedScriptValue.h" -#include +#include +#include #include -#include -#include -#include #include #include @@ -46,17 +43,27 @@ namespace WebCore { class MessagePortChannel; class PlatformMessagePortChannel; class ScriptExecutionContext; - class SerializedScriptValue; // The overwhelmingly common case is sending a single port, so handle that efficiently with an inline buffer of size 1. - typedef Vector, 1> MessagePortChannelArray; + typedef Vector, 1> MessagePortChannelArray; // MessagePortChannel is a platform-independent interface to the remote side of a message channel. // It acts as a wrapper around the platform-dependent PlatformMessagePortChannel implementation which ensures that the platform-dependent close() method is invoked before destruction. class MessagePortChannel { WTF_MAKE_NONCOPYABLE(MessagePortChannel); WTF_MAKE_FAST_ALLOCATED; public: - static void createChannel(PassRefPtr, PassRefPtr); + struct EventData { + EventData(Ref&& message, std::unique_ptr&& channels) + : message(WTFMove(message)) + , channels(WTFMove(channels)) + { } + + Ref message; + std::unique_ptr channels; + }; + + explicit MessagePortChannel(RefPtr&&); + static void createChannel(MessagePort*, MessagePort*); // Entangles the channel with a port (called when a port has been cloned, after the clone has been marshaled to its new owning thread and is ready to receive messages). // Returns false if the entanglement failed because the port was closed. @@ -75,10 +82,12 @@ namespace WebCore { bool hasPendingActivity(); // Sends a message and optional cloned port to the remote port. - void postMessageToRemote(PassRefPtr, PassOwnPtr); + void postMessageToRemote(Ref&&, std::unique_ptr); // Extracts a message from the message queue for this port. - bool tryGetMessageFromRemote(RefPtr&, OwnPtr&); + std::unique_ptr takeMessageFromRemote(); + + Deque> takeAllMessagesFromRemote(); // Returns the entangled port if run by the same thread (see MessagePort::locallyEntangledPort() for more details). MessagePort* locallyEntangledPort(const ScriptExecutionContext*); @@ -86,10 +95,7 @@ namespace WebCore { ~MessagePortChannel(); private: - explicit MessagePortChannel(PassRefPtr); RefPtr m_channel; }; } // namespace WebCore - -#endif // MessagePortChannel_h -- cgit v1.2.1