Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(805)

Unified Diff: third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp

Issue 1466573002: Presentation API: implement renderer side of PresentationConnection.close(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698