Re: [v8-users] Arraybuffer

2018-09-04 Thread Graham Reeves
> is std::numeric_limits 

::max 
();
 
referring to the max unsigned int value ? cause the source code won't find 
it 
Yes, that's the maximum value unsigned (an unsigned int) can be, but what 
do you mean by, the source won't find it?

On Monday, 3 September 2018 19:55:48 UTC+1, dan Med wrote:
>
> Can someone help me out?
>
> Il giorno sab 1 set 2018 alle ore 15:30 > 
> ha scritto:
>
>> array_buffer_builder.cc in src /
>> third_party /blink 
>> /renderer 
>> /
>> platform 
>> 
>> /wtf 
>> 
>> /typed_arrays 
>> 
>> /array_buffer_builder.cc 
>> 
>>  
>> the ArrayBufferBuilder 
>> 
>> ::Append 
>> 
>>  method 
>> will be called through a view on top of the arraybuffer? something like, 
>> there's a arraybuffer of 30bytes in length and we define a view on top of 
>> it (so a typedarray) wehn i call on the new typedarray object the .append 
>> method it will call ArrayBufferBuilder 
>> 
>> ::Append 
>> 
>>   
>> and then inside it's code it will execute ArrayBufferBuilder 
>> 
>> ::ExpandCapacity 
>> 
>>  if 
>> it needs to reallocate the array ?
>>
>> if so inside the expandCapacity definition bytes_used 
>> 
>>  referes 
>> to the elements inside the actual arraybuffer so if i have a arraybuffer 
>> which is 8 bytes in length [ ][ ][ ][ ][ ][ ][ ][ ] and i fill in only 3 
>> bytes so 
>> [1][2][3][ ][ ][ ][ ][ ] the bytes_used 
>> 
>>  when 
>> retrieved will be set to 3 bytes ??
>>
>> ArrayBufferBuilder 
>> ::ArrayBufferBuilder
>>  
>> ()
>> : bytes_used_ 
>> (0),
>>  variable_capacity_ 
>> 

Re: [v8-users] Help

2018-09-04 Thread Graham Reeves
memcpy is this
memcpy( writable_destination, const_source, length_in_bytes )

if you're unsure what it's doing, expand the arguments so the code is more 
readable (shame on whoever wrote this :)
memcpy(static_cast(buffer_->Data()) + bytes_used_, 
data,bytes_to_save);
...
auto* Destination = static_cast(buffer_->Data()); // start of buffer
Destination += bytes_used_; // offset from the start, same as Destination = 
[bytes_used_];
memcpy(Destination, data, bytes_to_save );

So to answer your question;

> with this memcpy is it copying from data which is a const char pointer n 
bytes_to_save into the array buffer_
No, it's copying the number of bytes *bytes_to_save* FROM *data* (from the 
start)

>  into a specific offset from the array 
yes, into a specific offset from the start of the array *Buffer->Data*

This isn't a v8 specific question, so you may get a better response for 
general C/++ questions on http://www.stackoverflow.com :)


On Monday, 3 September 2018 19:55:35 UTC+1, dan Med wrote:
>
> Can someone help me out ?
>
> Il giorno dom 2 set 2018 alle ore 11:26 > 
> ha scritto:
>
>>  memcpy(static_cast(buffer_->Data()) + bytes_used_, 
>> data,bytes_to_save);
>>
>> with this memcpy is it copying from data which is a const char pointer n 
>> bytes_to_save into the array buffer_ or into a specific offset from the 
>> array ?
>>
>> -- 
>> -- 
>> v8-users mailing list
>> v8-u...@googlegroups.com 
>> http://groups.google.com/group/v8-users
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "v8-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to v8-users+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[v8-users] Re: Calling method on Persistent

2018-09-02 Thread Graham Reeves
There's no ->/dereference operator in Persistent<> in 7.0, so maybe it was 
removed for safety. (forcing it to be referenced from a local, and 
therefore inside a handle scope)

I went from 5.5 to 7.0 without having to change any code here, but anywhere 
I set the internal field is via a Local.

Can you get the local from the persistent and then set it?

On Friday, 31 August 2018 06:07:53 UTC+1, Mike Moening wrote:
>
> I've upgraded from a slightly older version of V8.
>
> I can no longer do this with a Persistent
>
> *obj->SetInternalField(0, External::New(pIsolate, ));*
>
> *error C2039: 'SetInternalField': is not a member of 
> 'v8::Persistent>'*
> *1>with*
> *1>[*
> *1>T=v8::Object*
> *1>]*
>
> Seems the -> operator is no longer available on persistent?
>
> How can I accomplish this with newest V8?
>
> Thanks!
> Mike
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[v8-users] ChromeDevTools connected to Inspector, but error responses... missing native JS functions?

2018-08-27 Thread Graham Reeves
Through various sources (ie, googling & github) I've finally got a bit of a 
grasp of the flow for connecting chrome dev tools to my v8 app. (which is 
using a pretty recent HEAD build I've built myself with all default 
settings other than compiling as a static lib[s]. v8-version.h says 7.0.0.0)

