Chromium Code Reviews| 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..f66625efdcc56e5d554280e628088b4c5cf49a92 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, |
| @@ -312,13 +320,13 @@ void PresentationConnection::handleMessageQueue() { |
| 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, nullptr); |
|
imcheng
2017/01/20 20:15:43
Should this be |m_proxy.get()| here and below?
zhaobin
2017/01/23 19:38:49
Done.
|
| m_messages.removeFirst(); |
| break; |
| case MessageTypeArrayBuffer: |
| client->sendArrayBuffer(m_url, m_id, static_cast<const uint8_t*>( |
| message->arrayBuffer->data()), |
| - message->arrayBuffer->byteLength()); |
| + message->arrayBuffer->byteLength(), nullptr); |
| m_messages.removeFirst(); |
| break; |
| case MessageTypeBlob: |
| @@ -352,7 +360,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 +464,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(); |