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

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

Issue 2661053002: [Presentation API] Fix race condition in which state change is lost. (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
« no previous file with comments | « content/browser/presentation/presentation_service_impl_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 controller->registerConnection(connection); 193 controller->registerConnection(connection);
194 194
195 // Fire onconnectionavailable event asynchronously. 195 // Fire onconnectionavailable event asynchronously.
196 auto* event = PresentationConnectionAvailableEvent::create( 196 auto* event = PresentationConnectionAvailableEvent::create(
197 EventTypeNames::connectionavailable, connection); 197 EventTypeNames::connectionavailable, connection);
198 request->getExecutionContext()->postTask( 198 request->getExecutionContext()->postTask(
199 TaskType::Presentation, BLINK_FROM_HERE, 199 TaskType::Presentation, BLINK_FROM_HERE,
200 createSameThreadTask(&PresentationConnection::dispatchEventAsync, 200 createSameThreadTask(&PresentationConnection::dispatchEventAsync,
201 wrapPersistent(request), wrapPersistent(event))); 201 wrapPersistent(request), wrapPersistent(event)));
202 202
203 // Fire onconnect event asynchronously, after onconnectionavailable.
204 connection->didChangeState(WebPresentationConnectionState::Connected);
205
203 return connection; 206 return connection;
204 } 207 }
205 208
206 // static 209 // static
207 PresentationConnection* PresentationConnection::take( 210 PresentationConnection* PresentationConnection::take(
208 PresentationReceiver* receiver, 211 PresentationReceiver* receiver,
209 const WebPresentationSessionInfo& sessionInfo) { 212 const WebPresentationSessionInfo& sessionInfo) {
210 DCHECK(receiver); 213 DCHECK(receiver);
211 214
212 PresentationConnection* connection = new PresentationConnection( 215 PresentationConnection* connection = new PresentationConnection(
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 void PresentationConnection::tearDown() { 497 void PresentationConnection::tearDown() {
495 // Cancel current Blob loading if any. 498 // Cancel current Blob loading if any.
496 if (m_blobLoader) { 499 if (m_blobLoader) {
497 m_blobLoader->cancel(); 500 m_blobLoader->cancel();
498 m_blobLoader.clear(); 501 m_blobLoader.clear();
499 } 502 }
500 m_messages.clear(); 503 m_messages.clear();
501 } 504 }
502 505
503 } // namespace blink 506 } // namespace blink
OLDNEW
« no previous file with comments | « content/browser/presentation/presentation_service_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698