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

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

Issue 2471263003: [Presentation API] (4th)(1-UA blink side) Add WebPresentationConnection and WebPresentationConnecti… (Closed)
Patch Set: resolve code review comments from mlamouri Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp b/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp
index 30c89bb1c5090ddda6219a54eea174d9554cc423..88980d1de2890b084e9caadbd20a63ee6f3799b4 100644
--- a/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp
+++ b/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp
@@ -18,7 +18,7 @@ namespace blink {
PresentationConnectionCallbacks::PresentationConnectionCallbacks(
ScriptPromiseResolver* resolver,
PresentationRequest* request)
- : m_resolver(resolver), m_request(request) {
+ : m_resolver(resolver), m_request(request), m_connection(nullptr) {
ASSERT(m_resolver);
ASSERT(m_request);
}
@@ -29,16 +29,24 @@ void PresentationConnectionCallbacks::onSuccess(
m_resolver->getExecutionContext()->isContextDestroyed()) {
return;
}
- m_resolver->resolve(
- PresentationConnection::take(m_resolver.get(), sessionInfo, m_request));
+
+ m_connection =
+ PresentationConnection::take(m_resolver.get(), sessionInfo, m_request);
+ m_resolver->resolve(m_connection);
}
void PresentationConnectionCallbacks::onError(
const WebPresentationError& error) {
if (!m_resolver->getExecutionContext() ||
- m_resolver->getExecutionContext()->isContextDestroyed())
+ m_resolver->getExecutionContext()->isContextDestroyed()) {
return;
+ }
m_resolver->reject(PresentationError::take(error));
+ m_connection = nullptr;
+}
+
+WebPresentationConnection* PresentationConnectionCallbacks::getConnection() {
+ return m_connection ? m_connection.get() : nullptr;
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698