Bug 127401

Summary: IDB: Support "put"
Product: WebKit Reporter: Brady Eidson <beidson>
Component: WebKit2Assignee: Brady Eidson <beidson>
Status: RESOLVED FIXED    
Severity: Normal CC: alecflett, andersca, ap, bunhere, commit-queue, gyuyoung.kim, jsbell, rakuco, sam, thorton
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 124521    
Attachments:
Description Flags
Patch v1
ap: review+
EWS run to check the builds
none
Maybe fix EWS builds none

Description Brady Eidson 2014-01-21 20:32:49 PST
IDB: Support "put"

In radar as <rdar://problem/15779643>
Comment 1 Brady Eidson 2014-01-21 22:36:48 PST
Created attachment 221829 [details]
Patch v1
Comment 2 WebKit Commit Bot 2014-01-21 22:38:10 PST
Attachment 221829 [details] did not pass style-queue:


ERROR: Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:409:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
ERROR: Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:410:  More than one command on the same line  [whitespace/newline] [4]
ERROR: Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.h:80:  The parameter name "key" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.h:122:  The parameter name "key" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/WebCore/Modules/indexeddb/IDBKeyData.cpp:78:  Non-label code inside switch statements should be indented.  [whitespace/indent] [4]
ERROR: Source/WebKit2/DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.h:78:  The parameter name "key" adds no information, so it should be removed.  [readability/parameter_name] [5]
Total errors found: 6 in 29 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Alexey Proskuryakov 2014-01-22 13:56:56 PST
Comment on attachment 221829 [details]
Patch v1

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

Please fix non-Mac builds.

> Source/WebCore/Modules/indexeddb/IDBKeyData.cpp:13
> + * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY

I'm not sure if these headers are correct. Did you get it from webkit.org?

This says "Apple Inc." in copyright line, but "APPLE, INC." with a comma inside.

> Source/WebCore/Modules/indexeddb/IDBKeyData.cpp:69
> +PassRefPtr<IDBKey> IDBKeyData::maybeCreateIDBKey() const

maybe?

> Source/WebKit2/DatabaseProcess/IndexedDB/IDBSerialization.cpp:57
> +RefPtr<WebCore::SharedBuffer> serializeIDBKey(const WebCore::IDBKey& key)

We should have "using namespace WebCore" in this file if we don't yet.

> Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:396
> +void UniqueIDBDatabase::putRecord(const IDBTransactionIdentifier& identifier, int64_t objectStoreID, const WebCore::IDBKeyData& keyData, const IPC::DataReference& value, int64_t putMode, const Vector<int64_t>& indexIDs, const Vector<Vector<WebCore::IDBKeyData>>& indexKeys, std::function<void(const IDBKeyData&, uint32_t, const String&)> callback)

Ditto.

> Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:409
> +    }, [this, callback]() {

Hopefully something protects "this" while the request is in progress.

> Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:528
> +    // FIXME: The LevelDB post performs "makeIndexWriters" here. Necessary?

"post" looks like a typo.
Comment 4 Brady Eidson 2014-01-22 14:44:28 PST
(In reply to comment #3)
> (From update of attachment 221829 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=221829&action=review
> 
> Please fix non-Mac builds.
> 
> > Source/WebCore/Modules/indexeddb/IDBKeyData.cpp:13
> > + * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY
> 
> I'm not sure if these headers are correct. Did you get it from webkit.org?
> 
> This says "Apple Inc." in copyright line, but "APPLE, INC." with a comma inside.

Grabbed from another newly added file.  I see there's subtle variations floating around, not sure if any are canonical.  I removed the comma.

> 
> > Source/WebCore/Modules/indexeddb/IDBKeyData.cpp:69
> > +PassRefPtr<IDBKey> IDBKeyData::maybeCreateIDBKey() const
> 
> maybe?

Definitely might return nullptr to represent a null IDBKey
> 
> > Source/WebKit2/DatabaseProcess/IndexedDB/IDBSerialization.cpp:57
> > +RefPtr<WebCore::SharedBuffer> serializeIDBKey(const WebCore::IDBKey& key)
> 
> We should have "using namespace WebCore" in this file if we don't yet.

Okay!


> > Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:396
> > +void UniqueIDBDatabase::putRecord(const IDBTransactionIdentifier& identifier, int64_t objectStoreID, const WebCore::IDBKeyData& keyData, const IPC::DataReference& value, int64_t putMode, const Vector<int64_t>& indexIDs, const Vector<Vector<WebCore::IDBKeyData>>& indexKeys, std::function<void(const IDBKeyData&, uint32_t, const String&)> callback)
> 
> Ditto.

Okay!

> > Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:409
> > +    }, [this, callback]() {
> 
> Hopefully something protects "this" while the request is in progress.

Yup, the connection outlives requests.

> > Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:528
> > +    // FIXME: The LevelDB post performs "makeIndexWriters" here. Necessary?
> 
> "post" looks like a typo.

Because it is!  s/post/port/

Thanks!
Comment 5 Brady Eidson 2014-01-22 14:47:08 PST
Created attachment 221906 [details]
EWS run to check the builds
Comment 6 WebKit Commit Bot 2014-01-22 14:49:26 PST
Attachment 221906 [details] did not pass style-queue:


ERROR: Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:409:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
Total errors found: 1 in 33 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Brady Eidson 2014-01-22 15:13:42 PST
Created attachment 221914 [details]
Maybe fix EWS builds
Comment 8 WebKit Commit Bot 2014-01-22 15:15:31 PST
Attachment 221914 [details] did not pass style-queue:


ERROR: Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabase.cpp:409:  Place brace on its own line for function definitions.  [whitespace/braces] [4]
Total errors found: 1 in 33 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Brady Eidson 2014-01-22 15:44:45 PST
http://trac.webkit.org/changeset/162566