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

Issue 311733004: Introduce KeepAliveWhilePending to ScriptPromiseResolverWithContext. (Closed)

Created:
6 years, 6 months ago by yhirano
Modified:
6 years, 6 months ago
CC:
blink-reviews, blink-reviews-dom_chromium.org, dglazkov+blink, sof, eae+blinkwatch, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/blink.git@refactor-webmidi-initialization
Visibility:
Public.

Description

Introduce KeepAliveWhilePending to ScriptPromiseResolverWithContext. Some modules, for example WebMIDI and WebCrypto, needs "Async Initializer". The initializer should stay alive until the initialization succeeds (i.e. the associated Promise is resolved), the initialization fails (i.e. rejected), or the associated ExecutionContext is stopped. This CL introduces the the constructor mode ScriptPromiseResolverWithContext. If KeepAliveWhilePending is specified, the created resolver stays alive while one of the above conditions meets. Each initializer can stay alive by inheriting ScriptPromiseResolverWithContext. This CL rewrites WebMIDI and WebCrypto async operations with it. BUG=361041 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=176381 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=176403

Patch Set 1 #

Patch Set 2 : #

Total comments: 2

Patch Set 3 : rebase #

Patch Set 4 : #

Total comments: 2

Patch Set 5 : #

Total comments: 2

Patch Set 6 : #

Patch Set 7 : #

Total comments: 8

Patch Set 8 : #

Total comments: 21

Patch Set 9 : #

Patch Set 10 : #

Patch Set 11 : #

Patch Set 12 : #

Patch Set 13 : #

Total comments: 10

Patch Set 14 : #

Patch Set 15 : #

Total comments: 6

Patch Set 16 : #

Total comments: 10

Patch Set 17 : #

Patch Set 18 : #

Total comments: 10

Patch Set 19 : #

Patch Set 20 : rebase #

Patch Set 21 : #

Patch Set 22 : relaxAdoptionRequirement is gone #

Total comments: 2

