[webkit-dev] FileAPI/FileWriter support
kinuko at chromium.org
Thu Mar 25 11:57:42 PDT 2010
On Thu, Mar 25, 2010 at 12:44 PM, Dmitry Titov <dimich at chromium.org> wrote:
> I'm curious what the ByteStore object is for? While reading the document,
> I've got an impression that BlobBuilder would store all content of the blob
> under construction in that store, 'realizing' the parts (encoding the
> strings into utf-8 and reading the files underlying Blobs). It seems to be
> better to avoid 'realizing' the separate strings/blobs until the very end
> (basically, until the bits are needed for actual XHR.send() or
> FileWriter.write()), otherwise BlobBuilder.append() becomes a synchronous
> "read whole file" operation.
I agree that 'realizing' should be avoided until the very end, and I'm
thinking to make BlobBuilder behave like that.
In my rough plan / early prototype, ByteStore represents an internal buffer
that can grow while Blob represents a 'snapshot' of a buffer.
A Blob can have either one of a file, a ByteStore or a list of Blobs
(described below) as its backing store and there can be multiple Blobs with
different (start, length) for a same ByteStore.
BlobBuilder holds a list of references of what have been appended. In
typical cases it has a list of Blobs, and it returns a special form of Blob
called CombinedBlob, that holds a list of Blobs as its backing store (so at
that point the data is still not in its 'realized' format).
In simpler cases it may just store only one ByteStore, and it just returns a
plain Blob snapshot for the ByteStore.
When we need to get the contents of a Blob, we read out its contents and
'realize' it as an actual bytes array, so this should occur really at the
end of the process. If a Blob was of CombinedBlob we recursively call its
'read' method to get the data. (This design was largely inspired by that of
Does that sound make sense? Any suggestions would be appreciated.
> On Wed, Mar 24, 2010 at 5:42 PM, Kinuko Yasuda <kinuko at chromium.org>wrote:
>> Hi webkit-dev folks,
>> I'm working on FileAPI/FileWriter support and would like to start making
>> changes / send patches for the work.
>> Our initial target platform is chromium and many of the changes will only
>> touch files under platform/chromium, but I will also change existing
>> Blob/File code and will add some modules in WebCore for async file
>> Here's the design doc (implementation plan) for FileWriter:
>> The plan/design is not concrete yet and any feedbacks are more than
>> To start with, I'm planning to open a new meta issue for FileWriter (will
>> also update webkit.org/b/32624) and start submitting changes in small
>> pieces whenever possible.
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-dev