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

Issue 619583004: BatteryManager: release promise resolver once resolved. (Closed)

Created:
6 years, 2 months ago by sof
Modified:
6 years, 2 months ago
CC:
blink-reviews, timvolodine
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

BatteryManager: release promise resolver once resolved. Do not retain the Promise resolver any longer than necessary. This prevents a reported document leak for detached frame uses of navigator.getBattery(). R=haraken BUG=385384 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=182921

Patch Set 1 #

Patch Set 2 : Clear fresh resolved-resolver also #

Unified diffs Side-by-side diffs Delta from patch set Stats (+7 lines, -18 lines) Patch
A + LayoutTests/battery-status/no-leak-on-detached-use.html View 2 chunks +3 lines, -16 lines 0 comments Download
A + LayoutTests/battery-status/no-leak-on-detached-use-expected.txt View 1 chunk +2 lines, -2 lines 0 comments Download
M Source/modules/battery/BatteryManager.cpp View 1 2 chunks +2 lines, -0 lines 0 comments Download

Messages

Total messages: 15 (3 generated)
sof
Please take a look. (fast/dom/navigator-{with-content-}detached-no-crash.html have been continually showing up in local leak reports when ...
6 years, 2 months ago (2014-09-30 11:41:26 UTC) #2
haraken
LGTM (It would be great if we could have a way to catch this kind ...
6 years, 2 months ago (2014-09-30 12:05:31 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/619583004/20001
6 years, 2 months ago (2014-09-30 12:14:37 UTC) #6
yhirano
Calling resolve releases the associated resource, so I don't understand why this CL reduces a ...
6 years, 2 months ago (2014-09-30 12:15:20 UTC) #7
sof
On 2014/09/30 12:15:20, yhirano wrote: > Calling resolve releases the associated resource, so I don't ...
6 years, 2 months ago (2014-09-30 12:20:34 UTC) #8
yhirano
On 2014/09/30 12:20:34, sof wrote: > On 2014/09/30 12:15:20, yhirano wrote: > > Calling resolve ...
6 years, 2 months ago (2014-09-30 12:21:58 UTC) #9
commit-bot: I haz the power
Committed patchset #2 (id:20001) as 182921
6 years, 2 months ago (2014-09-30 13:19:41 UTC) #10
haraken
On 2014/09/30 12:21:58, yhirano wrote: > On 2014/09/30 12:20:34, sof wrote: > > On 2014/09/30 ...
6 years, 2 months ago (2014-09-30 14:07:01 UTC) #11
sof
On 2014/09/30 14:07:01, haraken wrote: > On 2014/09/30 12:21:58, yhirano wrote: > > On 2014/09/30 ...
6 years, 2 months ago (2014-09-30 14:29:43 UTC) #12
yhirano
On 2014/09/30 14:29:43, sof wrote: > On 2014/09/30 14:07:01, haraken wrote: > > On 2014/09/30 ...
6 years, 2 months ago (2014-10-01 01:58:33 UTC) #13
yhirano
On 2014/10/01 01:58:33, yhirano wrote: > On 2014/09/30 14:29:43, sof wrote: > > On 2014/09/30 ...
6 years, 2 months ago (2014-10-02 02:29:51 UTC) #14
sof
6 years, 2 months ago (2014-10-02 05:05:13 UTC) #15
Message was sent while issue was closed.
On 2014/10/02 02:29:51, yhirano wrote:
> On 2014/10/01 01:58:33, yhirano wrote:
> > On 2014/09/30 14:29:43, sof wrote:
> > > On 2014/09/30 14:07:01, haraken wrote:
> > > > On 2014/09/30 12:21:58, yhirano wrote:
> > > > > On 2014/09/30 12:20:34, sof wrote:
> > > > > > On 2014/09/30 12:15:20, yhirano wrote:
> > > > > > > Calling resolve releases the associated resource, so I don't
> > understand
> > > > why
> > > > > > this
> > > > > > > CL reduces a leak.
> > > > > > 
> > > > > > Does it clear the ScriptState ?
> > > > > 
> > > > > No, but IIUC having a ScriptState doesn't lead to leak.
> > > > > If my understanding is wrong, we should clear it in resolve() /
> reject().
> > > > 
> > > > Right. Not clearing ScriptState shouldn't cause leaks. ScriptState just
> has
> > a
> > > > weak pointer to a V8 context.
> > > > 
> > > > Although ScriptState has another strong pointer to the V8 context (via
> > > > ScriptState::m_perContextData), the strong pointer is explicitly cleared
> > when
> > > > the context is disposed (in WindowProxy::disposeContext).
> > > 
> > > The two leaking tests are now passes,
> > >
> >
>
https://storage.googleapis.com/chromium-layout-test-archives/WebKit_Linux_Lea...
> > 
> > I wrote a unittest at https://codereview.chromium.org/621623002/ . That
passes
> > on my local environment (without oilpan).
> > Having a ScriptState seems not a problem in the test. What do you think?
> 
> Proposed a fix: https://codereview.chromium.org/622733002/

Good, let's robustify all users of ScriptPromiseResolver.

Powered by Google App Engine
This is Rietveld 408576698