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

Unified Diff: Source/modules/app_banner/BeforeInstallPromptEvent.cpp

Issue 1214793002: Fix a memory leak in the app banner prompt layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase again Created 5 years, 5 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
« no previous file with comments | « Source/modules/app_banner/BeforeInstallPromptEvent.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/app_banner/BeforeInstallPromptEvent.cpp
diff --git a/Source/modules/app_banner/BeforeInstallPromptEvent.cpp b/Source/modules/app_banner/BeforeInstallPromptEvent.cpp
index 74cdab48b06f844afaf94119b8a34e03fb48a2cc..b7259f7acf04892c9b3b3cb391c953a6ad3fe5d3 100644
--- a/Source/modules/app_banner/BeforeInstallPromptEvent.cpp
+++ b/Source/modules/app_banner/BeforeInstallPromptEvent.cpp
@@ -49,14 +49,15 @@ Vector<String> BeforeInstallPromptEvent::platforms() const
ScriptPromise BeforeInstallPromptEvent::userChoice(ScriptState* scriptState)
{
- if (m_userChoice.isEmpty() && m_client) {
- ASSERT(m_requestId != -1);
- RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scriptState);
- m_userChoice = resolver->promise();
- m_client->registerBannerCallbacks(m_requestId, new CallbackPromiseAdapter<AppBannerPromptResult, void>(resolver));
+ if (!m_resolver) {
+ m_resolver = ScriptPromiseResolver::create(scriptState);
+ if (m_client) {
+ ASSERT(m_requestId != -1);
+ m_client->registerBannerCallbacks(m_requestId, new CallbackPromiseAdapter<AppBannerPromptResult, void>(m_resolver));
+ }
}
- return m_userChoice;
+ return m_resolver->promise();
}
const AtomicString& BeforeInstallPromptEvent::interfaceName() const
« no previous file with comments | « Source/modules/app_banner/BeforeInstallPromptEvent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698