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

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

Issue 2572473003: [Presentation API] PresentationRequest::getAvailability() should return the same promise (Closed)
Patch Set: rebase with master 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
« no previous file with comments | « third_party/WebKit/Source/modules/presentation/PresentationRequest.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp b/third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp
index 204cc11fc70d3716ef17fdc40cd099d63087340d..d26008add8582a518c4962370abd62d3271ca54a 100644
--- a/third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp
+++ b/third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp
@@ -189,11 +189,16 @@ ScriptPromise PresentationRequest::getAvailability(ScriptState* scriptState) {
InvalidStateError,
"The PresentationRequest is no longer associated to a frame."));
- ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
- client->getAvailability(
- m_url,
- WTF::makeUnique<PresentationAvailabilityCallbacks>(resolver, m_url));
- return resolver->promise();
+ if (!m_availabilityProperty) {
+ m_availabilityProperty = new PresentationAvailabilityProperty(
+ scriptState->getExecutionContext(), this,
+ PresentationAvailabilityProperty::Ready);
+
+ client->getAvailability(m_url,
+ WTF::makeUnique<PresentationAvailabilityCallbacks>(
+ m_availabilityProperty, m_url));
+ }
+ return m_availabilityProperty->promise(scriptState->world());
}
const KURL& PresentationRequest::url() const {
@@ -201,6 +206,7 @@ const KURL& PresentationRequest::url() const {
}
DEFINE_TRACE(PresentationRequest) {
+ visitor->trace(m_availabilityProperty);
EventTargetWithInlineData::trace(visitor);
SuspendableObject::trace(visitor);
}
« no previous file with comments | « third_party/WebKit/Source/modules/presentation/PresentationRequest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698