Patch Set 23 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+198 lines, -295 lines) Patch
M Source/bindings/v8/ScriptPromiseResolverWithContext.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 5 chunks +14 lines, -0 lines 0 comments Download
M Source/bindings/v8/ScriptPromiseResolverWithContext.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 3 chunks +32 lines, -2 lines 0 comments Download
M Source/modules/crypto/CryptoResultImpl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 3 chunks +3 lines, -3 lines 0 comments Download
M Source/modules/crypto/CryptoResultImpl.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 3 chunks +49 lines, -128 lines 0 comments Download
M Source/modules/webmidi/MIDIAccess.h View 1 2 3 4 5 6 3 chunks +11 lines, -15 lines 0 comments Download
M Source/modules/webmidi/MIDIAccess.cpp View 1 2 3 4 5 3 chunks +14 lines, -34 lines 0 comments Download
M Source/modules/webmidi/MIDIAccessInitializer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 chunks +30 lines, -23 lines 0 comments Download
M Source/modules/webmidi/MIDIAccessInitializer.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 chunks +43 lines, -88 lines 0 comments Download
M Source/modules/webmidi/NavigatorWebMIDI.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 51 (0 generated)
yhirano
kouhei: Can you take a look at this CL? This CL is still WIP but ...
6 years, 6 months ago (2014-06-05 05:47:58 UTC) #1
kouhei (in TOK)
cc:haraken I'm still looking
6 years, 6 months ago (2014-06-05 05:55:18 UTC) #2
yhirano
Kouhei told me that we can use Persistent to avoid the destruct-in-iteration problem. PS4 doesn't ...
6 years, 6 months ago (2014-06-05 07:50:02 UTC) #3
kouhei (in TOK)
https://codereview.chromium.org/311733004/diff/20001/Source/core/dom/AsyncInitializerResolver.h File Source/core/dom/AsyncInitializerResolver.h (right): https://codereview.chromium.org/311733004/diff/20001/Source/core/dom/AsyncInitializerResolver.h#newcode39 Source/core/dom/AsyncInitializerResolver.h:39: static WeakPtr<AsyncInitializerResolver<T> > create(ScriptState* scriptState) Is this used? https://codereview.chromium.org/311733004/diff/60001/Source/core/dom/AsyncInitializerResolver.h ...
6 years, 6 months ago (2014-06-05 07:54:47 UTC) #4
yhirano
https://codereview.chromium.org/311733004/diff/60001/Source/core/dom/AsyncInitializerResolver.h File Source/core/dom/AsyncInitializerResolver.h (right): https://codereview.chromium.org/311733004/diff/60001/Source/core/dom/AsyncInitializerResolver.h#newcode111 Source/core/dom/AsyncInitializerResolver.h:111: Persistent<Holder> m_protect; On 2014/06/05 07:54:47, kouhei wrote: > Why ...
6 years, 6 months ago (2014-06-05 09:09:18 UTC) #5
yhirano
Now it's ready for review. PTAL. https://codereview.chromium.org/311733004/diff/20001/Source/core/dom/AsyncInitializerResolver.h File Source/core/dom/AsyncInitializerResolver.h (right): https://codereview.chromium.org/311733004/diff/20001/Source/core/dom/AsyncInitializerResolver.h#newcode39 Source/core/dom/AsyncInitializerResolver.h:39: static WeakPtr<AsyncInitializerResolver<T> > ...
6 years, 6 months ago (2014-06-06 07:40:48 UTC) #6
yhirano
Eric, I once commented that I would provide some helper mechanism for a lifecycle issue ...
6 years, 6 months ago (2014-06-06 07:49:17 UTC) #7
eroman
Thanks yhirano! The use in WebCrypto looks good, and is a nice improvement over what ...
6 years, 6 months ago (2014-06-06 19:02:39 UTC) #8
yhirano
On 2014/06/06 19:02:39, eroman wrote: > Thanks yhirano! The use in WebCrypto looks good, and ...
6 years, 6 months ago (2014-06-09 05:07:41 UTC) #9
yhirano
kouhei, haraken: PTAL
6 years, 6 months ago (2014-06-10 08:27:13 UTC) #10
haraken
This is a very general question, but why do we need to limit the usage ...
6 years, 6 months ago (2014-06-10 10:54:59 UTC) #11
yhirano
https://codereview.chromium.org/311733004/diff/80001/Source/core/dom/AsyncInitializerResolver.h File Source/core/dom/AsyncInitializerResolver.h (right): https://codereview.chromium.org/311733004/diff/80001/Source/core/dom/AsyncInitializerResolver.h#newcode92 Source/core/dom/AsyncInitializerResolver.h:92: Persistent<Holder> m_protect; On 2014/06/10 10:54:59, haraken wrote: > > ...
6 years, 6 months ago (2014-06-11 06:54:28 UTC) #12
yhirano
I discussed with haraken offline and changed the design. I added ScriptPromiseResolverWithContext::keepObjectWhilePending. And now this ...
6 years, 6 months ago (2014-06-12 11:02:51 UTC) #13
haraken
https://codereview.chromium.org/311733004/diff/140001/Source/modules/webmidi/MIDIAccessInitializer.cpp File Source/modules/webmidi/MIDIAccessInitializer.cpp (right): https://codereview.chromium.org/311733004/diff/140001/Source/modules/webmidi/MIDIAccessInitializer.cpp#newcode26 Source/modules/webmidi/MIDIAccessInitializer.cpp:26: m_resolver->keepObjectWhilePending(navigator); I'm fine with this approach overall. Another (probably ...
6 years, 6 months ago (2014-06-12 15:58:53 UTC) #14
jrummell
drive-by comment. https://codereview.chromium.org/311733004/diff/140001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp File Source/bindings/v8/ScriptPromiseResolverWithContext.cpp (right): https://codereview.chromium.org/311733004/diff/140001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp#newcode114 Source/bindings/v8/ScriptPromiseResolverWithContext.cpp:114: ScriptPromise promise = this->promise(); The comment for ...
6 years, 6 months ago (2014-06-12 20:10:25 UTC) #15
eroman
https://codereview.chromium.org/311733004/diff/140001/Source/modules/crypto/CryptoResultImpl.h File Source/modules/crypto/CryptoResultImpl.h (right): https://codereview.chromium.org/311733004/diff/140001/Source/modules/crypto/CryptoResultImpl.h#newcode39 Source/modules/crypto/CryptoResultImpl.h:39: ExceptionCode webCryptoErrorToExceptionCode(blink::WebCryptoErrorType); Since this file has been essentially renamed ...
6 years, 6 months ago (2014-06-13 01:52:53 UTC) #16
rafaelw
https://codereview.chromium.org/311733004/diff/120001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp File Source/bindings/v8/ScriptPromiseResolverWithContext.cpp (right): https://codereview.chromium.org/311733004/diff/120001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp#newcode116 Source/bindings/v8/ScriptPromiseResolverWithContext.cpp:116: v8Promise->DeleteHiddenValue(name); Haraken is probably more authoritative on this than ...
6 years, 6 months ago (2014-06-13 02:36:17 UTC) #17
haraken
https://codereview.chromium.org/311733004/diff/120001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp File Source/bindings/v8/ScriptPromiseResolverWithContext.cpp (right): https://codereview.chromium.org/311733004/diff/120001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp#newcode116 Source/bindings/v8/ScriptPromiseResolverWithContext.cpp:116: v8Promise->DeleteHiddenValue(name); > Haraken is probably more authoritative on this ...
6 years, 6 months ago (2014-06-13 03:36:53 UTC) #18
yhirano
Thank you for the review. I made SubtleCrypto::PendingResult GarbageCollectedFinalized. I hope the code get easier ...
6 years, 6 months ago (2014-06-13 04:19:30 UTC) #19
haraken
https://codereview.chromium.org/311733004/diff/120001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp File Source/bindings/v8/ScriptPromiseResolverWithContext.cpp (right): https://codereview.chromium.org/311733004/diff/120001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp#newcode103 Source/bindings/v8/ScriptPromiseResolverWithContext.cpp:103: v8Promise->SetHiddenValue(name, value); Consider using helper methods in V8HiddenValue.h instead ...
6 years, 6 months ago (2014-06-13 05:03:52 UTC) #20
yhirano
https://codereview.chromium.org/311733004/diff/120001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp File Source/bindings/v8/ScriptPromiseResolverWithContext.cpp (right): https://codereview.chromium.org/311733004/diff/120001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp#newcode103 Source/bindings/v8/ScriptPromiseResolverWithContext.cpp:103: v8Promise->SetHiddenValue(name, value); On 2014/06/13 05:03:51, haraken wrote: > > ...
6 years, 6 months ago (2014-06-13 11:15:22 UTC) #21
haraken
I'm sorry about iterative comments! https://codereview.chromium.org/311733004/diff/240001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp File Source/bindings/v8/ScriptPromiseResolverWithContext.cpp (right): https://codereview.chromium.org/311733004/diff/240001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp#newcode14 Source/bindings/v8/ScriptPromiseResolverWithContext.cpp:14: const char hiddenPropertyName[] = ...
6 years, 6 months ago (2014-06-13 14:23:31 UTC) #22
yhirano
For the design comment: > - It seems that MIDIAccessInitializer is kept alive as long ...
6 years, 6 months ago (2014-06-13 15:18:13 UTC) #23
haraken
On 2014/06/13 15:18:13, yhirano wrote: > For the design comment: > > - It seems ...
6 years, 6 months ago (2014-06-13 15:28:58 UTC) #24
yhirano
haraken: PTAL?
6 years, 6 months ago (2014-06-16 04:19:49 UTC) #25
haraken
This looks much simpler! LGTM for overall design and bindings/. https://codereview.chromium.org/311733004/diff/280001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp File Source/bindings/v8/ScriptPromiseResolverWithContext.cpp (right): https://codereview.chromium.org/311733004/diff/280001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp#newcode84 ...
6 years, 6 months ago (2014-06-16 10:54:04 UTC) #26
yhirano
https://codereview.chromium.org/311733004/diff/280001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp File Source/bindings/v8/ScriptPromiseResolverWithContext.cpp (right): https://codereview.chromium.org/311733004/diff/280001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp#newcode84 Source/bindings/v8/ScriptPromiseResolverWithContext.cpp:84: RefPtr<ScriptPromiseResolverWithContext> protect(this); On 2014/06/16 10:54:04, haraken wrote: > > ...
6 years, 6 months ago (2014-06-16 11:47:51 UTC) #27
yhirano
toyoshim, eroman, can you take a look at the CL if you have time? Thanks ...
6 years, 6 months ago (2014-06-16 11:48:43 UTC) #28
eroman
LGTM for webcrypto side! https://codereview.chromium.org/311733004/diff/300001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp File Source/bindings/v8/ScriptPromiseResolverWithContext.cpp (right): https://codereview.chromium.org/311733004/diff/300001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp#newcode89 Source/bindings/v8/ScriptPromiseResolverWithContext.cpp:89: deref(); Is it possible for ...
6 years, 6 months ago (2014-06-16 19:36:36 UTC) #29
eroman
https://codereview.chromium.org/311733004/diff/300001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp File Source/bindings/v8/ScriptPromiseResolverWithContext.cpp (right): https://codereview.chromium.org/311733004/diff/300001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp#newcode23 Source/bindings/v8/ScriptPromiseResolverWithContext.cpp:23: ref(); When I run this patch in debug mode ...
6 years, 6 months ago (2014-06-16 20:05:50 UTC) #30
eroman
https://codereview.chromium.org/311733004/diff/300001/Source/modules/crypto/CryptoResultImpl.cpp File Source/modules/crypto/CryptoResultImpl.cpp (right): https://codereview.chromium.org/311733004/diff/300001/Source/modules/crypto/CryptoResultImpl.cpp#newcode54 Source/modules/crypto/CryptoResultImpl.cpp:54: static WeakPtr<ScriptPromiseResolverWithContext> create(ScriptState* scriptState) This additionally needs to call ...
6 years, 6 months ago (2014-06-16 20:57:08 UTC) #31
yhirano
https://codereview.chromium.org/311733004/diff/300001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp File Source/bindings/v8/ScriptPromiseResolverWithContext.cpp (right): https://codereview.chromium.org/311733004/diff/300001/Source/bindings/v8/ScriptPromiseResolverWithContext.cpp#newcode23 Source/bindings/v8/ScriptPromiseResolverWithContext.cpp:23: ref(); On 2014/06/16 20:05:50, eroman wrote: > When I ...
6 years, 6 months ago (2014-06-17 01:45:44 UTC) #32
Takashi Toyoshima
LGTM with nits https://codereview.chromium.org/311733004/diff/340001/Source/modules/webmidi/MIDIAccessInitializer.cpp File Source/modules/webmidi/MIDIAccessInitializer.cpp (right): https://codereview.chromium.org/311733004/diff/340001/Source/modules/webmidi/MIDIAccessInitializer.cpp#newcode33 Source/modules/webmidi/MIDIAccessInitializer.cpp:33: ASSERT(controller); On this ASSERT(), See a ...
6 years, 6 months ago (2014-06-17 05:10:08 UTC) #33
yhirano
https://codereview.chromium.org/311733004/diff/340001/Source/modules/webmidi/MIDIAccessInitializer.cpp File Source/modules/webmidi/MIDIAccessInitializer.cpp (right): https://codereview.chromium.org/311733004/diff/340001/Source/modules/webmidi/MIDIAccessInitializer.cpp#newcode33 Source/modules/webmidi/MIDIAccessInitializer.cpp:33: ASSERT(controller); On 2014/06/17 05:10:08, Takashi Toyoshima (chromium) wrote: > ...
6 years, 6 months ago (2014-06-17 08:28:06 UTC) #34
Takashi Toyoshima
LGTM!
6 years, 6 months ago (2014-06-17 09:14:08 UTC) #35
yhirano
The CQ bit was checked by yhirano@chromium.org
6 years, 6 months ago (2014-06-18 01:02:35 UTC) #36
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yhirano@chromium.org/311733004/380001
6 years, 6 months ago (2014-06-18 01:03:23 UTC) #37
yhirano
The CQ bit was checked by yhirano@chromium.org
6 years, 6 months ago (2014-06-18 01:53:37 UTC) #38
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yhirano@chromium.org/311733004/400001
6 years, 6 months ago (2014-06-18 01:54:49 UTC) #39
yhirano
The CQ bit was checked by yhirano@chromium.org
6 years, 6 months ago (2014-06-18 01:59:16 UTC) #40
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yhirano@chromium.org/311733004/420001
6 years, 6 months ago (2014-06-18 01:59:27 UTC) #41
commit-bot: I haz the power
Change committed as 176381
6 years, 6 months ago (2014-06-18 03:03:43 UTC) #42
yhirano
A revert of this CL has been created in https://codereview.chromium.org/339443004/ by yhirano@chromium.org. The reason for ...
6 years, 6 months ago (2014-06-18 03:19:39 UTC) #43
jamesr
A revert of this CL has been created in https://codereview.chromium.org/338373005/ by jamesr@chromium.org. The reason for ...
6 years, 6 months ago (2014-06-18 04:13:29 UTC) #44
yhirano
reopen. relaxAdoptionRequirement is removed.
6 years, 6 months ago (2014-06-18 06:40:33 UTC) #45
yhirano
I added ScriptPromiseResolverWithContext::keepAliveWhilePending and removed the constructor parameter, because relaxAdoptionRequirement was removed in a recent ...
6 years, 6 months ago (2014-06-18 06:43:33 UTC) #46
haraken
LGTM for ScriptPromiseResolverWithContext. https://codereview.chromium.org/311733004/diff/440001/Source/bindings/v8/ScriptPromiseResolverWithContext.h File Source/bindings/v8/ScriptPromiseResolverWithContext.h (right): https://codereview.chromium.org/311733004/diff/440001/Source/bindings/v8/ScriptPromiseResolverWithContext.h#newcode89 Source/bindings/v8/ScriptPromiseResolverWithContext.h:89: enum LifeMode { LifetimeMode ?
6 years, 6 months ago (2014-06-18 06:56:01 UTC) #47
yhirano
https://codereview.chromium.org/311733004/diff/440001/Source/bindings/v8/ScriptPromiseResolverWithContext.h File Source/bindings/v8/ScriptPromiseResolverWithContext.h (right): https://codereview.chromium.org/311733004/diff/440001/Source/bindings/v8/ScriptPromiseResolverWithContext.h#newcode89 Source/bindings/v8/ScriptPromiseResolverWithContext.h:89: enum LifeMode { On 2014/06/18 06:56:01, haraken wrote: > ...
6 years, 6 months ago (2014-06-18 07:03:34 UTC) #48
yhirano
The CQ bit was checked by yhirano@chromium.org
6 years, 6 months ago (2014-06-18 07:03:45 UTC) #49
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/yhirano@chromium.org/311733004/460001
6 years, 6 months ago (2014-06-18 07:04:13 UTC) #50
commit-bot: I haz the power
6 years, 6 months ago (2014-06-18 08:44:03 UTC) #51
Message was sent while issue was closed.
Change committed as 176403

Powered by Google App Engine
This is Rietveld 408576698