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

Unified Diff: third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp

Issue 2547143002: [Presentation API] fire onconnectionavailable and onconnect event asynchronously (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp b/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp
index e7d005333b686f332fb64a173e789ece4d5ca05e..da9c1ca45619f6a3701b3c827e565a967df21928 100644
--- a/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp
+++ b/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp
@@ -9,6 +9,7 @@
#include "core/dom/DOMArrayBufferView.h"
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
+#include "core/dom/ExecutionContextTask.h"
#include "core/events/Event.h"
#include "core/events/MessageEvent.h"
#include "core/fileapi/FileReaderLoader.h"
@@ -191,9 +192,6 @@ PresentationConnection* PresentationConnection::take(
PresentationConnection* connection = new PresentationConnection(
controller->frame(), client->getId(), client->getUrl());
controller->registerConnection(connection);
- request->dispatchEvent(PresentationConnectionAvailableEvent::create(
- EventTypeNames::connectionavailable, connection));
-
return connection;
}
@@ -415,7 +413,10 @@ void PresentationConnection::didChangeState(
NOTREACHED();
return;
case WebPresentationConnectionState::Connected:
- dispatchEvent(Event::create(EventTypeNames::connect));
+ getExecutionContext()->postTask(
+ BLINK_FROM_HERE,
+ createSameThreadTask(&PresentationConnection::dispatchConnectEvent,
+ wrapPersistent(this)));
return;
case WebPresentationConnectionState::Terminated:
dispatchEvent(Event::create(EventTypeNames::terminate));
@@ -464,6 +465,10 @@ void PresentationConnection::didFailLoadingBlob(
handleMessageQueue();
}
+void PresentationConnection::dispatchConnectEvent() {
+ dispatchEvent(Event::create(EventTypeNames::connect));
+}
+
void PresentationConnection::tearDown() {
// Cancel current Blob loading if any.
if (m_blobLoader) {

Powered by Google App Engine
This is Rietveld 408576698