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

Side by Side Diff: third_party/WebKit/Source/modules/presentation/PresentationReceiver.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/PresentationReceiver.h" 5 #include "modules/presentation/PresentationReceiver.h"
6 6
7 #include "bindings/core/v8/ScriptPromise.h" 7 #include "bindings/core/v8/ScriptPromise.h"
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "core/dom/DOMException.h" 9 #include "core/dom/DOMException.h"
10 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 return connection; 78 return connection;
79 } 79 }
80 80
81 void PresentationReceiver::DidChangeConnectionState( 81 void PresentationReceiver::DidChangeConnectionState(
82 WebPresentationConnectionState state) { 82 WebPresentationConnectionState state) {
83 // TODO(zhaobin): remove or modify DCHECK when receiver supports more 83 // TODO(zhaobin): remove or modify DCHECK when receiver supports more
84 // connection state change. 84 // connection state change.
85 DCHECK(state == WebPresentationConnectionState::kTerminated); 85 DCHECK(state == WebPresentationConnectionState::kTerminated);
86 86
87 for (auto connection : connection_list_->connections()) 87 for (auto connection : connection_list_->connections()) {
88 connection->NotifyTargetConnection(state);
88 connection->DidChangeState(state, false /* shouldDispatchEvent */); 89 connection->DidChangeState(state, false /* shouldDispatchEvent */);
90 }
89 } 91 }
90 92
91 void PresentationReceiver::TerminateConnection() { 93 void PresentationReceiver::TerminateConnection() {
92 if (!GetFrame()) 94 if (!GetFrame())
93 return; 95 return;
94 96
95 auto* window = GetFrame()->DomWindow(); 97 auto* window = GetFrame()->DomWindow();
96 if (!window || window->closed()) 98 if (!window || window->closed())
97 return; 99 return;
98 100
(...skipping 16 matching lines...) Expand all
115 } 117 }
116 } 118 }
117 119
118 DEFINE_TRACE(PresentationReceiver) { 120 DEFINE_TRACE(PresentationReceiver) {
119 visitor->Trace(connection_list_); 121 visitor->Trace(connection_list_);
120 visitor->Trace(connection_list_property_); 122 visitor->Trace(connection_list_property_);
121 ContextClient::Trace(visitor); 123 ContextClient::Trace(visitor);
122 } 124 }
123 125
124 } // namespace blink 126 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698