WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
105572
IndexedDB: Use non-const buffers in put() to avoid copies
https://bugs.webkit.org/show_bug.cgi?id=105572
Summary
IndexedDB: Use non-const buffers in put() to avoid copies
Alec Flett
Reported
2012-12-20 13:35:41 PST
IndexedDB: Use non-const buffers in put() to avoid copies
Attachments
Patch
(15.49 KB, patch)
2012-12-20 13:38 PST
,
Alec Flett
no flags
Details
Formatted Diff
Diff
Patch
(16.47 KB, patch)
2013-01-02 12:00 PST
,
Alec Flett
no flags
Details
Formatted Diff
Diff
Patch for landing
(16.45 KB, patch)
2013-01-02 15:28 PST
,
Alec Flett
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Alec Flett
Comment 1
2012-12-20 13:38:29 PST
Created
attachment 180401
[details]
Patch
Alec Flett
Comment 2
2012-12-20 13:40:06 PST
jsbell@ - quick lgtm - this is the const-ness issue we talked about this morning. This will allow async operations to hold onto the buffer while letting the caller return.
WebKit Review Bot
Comment 3
2012-12-20 13:42:32 PST
Please wait for approval from
abarth@webkit.org
,
dglazkov@chromium.org
,
fishd@chromium.org
,
jamesr@chromium.org
or
tkent@chromium.org
before submitting, as this patch contains changes to the Chromium public API. See also
https://trac.webkit.org/wiki/ChromiumWebKitAPI
.
Joshua Bell
Comment 4
2012-12-20 13:44:00 PST
Does LGTM and I don't have any better suggestions. (Perhaps others will.)
Alec Flett
Comment 5
2012-12-20 14:10:07 PST
dglazgov@ - r? The issue here is that the implementation of put() on the other side of these interfaces wants to hold onto the value for use at a later time. i.e. the buffer inside of 'value' needs to outlive the call to put() in the first place. So we need the incoming 'value' to be non-const so that the implementation can adopt value's buffer rather than copying it. (Also welcome to other suggestions here...)
Alec Flett
Comment 6
2012-12-20 14:10:32 PST
ugh my fingers can't spell - make that dglazkov@ - r?
Darin Fisher (:fishd, Google)
Comment 7
2012-12-20 15:12:48 PST
This may just be a personal thing, but when giving someone a reference to memory to hold on to for some time, I find pointers to be helpful from a readability point of view. In WebKit, I'm only really accustomed to seeing non-const references used for in/out or out parameters. It may also be helpful to document the lifetime expectations somehow.
Alec Flett
Comment 8
2013-01-02 12:00:48 PST
Created
attachment 181043
[details]
Patch
Alec Flett
Comment 9
2013-01-02 12:04:03 PST
fishd@ - good point. Switched to Vector<uint8_t>* abarth@ - r? (fishd and dglazkov are unavailable but this is pretty straightforward)
Adam Barth
Comment 10
2013-01-02 12:14:32 PST
Comment on
attachment 181043
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=181043&action=review
> Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp:169 > + Vector<uint8_t> valueBuffer(value->size()); > + valueBuffer.append(value->data(), value->size()); > + m_databaseBackend->put(transactionId, objectStoreId, &valueBuffer, key, static_cast<IDBDatabaseBackendInterface::PutMode>(putMode), IDBCallbacksProxy::create(adoptPtr(callbacks)), indexIds, indexKeys);
OK. Obviously the backend can't hold on to it for too long given that it's allocated on the stack here.
Peter Beverloo (cr-android ews)
Comment 11
2013-01-02 12:24:13 PST
Comment on
attachment 181043
[details]
Patch
Attachment 181043
[details]
did not pass cr-android-ews (chromium-android): Output:
http://queues.webkit.org/results/15635519
Alec Flett
Comment 12
2013-01-02 15:28:07 PST
Created
attachment 181083
[details]
Patch for landing
WebKit Review Bot
Comment 13
2013-01-02 15:50:16 PST
Comment on
attachment 181083
[details]
Patch for landing Clearing flags on attachment: 181083 Committed
r138666
: <
http://trac.webkit.org/changeset/138666
>
WebKit Review Bot
Comment 14
2013-01-02 15:50:20 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug