Chromium Code Reviews
Help | Chromium Project | Gerrit Changes | Sign in

Issue 391068: Add Blob API

8 years, 1 month ago by ry
8 years, 1 month ago


Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+126 lines, -0 lines) Patch
M include/v8.h View 4 chunks +36 lines, -0 lines 0 comments Download
M src/api.h View 4 chunks +6 lines, -0 lines 0 comments Download
M src/ View 3 chunks +51 lines, -0 lines 3 comments Download
M test/cctest/ View 1 chunk +33 lines, -0 lines 1 comment Download
Trybot results:


Total messages: 5 (0 generated)
Hi Christian, Is this on the right track? What do you think about the GetAddress() ...
8 years, 1 month ago (2009-11-14 19:43:00 UTC) #1
Christian Plesner Hansen
I agree that SetIndexedPropertiesToExternalArrayData which was introduced only a few weeks ago is probably closer ...
8 years, 1 month ago (2009-11-16 12:12:22 UTC) #2
On 2009/11/16 12:12:22, Christian Plesner Hansen wrote: > Except for giving out a derived pointer ...
8 years, 1 month ago (2009-11-16 12:32:00 UTC) #3
Thinking about this some more, I suppose just using an External is probably best. I ...
8 years, 1 month ago (2009-11-16 12:54:38 UTC) #4
Christian Plesner Hansen
8 years, 1 month ago (2009-11-16 13:05:03 UTC) #5
> So, I'm trying to avoid a memcpy. I'd like to be able to recv() directly into
> the V8 heap. As long as no V8 functions are called, the GC shouldn't run.
> a method like this be exposed if it was surrounded by a big scary warning and
> combined with safer WriteBytes() and ReadBytes() methods?

So far we've resisted the temptation to allow unsafe operations.  We could also
have used something like this for strings in the chromium binding layer but
decided against it then, and I don't see that changing.

> SetIndexedPropertiesToExternalArrayData() is not ideal because I'd like to
> the data through V8, then have a C++ handler unwrap the data and access it
> again. (My use case is a TCP socket which receives data, passes it through V8,
> to a C-language HTTP parser.)

Unless the backing array has a life completely separate of the JS object it's
used in I don't know what prevents that.  You can make the backing array
available from the JS object and grab it when you need it in C++.

> Ideally I could use recv() into V8 Blob, pass it via Javascript to the parser,
> which could unwrap and parse the data without ever copying the data.

Our experience has been that memcpy usually isn't a bottleneck but that depends
on your application.

Powered by Google App Engine
This is Rietveld 0eb02b776