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

Issue 1247283004: Refactor BeforeInstallPromptEvent to use ScriptPromiseProperty (Closed)

Created:
5 years, 5 months ago by dominickn
Modified:
5 years, 3 months ago
CC:
blink-reviews, blink-reviews-bindings_chromium.org, chrome-apps-syd-reviews_chromium.org, dglazkov+blink, mlamouri+watch-blink_chromium.org, vivekg_samsung, vivekg
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Refactor BeforeInstallPromptEvent to use ScriptPromiseProperty This stops the event holding a ScriptPromise as a member, which may lead to a memory leak. Instead, ScriptPromiseProperty members are held as members in the event. A WebCallbacks subclass is used to store a pointer to the necessary ScriptPromiseProperty in the associated event, with the interface exposed to Chromium. When a banner event is resolved, the WebCallbacks implementation in modules/app_banner looks up the ScriptPromiseProperty and resolves its promise. This also makes resolving the prompt promise simpler as well, as it occurs entirely in the event. This CL also removes the app-banner-event-prompt.html test from LeakExpectations, and fixes some bugs in the test relating to promise resolution. BUG=504675 Committed: https://crrev.com/8a7809f1e7eef498eab9f99f15e53a876b0ae9be git-svn-id: svn://svn.chromium.org/blink/trunk@199472 bbb929c8-8fbe-4397-9dbb-9b2b20218538

Patch Set 1 #

Patch Set 2 : Removing from leak expectations #

Patch Set 3 : Refactoring implementation to use WebCallbacks #

Patch Set 4 : GC fixes #

Patch Set 5 : Alphabetising ScriptPromiseProperties #

Patch Set 6 : Restoring missing semicolon in test #

Total comments: 10

Patch Set 7 : Addressing reviewer comments #

Patch Set 8 : Reject all promises when event is manually created #

Total comments: 4

Patch Set 9 : Addressing reviewer feedback #

Patch Set 10 : Replace typedef with using as per style guide #

Total comments: 12

Patch Set 11 : Addressing reviewer comments #

Total comments: 2