I connect via an explicit url (can't quite get json/list/ to show up in 
chrome yet)
*chrome-devtools://devtools/bundled/inspector.html?experiments=true=true=127.0.0.1:8008*
(Not sure how relevant the v8only=true and experiments=true are, couldn't 
find any documentation on this)

This connects to my websocket, and I pass all messages straight to 
*Session->dispatchProtocolMessage*

My channel then gets *sendResponse's* in return, which I send back to 
chrome over my websocket.

Chrome dev tools shows essentially an empty debugger, no sources, no 
console output, no errors...

The responses my isolate/context sends back, suggest maybe I have some JS 
symbols/modules missing, which maybe I need to implement?
I'm kinda assuming this, as the debugger. methods succeed, but things like 
*Inspector.enable* (which I haven't found anyone implementing, but some 
people are implementing Inspector objects, just with different methods) fail

*Chrome tools message: {"id":16,"method":"Inspector.enable"}*

*Channel response: {"error":{"code":-32601,"message":"'Inspector.enable' 
wasn't found"},"id":16}*
Is this why chrome isn't proceeding with anything?
Am I supposed to implement these, or perhaps are they missing from my 
native blobs when I built my v8 libraries?

My overloads of the inspector client functions like *runMessageLoopOnPause* 
aren't 
being called, but I assume that's just because I haven't gotten to any 
stage where commands are being evaluated?

Below is what I get when I connect chrome, but then it just sits there :)

Thanks for any pointers in the right direction!

*Chrome tools message: 
{"id":1,"method":"Network.enable","params":{"maxPostDataSize":65536}}*

*Channel response: {"error":{"code":-32601,"message":"'Network.enable' 
wasn't found"},"id":1}*

*Chrome tools message: {"id":2,"method":"Page.enable"}*

*Channel response: {"error":{"code":-32601,"message":"'Page.enable' wasn't 
found"},"id":2}*

*Chrome tools message: {"id":3,"method":"Page.getResourceTree"}*

*Chrome tools message: {"id":4,"method":"Profiler.enable"}*

*Channel response: 
{"error":{"code":-32601,"message":"'Page.getResourceTree' wasn't 
found"},"id":3}*

*Channel response: {"id":4,"result":{}}*

*Chrome tools message: {"id":5,"method":"Runtime.enable"}*

*Channel response: 
{"method":"Runtime.executionContextCreated","params":{"context":{"id":1,"origin":"","name":"PopEngineContextName"}}}*

*Channel response: {"id":5,"result":{}}*

*Chrome tools message: {"id":6,"method":"Debugger.enable"}*

*Channel response: 
{"method":"Debugger.scriptParsed","params":{"scriptId":"9","url":"","startLine":0,"startColumn":0,"endLine":1,"endColumn":0,"executionContextId":1,"hash":"2a70962568dbbde00fb323decd63c2ca137b304c","isLiveEdit":false,"sourceMapURL":"","hasSourceURL":false,"isModule":false,"length":17}}*

*Channel response: 
{"id":6,"result":{"debuggerId":"(6B1A58050CBFAE70E5B41C5556E5520D)"}}*

*Chrome tools message: 
{"id":7,"method":"Debugger.setPauseOnExceptions","params":{"state":"uncaught"}}*

*Channel response: {"id":7,"result":{}}*

*Chrome tools message: 
{"id":8,"method":"Debugger.setAsyncCallStackDepth","params":{"maxDepth":32}}*

*Channel response: {"id":8,"result":{}}*

*Chrome tools message: {"id":9,"method":"DOM.enable"}*

*Channel response: {"error":{"code":-32601,"message":"'DOM.enable' wasn't 
found"},"id":9}*

*Chrome tools message: {"id":10,"method":"CSS.enable"}*

*Channel response: {"error":{"code":-32601,"message":"'CSS.enable' wasn't 
found"},"id":10}*

*Chrome tools message: {"id":11,"method":"Overlay.enable"}*

*Channel response: {"error":{"code":-32601,"message":"'Overlay.enable' 
wasn't found"},"id":11}*

*Chrome tools message: 
{"id":12,"method":"Overlay.setShowViewportSizeOnResize","params":{"show":true}}*

*Channel response: 
{"error":{"code":-32601,"message":"'Overlay.setShowViewportSizeOnResize' 
wasn't found"},"id":12}*

*Chrome tools message: {"id":13,"method":"Log.enable"}*

*Channel response: {"error":{"code":-32601,"message":"'Log.enable' wasn't 
found"},"id":13}*

*Chrome tools message: 
{"id":14,"method":"Log.startViolationsReport","params":{"config":[{"name":"longTask","threshold":200},{"name":"longLayout","threshold":30},{"name":"blockedEvent","threshold":100},{"name":"blockedParser","threshold":-1},{"name":"handler","threshold":150},{"name":"recurringHandler","threshold":50},{"name":"discouragedAPIUse","threshold":-1}]}}*

*Channel response: 
{"error":{"code":-32601,"message":"'Log.startViolationsReport' wasn't 
found"},"id":14}*

*Chrome tools message: {"id":15,"method":"ServiceWorker.enable"}*

*Channel response: 
{"error":{"code":-32601,"message":"'ServiceWorker.enable' wasn't 
found"},"id":15}*