Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Issue 391068: Add Blob API

Created:
11 years, 1 month ago by ry
Modified:
11 years, 1 month ago
CC:
v8-dev
Visibility:
Public.

Description

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/api.cc View 3 chunks +51 lines, -0 lines 3 comments Download
M test/cctest/test-api.cc View 1 chunk +33 lines, -0 lines 1 comment Download

Messages

Total messages: 5 (0 generated)
ry
Hi Christian, Is this on the right track? What do you think about the GetAddress() ...
11 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 ...
11 years, 1 month ago (2009-11-16 12:12:22 UTC) #2
ry
On 2009/11/16 12:12:22, Christian Plesner Hansen wrote: > Except for giving out a derived pointer ...
11 years, 1 month ago (2009-11-16 12:32:00 UTC) #3
ry
Thinking about this some more, I suppose just using an External is probably best. I ...
11 years, 1 month ago (2009-11-16 12:54:38 UTC) #4
Christian Plesner Hansen
11 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.
Could
> 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
pass
> 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 408576698