Bug 49313 - IndexedDB: signal IDBFactoryBackendInterface destruction to embedder
Summary: IndexedDB: signal IDBFactoryBackendInterface destruction to embedder
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Hans Wennborg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-10 03:11 PST by Hans Wennborg
Modified: 2010-11-11 10:42 PST (History)
6 users (show)

See Also:


Attachments
Patch (6.03 KB, patch)
2010-11-10 03:17 PST, Hans Wennborg
no flags Details | Formatted Diff | Diff
Patch (6.14 KB, patch)
2010-11-11 06:14 PST, Hans Wennborg
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hans Wennborg 2010-11-10 03:11:41 PST
IndexedDB: signal IDBFactoryBackendInterface destruction to embedder
Comment 1 Hans Wennborg 2010-11-10 03:17:58 PST
Created attachment 73480 [details]
Patch
Comment 2 Andrei Popescu 2010-11-10 03:46:19 PST
LGTM
Comment 3 Jeremy Orlow 2010-11-10 07:31:18 PST
Why is this signal needed?  The factory only goes away when webkit is shutting down.  I'm surprised this is useful.
Comment 4 Hans Wennborg 2010-11-10 07:55:24 PST
(In reply to comment #3)
> Why is this signal needed?  The factory only goes away when webkit is shutting down.

That's what we want to detect.

This seemed like a relatively clean way of piping it through to the BrowserWebKitClientImpl on the Chromium side, which is what we're trying to reach. Do you see a better way?
Comment 5 Jeremy Orlow 2010-11-10 10:55:54 PST
Why is chromiums factories lifetime related to that of a factory in the renderer?  I mean the browsers factory likely outlives them all.  Note also that we need to make sure that we handle lifetimes correctly when the renderer crashes (which we do not at the moment, iirc)--which I feel would make this unnecessary as well.  Can you please explain the bigger picture here?
Comment 6 Andrei Popescu 2010-11-10 11:05:16 PST
(In reply to comment #5)
> Why is chromiums factories lifetime related to that of a factory in the renderer?  I mean the browsers factory likely outlives them all.  Note also that we need to make sure that we handle lifetimes correctly when the renderer crashes (which we do not at the moment, iirc)--which I feel would make this unnecessary as well.  Can you please explain the bigger picture here?


Umm, this is backend code so it runs in the browser not the renderer process. Renderer crashes don't really affect matter here, right? We just want to stop the utility process cleanly when the indexed database shuts down.

Andrei
Comment 7 Jeremy Orlow 2010-11-10 11:12:13 PST
Oops, you're right...was mixed up.  The object store objects don't hold a ref to the factory though, which means that it could go away before were done with the utility process, right?
Comment 8 Hans Wennborg 2010-11-11 06:12:07 PST
(In reply to comment #7)
> Oops, you're right...was mixed up.
Adding a comment trying to make it less confusing.

> The object store objects don't hold a ref to the factory though, which means that it could go away before were done with the utility process, right?

The destruction of the factory happens after the IndexedDBDispatcherHost (in Chromium) is destructed, so I don't think any more IndexedDB activity could continue after that point - it should be fine to tell the utility process to stop at this point.
Comment 9 Hans Wennborg 2010-11-11 06:14:11 PST
Created attachment 73604 [details]
Patch
Comment 10 Jeremy Orlow 2010-11-11 06:16:25 PST
(In reply to comment #8)
> (In reply to comment #7)
> > Oops, you're right...was mixed up.
> Adding a comment trying to make it less confusing.
> 
> > The object store objects don't hold a ref to the factory though, which means that it could go away before were done with the utility process, right?
> 
> The destruction of the factory happens after the IndexedDBDispatcherHost (in Chromium) is destructed, so I don't think any more IndexedDB activity could continue after that point - it should be fine to tell the utility process to stop at this point.

Then why does Chromium require this signal?  Can't we just shut it down when the dispatcher host shuts down?

Also, this is true today, but in the future when we have background threads and such this assumption probably won't hold unless the dispatcher doesn't go away until all running transactions and such have ended.
Comment 11 Hans Wennborg 2010-11-11 06:47:25 PST
(In reply to comment #10)
> (In reply to comment #8)
> > (In reply to comment #7)
> > > Oops, you're right...was mixed up.
> > Adding a comment trying to make it less confusing.
> > 
> > > The object store objects don't hold a ref to the factory though, which means that it could go away before were done with the utility process, right?
> > 
> > The destruction of the factory happens after the IndexedDBDispatcherHost (in Chromium) is destructed, so I don't think any more IndexedDB activity could continue after that point - it should be fine to tell the utility process to stop at this point.
> 
> Then why does Chromium require this signal?

It's the cleanest solution to what we're trying to do in http://codereview.chromium.org/4678002/

> Can't we just shut it down when the dispatcher host shuts down?

We tried that at first, but didn't see a good way of getting from the dispatcher host to the WebKitClient.

This solution feels natural in the way that the WebKitClient (in this case BrowserWebKitClient impl on the Chromium side) gets a call from WebKit saying all the IDB stuff is done and shutting down so it can stop the utility process. Receiving calls from WebKit is what the WebKitClient does; trying to call it from somewhere else seems less clean.

> Also, this is true today, but in the future when we have background threads and such this assumption probably won't hold unless the dispatcher doesn't go away until all running transactions and such have ended.

The IDBTransactionCoordinator is destructed before the factory, so at this point I suppose all transactions should have finished.
Comment 12 Jeremy Orlow 2010-11-11 06:58:55 PST
Comment on attachment 73604 [details]
Patch

r=me

Still not convinced this is the best way, but I can't think of a better one.
Comment 13 Hans Wennborg 2010-11-11 09:35:33 PST
Comment on attachment 73604 [details]
Patch

Clearing flags on attachment: 73604

Committed r71829: <http://trac.webkit.org/changeset/71829>
Comment 14 Hans Wennborg 2010-11-11 09:35:42 PST
All reviewed patches have been landed.  Closing bug.
Comment 15 WebKit Review Bot 2010-11-11 10:42:59 PST
http://trac.webkit.org/changeset/71829 might have broken Leopard Intel Release (Tests)
The following tests are not passing:
media/video-played-collapse.html
media/video-played-ranges-1.html
media/video-played-reset.html