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

Side by Side Diff: third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp

Issue 2714693002: [Presentation API] Use connection proxy to change connection state to 'closed' (Closed)
Patch Set: Created 3 years, 10 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/presentation/PresentationConnection.h" 5 #include "modules/presentation/PresentationConnection.h"
6 6
7 #include "bindings/core/v8/ScriptPromiseResolver.h" 7 #include "bindings/core/v8/ScriptPromiseResolver.h"
8 #include "core/dom/DOMArrayBuffer.h" 8 #include "core/dom/DOMArrayBuffer.h"
9 #include "core/dom/DOMArrayBufferView.h" 9 #include "core/dom/DOMArrayBufferView.h"
10 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 m_binaryType(BinaryTypeBlob), 156 m_binaryType(BinaryTypeBlob),
157 m_proxy(nullptr) {} 157 m_proxy(nullptr) {}
158 158
159 PresentationConnection::~PresentationConnection() { 159 PresentationConnection::~PresentationConnection() {
160 ASSERT(!m_blobLoader); 160 ASSERT(!m_blobLoader);
161 } 161 }
162 162
163 void PresentationConnection::bindProxy( 163 void PresentationConnection::bindProxy(
164 std::unique_ptr<WebPresentationConnectionProxy> proxy) { 164 std::unique_ptr<WebPresentationConnectionProxy> proxy) {
165 DCHECK(proxy); 165 DCHECK(proxy);
166 // TODO(zhaobin): Restore to DCHECK(!m_proxy) when reconnect() is properly
167 // implemented.
168 m_proxy = std::move(proxy); 166 m_proxy = std::move(proxy);
169 } 167 }
170 168
171 // static 169 // static
172 PresentationConnection* PresentationConnection::take( 170 PresentationConnection* PresentationConnection::take(
173 ScriptPromiseResolver* resolver, 171 ScriptPromiseResolver* resolver,
174 const WebPresentationSessionInfo& sessionInfo, 172 const WebPresentationSessionInfo& sessionInfo,
175 PresentationRequest* request) { 173 PresentationRequest* request) {
176 ASSERT(resolver); 174 ASSERT(resolver);
177 ASSERT(request); 175 ASSERT(request);
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 return m_state; 393 return m_state;
396 } 394 }
397 395
398 void PresentationConnection::close() { 396 void PresentationConnection::close() {
399 if (m_state != WebPresentationConnectionState::Connecting && 397 if (m_state != WebPresentationConnectionState::Connecting &&
400 m_state != WebPresentationConnectionState::Connected) { 398 m_state != WebPresentationConnectionState::Connected) {
401 return; 399 return;
402 } 400 }
403 WebPresentationClient* client = presentationClient(getExecutionContext()); 401 WebPresentationClient* client = presentationClient(getExecutionContext());
404 if (client) 402 if (client)
405 client->closeSession(m_url, m_id); 403 client->closeSession(m_url, m_id, m_proxy.get());
406 404
407 tearDown(); 405 tearDown();
408 } 406 }
409 407
410 void PresentationConnection::terminate() { 408 void PresentationConnection::terminate() {
411 if (m_state != WebPresentationConnectionState::Connected) 409 if (m_state != WebPresentationConnectionState::Connected)
412 return; 410 return;
413 WebPresentationClient* client = presentationClient(getExecutionContext()); 411 WebPresentationClient* client = presentationClient(getExecutionContext());
414 if (client) 412 if (client)
415 client->terminateSession(m_url, m_id); 413 client->terminateSession(m_url, m_id);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 void PresentationConnection::tearDown() { 503 void PresentationConnection::tearDown() {
506 // Cancel current Blob loading if any. 504 // Cancel current Blob loading if any.
507 if (m_blobLoader) { 505 if (m_blobLoader) {
508 m_blobLoader->cancel(); 506 m_blobLoader->cancel();
509 m_blobLoader.clear(); 507 m_blobLoader.clear();
510 } 508 }
511 m_messages.clear(); 509 m_messages.clear();
512 } 510 }
513 511
514 } // namespace blink 512 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698