Bug 156367

Summary: Modern IDB (Blob support): Support retrieving Blobs from IDB
Product: WebKit Reporter: Brady Eidson <beidson>
Component: WebCore Misc.Assignee: Brady Eidson <beidson>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, commit-queue
Priority: P2    
Version: Safari 9   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 149117, 143193    
Attachments:
Description Flags
Patch v1
none
Patch v2 none

Description Brady Eidson 2016-04-07 14:33:37 PDT
Modern IDB (Blob support): Support retrieving Blobs from IDB
Comment 1 Brady Eidson 2016-04-13 14:16:30 PDT
Created attachment 276353 [details]
Patch v1
Comment 2 Alex Christensen 2016-04-13 16:25:14 PDT
Comment on attachment 276353 [details]
Patch v1

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

> Source/WebCore/Modules/indexeddb/server/MemoryIndexCursor.cpp:78
> +        Vector<String> dummyBlobURLs, dummyBlobFiles;

Can't you just use { } instead of these?

> Source/WebCore/Modules/indexeddb/server/MemoryObjectStoreCursor.cpp:192
> +    Vector<String> dummyBlobURLs, dummyBlobFiles;

Ditto

> Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:1053
> +        ThreadSafeDataBuffer valueBuffer = value ? value->data() : ThreadSafeDataBuffer();

More { }

> Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:1810
> +            getResult = { cursor->currentValue() ? *cursor->currentValue() : IDBValue(), cursor->currentPrimaryKey() };

{}

> Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp:106
> +    result = { m_currentKey, m_currentPrimaryKey, m_currentValue ? *m_currentValue : IDBValue() };

{}

> Source/WebCore/bindings/js/IDBBindingUtilities.cpp:457
> +        return Deprecated::ScriptValue();

{}

> Source/WebCore/bindings/js/SerializedScriptValue.cpp:1788
>              return 0;

These should be false

> Source/WebCore/bindings/js/SerializedScriptValue.cpp:2433
> +        for (; i < m_blobURLs.size(); ++i) {

Could this be a map, so we don't need to iterate?

> Source/WebCore/fileapi/ThreadableBlobRegistry.cpp:108
> +        queue = new MessageQueue<CrossThreadTask>;

Would NeverDestroyed work here?
Comment 3 Brady Eidson 2016-04-13 16:47:33 PDT
(In reply to comment #2)
> Comment on attachment 276353 [details]
> Patch v1
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=276353&action=review
> 
> > Source/WebCore/Modules/indexeddb/server/MemoryIndexCursor.cpp:78
> > +        Vector<String> dummyBlobURLs, dummyBlobFiles;
> 
> Can't you just use { } instead of these?
> 
> > Source/WebCore/Modules/indexeddb/server/MemoryObjectStoreCursor.cpp:192
> > +    Vector<String> dummyBlobURLs, dummyBlobFiles;
> 
> Ditto

Yup.

> > Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:1053
> > +        ThreadSafeDataBuffer valueBuffer = value ? value->data() : ThreadSafeDataBuffer();
> 
> More { }
> 
> > Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:1810
> > +            getResult = { cursor->currentValue() ? *cursor->currentValue() : IDBValue(), cursor->currentPrimaryKey() };
> 
> {}
> 
> > Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp:106
> > +    result = { m_currentKey, m_currentPrimaryKey, m_currentValue ? *m_currentValue : IDBValue() };
> 
> {}

Nope. Can't use initializer lists in the ternary operator.

"Initializer list cannot be used on the right hand side of operator '?'"

> > Source/WebCore/bindings/js/IDBBindingUtilities.cpp:457
> > +        return Deprecated::ScriptValue();
> 
> {}

Yup.

> > Source/WebCore/bindings/js/SerializedScriptValue.cpp:1788
> >              return 0;
> 
> These should be false

There's lots of "integer-as-bool" in this file. Should probably be cleaned up at once.

> > Source/WebCore/bindings/js/SerializedScriptValue.cpp:2433
> > +        for (; i < m_blobURLs.size(); ++i) {
> 
> Could this be a map, so we don't need to iterate?
> 
> > Source/WebCore/fileapi/ThreadableBlobRegistry.cpp:108
> > +        queue = new MessageQueue<CrossThreadTask>;
> 
> Would NeverDestroyed work here?

A cursory glance at all of our call_once initializers suggests we do "new", "malloc", "CFCreate...", "...alloc] init..." inside without bothering with neverdestroyed.

There's definitely no static initializer problem here, so I'm not sure what the point is.
Comment 4 Brady Eidson 2016-04-13 16:48:08 PDT
Created attachment 276365 [details]
Patch v2
Comment 5 WebKit Commit Bot 2016-04-13 17:54:03 PDT
Comment on attachment 276365 [details]
Patch v2

Clearing flags on attachment: 276365

Committed r199524: <http://trac.webkit.org/changeset/199524>
Comment 6 WebKit Commit Bot 2016-04-13 17:54:06 PDT
All reviewed patches have been landed.  Closing bug.