Index: third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp |
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp b/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp |
index be94c78b5cbe27f3800a4a7eeafc31a025dc6703..c662951bd147c2cc961bde87aed8b0ba2da1ee9e 100644 |
--- a/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp |
+++ b/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp |
@@ -153,12 +153,20 @@ PresentationConnection::PresentationConnection(LocalFrame* frame, |
m_id(id), |
m_url(url), |
m_state(WebPresentationConnectionState::Connecting), |
- m_binaryType(BinaryTypeBlob) {} |
+ m_binaryType(BinaryTypeBlob), |
+ m_proxy(nullptr) {} |
PresentationConnection::~PresentationConnection() { |
ASSERT(!m_blobLoader); |
} |
+void PresentationConnection::bindProxy( |
+ std::unique_ptr<WebPresentationConnectionProxy> proxy) { |
+ DCHECK(proxy); |
+ DCHECK(!m_proxy); |
+ m_proxy = std::move(proxy); |
+} |
+ |
// static |
PresentationConnection* PresentationConnection::take( |
ScriptPromiseResolver* resolver, |
@@ -305,20 +313,21 @@ bool PresentationConnection::canSendMessage(ExceptionState& exceptionState) { |
void PresentationConnection::handleMessageQueue() { |
WebPresentationClient* client = presentationClient(getExecutionContext()); |
- if (!client) |
+ if (!client || !m_proxy) |
return; |
while (!m_messages.isEmpty() && !m_blobLoader) { |
Message* message = m_messages.first().get(); |
switch (message->type) { |
case MessageTypeText: |
- client->sendString(m_url, m_id, message->text); |
+ client->sendString(m_url, m_id, message->text, m_proxy.get()); |
m_messages.removeFirst(); |
break; |
case MessageTypeArrayBuffer: |
- client->sendArrayBuffer(m_url, m_id, static_cast<const uint8_t*>( |
- message->arrayBuffer->data()), |
- message->arrayBuffer->byteLength()); |
+ client->sendArrayBuffer( |
+ m_url, m_id, |
+ static_cast<const uint8_t*>(message->arrayBuffer->data()), |
+ message->arrayBuffer->byteLength(), m_proxy.get()); |
m_messages.removeFirst(); |
break; |
case MessageTypeBlob: |
@@ -352,7 +361,7 @@ void PresentationConnection::setBinaryType(const String& binaryType) { |
ASSERT_NOT_REACHED(); |
} |
-void PresentationConnection::didReceiveTextMessage(const String& message) { |
+void PresentationConnection::didReceiveTextMessage(const WebString& message) { |
if (m_state != WebPresentationConnectionState::Connected) |
return; |
@@ -456,10 +465,11 @@ void PresentationConnection::didFinishLoadingBlob(DOMArrayBuffer* buffer) { |
ASSERT(buffer && buffer->buffer()); |
// Send the loaded blob immediately here and continue processing the queue. |
WebPresentationClient* client = presentationClient(getExecutionContext()); |
- if (client) |
+ if (client) { |
client->sendBlobData(m_url, m_id, |
static_cast<const uint8_t*>(buffer->data()), |
- buffer->byteLength()); |
+ buffer->byteLength(), m_proxy.get()); |
+ } |
m_messages.removeFirst(); |
m_blobLoader.clear(); |