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

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

Issue 2874483002: [Presentation API] Remove closed connections from PresentationConnectionList (Closed)
Patch Set: rebase with master 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 if (!GetFrame()) 94 if (!GetFrame())
95 return; 95 return;
96 96
97 auto* window = GetFrame()->DomWindow(); 97 auto* window = GetFrame()->DomWindow();
98 if (!window || window->closed()) 98 if (!window || window->closed())
99 return; 99 return;
100 100
101 window->close(GetFrame()->GetDocument()); 101 window->close(GetFrame()->GetDocument());
102 } 102 }
103 103
104 void PresentationReceiver::RemoveConnection(
105 WebPresentationConnection* connection) {
106 DCHECK(connection_list_);
107 connection_list_->RemoveConnection(connection);
108 }
109
104 void PresentationReceiver::RegisterConnection( 110 void PresentationReceiver::RegisterConnection(
105 PresentationConnection* connection) { 111 PresentationConnection* connection) {
106 DCHECK(connection_list_); 112 DCHECK(connection_list_);
107 connection_list_->AddConnection(connection); 113 connection_list_->AddConnection(connection);
108 } 114 }
109 115
110 void PresentationReceiver::RecordOriginTypeAccess(Document* document) const { 116 void PresentationReceiver::RecordOriginTypeAccess(Document* document) const {
111 DCHECK(document); 117 DCHECK(document);
112 if (document->IsSecureContext()) { 118 if (document->IsSecureContext()) {
113 UseCounter::Count(document, UseCounter::kPresentationReceiverSecureOrigin); 119 UseCounter::Count(document, UseCounter::kPresentationReceiverSecureOrigin);
114 } else { 120 } else {
115 UseCounter::Count(document, 121 UseCounter::Count(document,
116 UseCounter::kPresentationReceiverInsecureOrigin); 122 UseCounter::kPresentationReceiverInsecureOrigin);
117 } 123 }
118 } 124 }
119 125
120 DEFINE_TRACE(PresentationReceiver) { 126 DEFINE_TRACE(PresentationReceiver) {
121 visitor->Trace(connection_list_); 127 visitor->Trace(connection_list_);
122 visitor->Trace(connection_list_property_); 128 visitor->Trace(connection_list_property_);
123 ContextClient::Trace(visitor); 129 ContextClient::Trace(visitor);
124 } 130 }
125 131
126 } // namespace blink 132 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698