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 ed9a91229fdef6bd8cdf9a98812c1568f0a0e749..afc203027997d53222709b80b1e59e023f0766a0 100644 |
| --- a/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp |
| +++ b/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp |
| @@ -314,6 +314,17 @@ void PresentationConnection::didReceiveBinaryMessage(const uint8_t* data, size_t |
| ASSERT_NOT_REACHED(); |
| } |
| +void PresentationConnection::close() |
| +{ |
| + if (m_state != WebPresentationConnectionState::Connected) |
|
whywhat
2015/11/20 06:26:49
who sets the state of the session to Closed or Ter
imcheng
2015/11/20 06:31:45
The MRP should notify MR of state change as it han
mlamouri (slow - plz ping)
2015/11/27 11:48:47
Ack.
|
| + return; |
| + WebPresentationClient* client = presentationClient(executionContext()); |
| + if (client) |
| + client->closeSession(m_url, m_id); |
| + |
| + tearDown(); |
| +} |
| + |
| void PresentationConnection::terminate() |
| { |
| if (m_state != WebPresentationConnectionState::Connected) |
| @@ -322,15 +333,7 @@ void PresentationConnection::terminate() |
| if (client) |
| client->terminateSession(m_url, m_id); |
| - // Cancel current Blob loading if any. |
| - if (m_blobLoader) { |
| - m_blobLoader->cancel(); |
| - m_blobLoader.clear(); |
| - } |
| - |
| - // Clear message queue. |
| - Deque<OwnPtr<Message>> empty; |
| - m_messages.swap(empty); |
| + tearDown(); |
| } |
| bool PresentationConnection::matches(WebPresentationConnectionClient* client) const |
| @@ -371,9 +374,17 @@ void PresentationConnection::didFailLoadingBlob(FileError::ErrorCode errorCode) |
| handleMessageQueue(); |
| } |
| -bool PresentationConnection::isDisconnected() const |
| +void PresentationConnection::tearDown() |
| { |
| - return m_state == WebPresentationConnectionState::Closed || m_state == WebPresentationConnectionState::Terminated; |
| + // Cancel current Blob loading if any. |
| + if (m_blobLoader) { |
| + m_blobLoader->cancel(); |
| + m_blobLoader.clear(); |
| + } |
| + |
| + // Clear message queue. |
| + Deque<OwnPtr<Message>> empty; |
| + m_messages.swap(empty); |
| } |
| } // namespace blink |