Patch Set 12 : Make prompt() return a new promise each call, and restore async callback registration. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+99 lines, -37 lines) Patch
M LayoutTests/LeakExpectations View 1 1 chunk +0 lines, -2 lines 0 comments Download
M LayoutTests/app_banner/app-banner-event-prompt.html View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +5 lines, -3 lines 0 comments Download
M Source/bindings/core/v8/ScriptPromiseProperties.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -1 line 0 comments Download
A Source/modules/app_banner/AppBannerCallbacks.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +27 lines, -0 lines 0 comments Download
A Source/modules/app_banner/AppBannerCallbacks.cpp View 1 2 3 4 5 6 7 8 9 10 1 chunk +20 lines, -0 lines 0 comments Download
M Source/modules/app_banner/AppBannerController.cpp View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +3 lines, -1 line 0 comments Download
M Source/modules/app_banner/AppBannerPromptResult.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -3 lines 0 comments Download
M Source/modules/app_banner/AppBannerPromptResult.cpp View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/app_banner/BeforeInstallPromptEvent.h View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +12 lines, -6 lines 0 comments Download
M Source/modules/app_banner/BeforeInstallPromptEvent.cpp View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +26 lines, -20 lines 0 comments Download
M Source/modules/modules.gypi View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 33 (11 generated)
dominickn
mlamouri: PTAL. I'm not 100% sure that I'm handling memory correctly, since I'm still a ...
5 years, 5 months ago (2015-07-23 04:12:50 UTC) #2
yhirano
https://codereview.chromium.org/1247283004/diff/110002/Source/modules/app_banner/AppBannerCallbacks.h File Source/modules/app_banner/AppBannerCallbacks.h (right): https://codereview.chromium.org/1247283004/diff/110002/Source/modules/app_banner/AppBannerCallbacks.h#newcode23 Source/modules/app_banner/AppBannerCallbacks.h:23: BeforeInstallPromptEvent* m_event; Persistent<BeforeInstallPromptEvent>? https://codereview.chromium.org/1247283004/diff/110002/Source/modules/app_banner/AppBannerCallbacks.h#newcode23 Source/modules/app_banner/AppBannerCallbacks.h:23: BeforeInstallPromptEvent* m_event; [optional] It ...
5 years, 5 months ago (2015-07-23 12:25:03 UTC) #8
dominickn
Thanks for the feedback! https://codereview.chromium.org/1247283004/diff/110002/Source/modules/app_banner/AppBannerCallbacks.h File Source/modules/app_banner/AppBannerCallbacks.h (right): https://codereview.chromium.org/1247283004/diff/110002/Source/modules/app_banner/AppBannerCallbacks.h#newcode23 Source/modules/app_banner/AppBannerCallbacks.h:23: BeforeInstallPromptEvent* m_event; On 2015/07/23 12:25:02, ...
5 years, 5 months ago (2015-07-23 13:13:48 UTC) #9
yhirano
https://codereview.chromium.org/1247283004/diff/110002/Source/modules/app_banner/AppBannerController.cpp File Source/modules/app_banner/AppBannerController.cpp (right): https://codereview.chromium.org/1247283004/diff/110002/Source/modules/app_banner/AppBannerController.cpp#newcode33 Source/modules/app_banner/AppBannerController.cpp:33: RefPtrWillBeRawPtr<BeforeInstallPromptEvent> event = BeforeInstallPromptEvent::create(EventTypeNames::beforeinstallprompt, scriptState, wtfPlatforms, requestId, client); On ...
5 years, 5 months ago (2015-07-24 03:41:17 UTC) #10
dominickn
Thanks again! https://codereview.chromium.org/1247283004/diff/110002/Source/modules/app_banner/AppBannerController.cpp File Source/modules/app_banner/AppBannerController.cpp (right): https://codereview.chromium.org/1247283004/diff/110002/Source/modules/app_banner/AppBannerController.cpp#newcode33 Source/modules/app_banner/AppBannerController.cpp:33: RefPtrWillBeRawPtr<BeforeInstallPromptEvent> event = BeforeInstallPromptEvent::create(EventTypeNames::beforeinstallprompt, scriptState, wtfPlatforms, requestId, ...
5 years, 5 months ago (2015-07-24 05:02:09 UTC) #11
yhirano
lgtm
5 years, 5 months ago (2015-07-24 05:48:15 UTC) #12
mlamouri (slow - plz ping)
lgtm with comments applied. Thanks for fixing this! :) https://codereview.chromium.org/1247283004/diff/230001/Source/modules/app_banner/AppBannerCallbacks.cpp File Source/modules/app_banner/AppBannerCallbacks.cpp (right): https://codereview.chromium.org/1247283004/diff/230001/Source/modules/app_banner/AppBannerCallbacks.cpp#newcode18 Source/modules/app_banner/AppBannerCallbacks.cpp:18: ...
5 years, 5 months ago (2015-07-24 15:08:25 UTC) #13
dominickn
Thanks for all the help. I actually understand the promise implementation much better now. :) ...
5 years, 5 months ago (2015-07-24 23:53:36 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1247283004/250001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1247283004/250001
5 years, 5 months ago (2015-07-24 23:55:21 UTC) #17
commit-bot: I haz the power
Committed patchset #11 (id:250001) as https://src.chromium.org/viewvc/blink?view=rev&revision=199472
5 years, 5 months ago (2015-07-25 00:55:50 UTC) #18
sof
This CL has flaky trybot crashes against its own app_banner/app-banner-event-prompt.html test which can also be ...
5 years, 4 months ago (2015-07-29 15:23:49 UTC) #20
sof
A revert of this CL (patchset #11 id:250001) has been created in https://codereview.chromium.org/1257823003/ by sigbjornf@opera.com. ...
5 years, 4 months ago (2015-07-29 15:47:58 UTC) #21
yhirano
Reopen, as this CL was reverted. The test crashes because of an assertion failure at ...
5 years, 4 months ago (2015-07-30 06:37:45 UTC) #22
yhirano
https://codereview.chromium.org/1247283004/diff/250001/Source/modules/app_banner/BeforeInstallPromptEvent.cpp File Source/modules/app_banner/BeforeInstallPromptEvent.cpp (right): https://codereview.chromium.org/1247283004/diff/250001/Source/modules/app_banner/BeforeInstallPromptEvent.cpp#newcode60 Source/modules/app_banner/BeforeInstallPromptEvent.cpp:60: ScriptPromise BeforeInstallPromptEvent::prompt(ScriptState* scriptState) I think we don't need ScriptPromiseProperty ...
5 years, 4 months ago (2015-07-30 06:43:32 UTC) #23
dominickn
On 2015/07/30 06:37:45, yhirano wrote: > Reopen, as this CL was reverted. > > The ...
5 years, 4 months ago (2015-08-03 00:44:05 UTC) #24
yhirano
On 2015/08/03 00:44:05, dominickn wrote: > On 2015/07/30 06:37:45, yhirano wrote: > > I think ...
5 years, 4 months ago (2015-08-03 02:30:56 UTC) #25
dominickn
On 2015/08/03 02:30:56, yhirano wrote: > On 2015/08/03 00:44:05, dominickn wrote: > > On 2015/07/30 ...
5 years, 4 months ago (2015-08-03 02:45:54 UTC) #26
dominickn
PTAL, thanks. https://codereview.chromium.org/1247283004/diff/250001/Source/modules/app_banner/BeforeInstallPromptEvent.cpp File Source/modules/app_banner/BeforeInstallPromptEvent.cpp (right): https://codereview.chromium.org/1247283004/diff/250001/Source/modules/app_banner/BeforeInstallPromptEvent.cpp#newcode60 Source/modules/app_banner/BeforeInstallPromptEvent.cpp:60: ScriptPromise BeforeInstallPromptEvent::prompt(ScriptState* scriptState) On 2015/07/30 06:43:31, yhirano ...
5 years, 4 months ago (2015-08-03 04:15:03 UTC) #27
yhirano
lgtm, thanks.
5 years, 4 months ago (2015-08-03 04:32:12 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1247283004/270001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1247283004/270001
5 years, 4 months ago (2015-08-04 00:20:48 UTC) #31
commit-bot: I haz the power
Committed patchset #12 (id:270001) as https://src.chromium.org/viewvc/blink?view=rev&revision=199926
5 years, 4 months ago (2015-08-04 00:24:15 UTC) #32
commit-bot: I haz the power
5 years, 3 months ago (2015-09-23 11:47:16 UTC) #33
Message was sent while issue was closed.
Patchset 12 (id:??) landed as
https://crrev.com/8a7809f1e7eef498eab9f99f15e53a876b0ae9be

Powered by Google App Engine
This is Rietveld 408576698