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

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

Issue 2863903002: [Presentation API] Change controller connection to 'terminated' when receiver connection terminates (Closed)
Patch Set: fix layout test failures Created 3 years, 7 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 <memory> 7 #include <memory>
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "core/dom/DOMArrayBuffer.h" 9 #include "core/dom/DOMArrayBuffer.h"
10 #include "core/dom/DOMArrayBufferView.h" 10 #include "core/dom/DOMArrayBufferView.h"
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 DispatchStateChangeEvent(Event::Create(EventTypeNames::terminate)); 455 DispatchStateChangeEvent(Event::Create(EventTypeNames::terminate));
456 return; 456 return;
457 // Closed state is handled in |didClose()|. 457 // Closed state is handled in |didClose()|.
458 case WebPresentationConnectionState::kClosed: 458 case WebPresentationConnectionState::kClosed:
459 NOTREACHED(); 459 NOTREACHED();
460 return; 460 return;
461 } 461 }
462 NOTREACHED(); 462 NOTREACHED();
463 } 463 }
464 464
465 void PresentationConnection::NotifyTargetConnection(
466 WebPresentationConnectionState state) {
467 if (proxy_)
468 proxy_->NotifyTargetConnection(state);
469 }
470
465 void PresentationConnection::DidClose( 471 void PresentationConnection::DidClose(
466 WebPresentationConnectionCloseReason reason, 472 WebPresentationConnectionCloseReason reason,
467 const String& message) { 473 const String& message) {
468 if (state_ == WebPresentationConnectionState::kClosed) 474 if (state_ == WebPresentationConnectionState::kClosed ||
475 state_ == WebPresentationConnectionState::kTerminated) {
469 return; 476 return;
477 }
470 478
471 state_ = WebPresentationConnectionState::kClosed; 479 state_ = WebPresentationConnectionState::kClosed;
472 DispatchStateChangeEvent(PresentationConnectionCloseEvent::Create( 480 DispatchStateChangeEvent(PresentationConnectionCloseEvent::Create(
473 EventTypeNames::close, ConnectionCloseReasonToString(reason), message)); 481 EventTypeNames::close, ConnectionCloseReasonToString(reason), message));
474 } 482 }
475 483
476 void PresentationConnection::DidClose() { 484 void PresentationConnection::DidClose() {
477 DidClose(WebPresentationConnectionCloseReason::kClosed, ""); 485 DidClose(WebPresentationConnectionCloseReason::kClosed, "");
478 } 486 }
479 487
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 void PresentationConnection::TearDown() { 531 void PresentationConnection::TearDown() {
524 // Cancel current Blob loading if any. 532 // Cancel current Blob loading if any.
525 if (blob_loader_) { 533 if (blob_loader_) {
526 blob_loader_->Cancel(); 534 blob_loader_->Cancel();
527 blob_loader_.Clear(); 535 blob_loader_.Clear();
528 } 536 }
529 messages_.clear(); 537 messages_.clear();
530 } 538 }
531 539
532 } // namespace blink 540 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698