Bug 140108

Summary: Add a DatabaseProvider subclass in WebKit2 and use it for IndexedDB
Product: WebKit Reporter: Anders Carlsson <andersca>
Component: New BugsAssignee: Anders Carlsson <andersca>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch darin: review+

Description Anders Carlsson 2015-01-05 17:36:48 PST
Add a DatabaseProvider subclass in WebKit2 and use it for IndexedDB
Comment 1 Anders Carlsson 2015-01-05 17:40:45 PST
Created attachment 244023 [details]
Patch
Comment 2 Darin Adler 2015-01-05 20:16:11 PST
Comment on attachment 244023 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=244023&action=review

> Source/WebKit2/WebProcess/Databases/WebDatabaseProvider.cpp:44
> +RefPtr<WebDatabaseProvider> WebDatabaseProvider::getOrCreate(uint64_t identifier)

Why not use Ref for the return value instead of RefPtr since it’s never null?

> Source/WebKit2/WebProcess/Databases/WebDatabaseProvider.cpp:50
> +    RefPtr<WebDatabaseProvider> storageNamespaceProvider = adoptRef(new WebDatabaseProvider(identifier));

Why not use Ref for this instead of RefPtr since it’s never null?

> Source/WebKit2/WebProcess/Databases/WebDatabaseProvider.h:42
> +    RefPtr<WebCore::IDBFactoryBackendInterface> createIDBFactoryBackend() override;

I think you should include "virtual" here.
Comment 3 Darin Adler 2015-01-05 20:16:34 PST
Comment on attachment 244023 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=244023&action=review

> Source/WebKit2/WebProcess/WebPage/WebPage.cpp:375
> +    pageConfiguration.databaseProvider = WebDatabaseProvider::getOrCreate(m_pageGroup->pageGroupID());

What guarantees this ID won’t be 0 or -1?
Comment 4 Anders Carlsson 2015-01-06 08:49:59 PST
(In reply to comment #3)
> Comment on attachment 244023 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=244023&action=review
> 
> > Source/WebKit2/WebProcess/WebPage/WebPage.cpp:375
> > +    pageConfiguration.databaseProvider = WebDatabaseProvider::getOrCreate(m_pageGroup->pageGroupID());
> 
> What guarantees this ID won’t be 0 or -1?

The page group ID will never be null, it's decided by the UI process. (In the future, we won't use the page group ID for this but an ID representing the website data store).

I'll make the Ref changes you suggested, thanks!
Comment 5 Anders Carlsson 2015-01-06 08:54:18 PST
Committed r177960: <http://trac.webkit.org/changeset/177960>