Re: [v8-users] Exposing nested maps from C++ into JS world

2016-07-29 Thread Abhishek Singh
Thanks much, now things work as expected. Looking back, I think if I were 
thinking bit more openly it would have been an easy pattern to figure out. 

> On 29-Jul-2016, at 12:04 PM, Jochen Eisinger  wrote:
> 
> I commented on the example
> 
> On Thu, Jul 28, 2016 at 2:14 PM Abhishek Singh  > wrote:
> Please find standalone code simulating your suggestion - 
> https://gist.github.com/abhi-bit/d3a2910ec54a47ce8294c2cc0c4bef93 
>  (In the 
> comment pasted output in my case). Will appreciate if you could guide using 
> this test script.
> 
> 
>> On 28-Jul-2016, at 4:05 PM, Abhishek Singh > > wrote:
>> 
>> I believe this is the change you wanted me to do:
>> 
>> Local HTTPBody::WrapHTTPBodyMap() {
>>   EscapableHandleScope handle_scope(GetIsolate());
>> 
>>   Local body_map_template = 
>> FunctionTemplate::New(GetIsolate());
>>   body_map_template->InstanceTemplate()->SetHandler(
>>   NamedPropertyHandlerConfiguration(NULL, HTTPBodySet));
>>   body_map_template->InstanceTemplate()->SetInternalFieldCount(1);
>>   Local result = body_map_template->GetFunction()->NewInstance();
>> 
>>   Local map_ptr = External::New(GetIsolate(), &http_body);
>> 
>>   result->SetInternalField(0, map_ptr);
>> 
>>   return handle_scope.Escape(result);
>> }
>> 
>> This didn’t help. I’ll share a standalone program that simulates problem I 
>> see, maybe that would help you to see what the problem could be? Would be 
>> some bit of effort for me, but will do given it will be very useful to have 
>> nested c++ maps exposed to JS.
>> 
>>> On 28-Jul-2016, at 12:54 PM, Jochen Eisinger >> > wrote:
>>> 
>>> I guess you should use function templates here.
>>> 
>>> Local body_map_template = FunctionTemplate::New(isolate);
>>> body_map_template->InstanceTemplate()->SetHandler(...)
>>> body_map_template->InstanceTemplate()->SetInternalFieldCount(1);
>>> result = body_map_template->GetFunction()->NewInstance();
>>> 
>>> On Wed, Jul 27, 2016 at 4:27 PM Abhishek Singh >> > wrote:
>>> Hi Jochen,
>>> 
>>> Full code of relevant file available - http://pastebin.com/fZJENvSi 
>>> 
>>> 
>>> Snippet of relevant portions for WrapHTTPBodyMap:
>>> 
>>> Local HTTPBody::MakeHTTPBodyMapTemplate(
>>> Isolate* isolate) {
>>>   EscapableHandleScope handle_scope(isolate);
>>> 
>>>   Local result = ObjectTemplate::New(isolate);
>>>   result->SetInternalFieldCount(1);
>>>   result->SetHandler(NamedPropertyHandlerConfiguration(NULL,
>>>HTTPBodySet));
>>> 
>>>   return handle_scope.Escape(result);
>>> }
>>> 
>>> Local HTTPBody::WrapHTTPBodyMap() {
>>>   EscapableHandleScope handle_scope(GetIsolate());
>>> 
>>>   if (http_body_map_template_.IsEmpty()) {
>>> Local raw_template = 
>>> MakeHTTPBodyMapTemplate(GetIsolate());
>>> http_body_map_template_.Reset(GetIsolate(), raw_template);
>>>   }
>>>   Local templ =
>>>   Local::New(GetIsolate(), http_body_map_template_);
>>> 
>>>   Local result =
>>>   
>>> templ->NewInstance(GetIsolate()->GetCurrentContext()).ToLocalChecked();
>>> 
>>>   Local map_ptr = External::New(GetIsolate(), &http_body);
>>> 
>>>   result->SetInternalField(0, map_ptr);
>>> 
>>>   return handle_scope.Escape(result);
>>> }
>>> 
>>> 
 On 27-Jul-2016, at 7:47 PM, Jochen Eisinger >>> > wrote:
 
 Can you provide a complete example? I suspect that WrapHTTPBodyMap doesn't 
 do what you expect it does
 
 On Tue, Jul 26, 2016 at 1:04 PM Abhishek Singh 
 mailto:singhabhishek@gmail.com>> wrote:
 Would you mind guiding me a bit here? For now just trying to expose nested 
 “body” map i.e. to allow something like “response.body.result = 
 dbQueryResult"
 
 First is the Set interceptor for “response” (C++ object) and here I’m 
 setting up “body” (C++ object for “body”) & setting return value to “body” 
 object. Second one is Set interceptor for “body”
 
 void HTTPResponse::HTTPResponseSet(Local name, Local 
 value_obj,
const PropertyCallbackInfo& 
 info) {
   if (name->IsSymbol()) return;
 
   V8Handle* w = UnwrapV8HandleInstance(info.Holder());
   HTTPBody* body = new HTTPBody(w);
 
   Local body_map = body->WrapHTTPBodyMap();
   info.GetReturnValue().Set(body_map);
 }
 
 
 void HTTPBody::HTTPBodySet(Local name, Local value_obj,
const PropertyCallbackInfo& info) {
   if (name->IsSymbol()) return;
 
   string key = ObjectToString(Local::Cast(name));
   string value = ToString(info.GetIsolate(), value_obj);
 
   map* body = UnwrapMap(info.Holder());
   (*body)[key] = value;
 
   cout << "body field " << 

Re: [v8-users] How do I attach a debugger to the run-time?

2016-07-29 Thread Zac Hansen
It'd be great to get at least a best-effort which half-year this might come 
in.   I don't know what "some time" means to you.   late 2016 is quite a 
bit different than late 2017 for my needs.

Thank you.

--Zac

On Thursday, July 21, 2016 at 11:06:51 PM UTC-7, Abhishek Singh wrote:
>
> Any tentative timeline around when v8-inspector support is going to be 
> available within V8? We are embedding V8 into server side JS programming 
> against a DB and intend to provide remote debugger support for JS code, 
> rough idea about debuggability support from V8 would be useful to know.
>
> On 21-Jul-2016, at 10:56 AM, Yang Guo > 
> wrote:
>
> There is currently no good way to do it. We are migrating towards using 
> v8-inspector, which node.js already uses. That way you can use the same 
> debugging protocol as Chrome DevTools. It won't be ready for some time 
> though.
>
> On Monday, July 18, 2016 at 4:29:31 AM UTC+2, Zac Hansen wrote:
>>
>> https://github.com/v8/v8/wiki/Debugging%20Protocol
>>
>> The message based API is no longer maintained. Please ask in 
>> v8-u...@googlegroups.com if you want to attach a debugger to the 
>> run-time.
>>
>>
>> Thank you.
>>
>> --Zac
>>
>
> -- 
> -- 
> 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.


Re: [v8-users] v8 gyp build fail

2016-07-29 Thread chaony
yeah, after I installed curl, problem solved, thanks!

在 2016年7月29日星期五 UTC+8下午1:36:03,Jochen Eisinger写道:
>
> I wonder whether you have curl installed?
>
> On Thu, Jul 28, 2016 at 6:53 PM chaony > 
> wrote:
>
>> Hi, 
>> I want to try v8 engine in my project, but it seems something wrong. 
>> I do it in following way:
>>
>> 1. git clone: git clone 
>> https://chromium.googlesource.com/chromium/tools/depot_tools.git
>> 2. export path: export PATH=`pwd`/depot_tools:"$PATH”
>> 3. fetch v8 with error:
>>
>> fetch v8
>> Running: gclient root
>> Running: gclient config --spec 'solutions = [
>>   {
>> "managed": False,
>> "name": "v8",
>> "url": "https://chromium.googlesource.com/v8/v8.git";,
>> "custom_deps": {},
>> "deps_file": "DEPS",
>> "safesync_url": "",
>>   },
>> ]
>> '
>> Running: gclient sync --with_branch_heads
>> Error: Command '/usr/bin/python 
>> v8/build/linux/sysroot_scripts/install-sysroot.py --running-as-hook' 
>> returned non-zero exit status 1 in /root
>> Traceback (most recent call last):
>>   File "/root/depot_tools/fetch.py", line 353, in 
>> sys.exit(main())
>>   File "/root/depot_tools/fetch.py", line 348, in main
>> return run(options, spec, root)
>>   File "/root/depot_tools/fetch.py", line 342, in run
>> return checkout.init()
>>   File "/root/depot_tools/fetch.py", line 142, in init
>> self.run_gclient(*sync_cmd)
>>   File "/root/depot_tools/fetch.py", line 76, in run_gclient
>> return self.run(cmd_prefix + cmd, **kwargs)
>>   File "/root/depot_tools/fetch.py", line 66, in run
>> return subprocess.check_output(cmd, **kwargs)
>>   File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
>> raise CalledProcessError(retcode, cmd, output=output)
>> subprocess.CalledProcessError: Command '('gclient', 'sync', 
>> '--with_branch_heads')' returned non-zero exit status 2
>>
>> 4. Then I try gclient sync
>>
>> Running depot tools as root is sad.
>> .gclient file in parent directory /root might not be the file you want to 
>> use
>> Syncing projects: 100% (22/22), done.
>>
>>  running '/usr/bin/python v8/gypfiles/landmines.py' in '/root'
>>
>>  running 'download_from_google_storage --no_resume 
>> --platform=win32 --no_auth --bucket chromium-clang-format -s 
>> v8/buildtools/win/clang-format.exe.sha1' in '/root'
>> The current platform doesn't match "win32", skipping.
>>
>>  running 'download_from_google_storage --no_resume 
>> --platform=darwin --no_auth --bucket chromium-clang-format -s 
>> v8/buildtools/mac/clang-format.sha1' in '/root'
>> The current platform doesn't match "darwin", skipping.
>>
>>  running 'download_from_google_storage --no_resume 
>> --platform=linux* --no_auth --bucket chromium-clang-format -s 
>> v8/buildtools/linux64/clang-format.sha1' in '/root'
>> 0> File v8/buildtools/linux64/clang-format exists and SHA1 matches. 
>> Skipping.
>> Success!
>> Downloading 1 files took 0.004160 second(s)
>>
>>  running '/usr/bin/python 
>> v8/tools/gcmole/download_gcmole_tools.py' in '/root'
>> Skipping gcmole download as gcmole is not set in gyp flags.
>>
>>  running '/usr/bin/python 
>> v8/tools/jsfunfuzz/download_jsfunfuzz.py' in '/root'
>> Skipping jsfunfuzz download as jsfunfuzz is not set in gyp flags.
>>
>>  running 'download_from_google_storage --no_resume 
>> --platform=win32 --no_auth --bucket chromium-luci -d 
>> v8/tools/luci-go/win64' in '/root'
>> The current platform doesn't match "win32", skipping.
>>
>>  running 'download_from_google_storage --no_resume 
>> --platform=darwin --no_auth --bucket chromium-luci -d 
>> v8/tools/luci-go/mac64' in '/root'
>> The current platform doesn't match "darwin", skipping.
>>
>>  running 'download_from_google_storage --no_resume 
>> --platform=linux* --no_auth --bucket chromium-luci -d 
>> v8/tools/luci-go/linux64' in '/root'
>>
>> ▽
>> 0> File v8/tools/luci-go/linux64/isolate exists and SHA1 matches. 
>> Skipping.
>> Success!
>> Downloading 1 files took 0.023040 second(s)
>>
>>  running 'download_from_google_storage --no_resume 
>> --platform=win32 --no_auth --bucket chromium-gn -s 
>> v8/buildtools/win/gn.exe.sha1' in '/root'
>> The current platform doesn't match "win32", skipping.
>>
>>  running 'download_from_google_storage --no_resume 
>> --platform=darwin --no_auth --bucket chromium-gn -s 
>> v8/buildtools/mac/gn.sha1' in '/root'
>> The current platform doesn't match "darwin", skipping.
>>
>>  running 'download_from_google_storage --no_resume 
>> --platform=linux* --no_auth --bucket chromium-gn -s 
>> v8/buildtools/linux64/gn.sha1' in '/root'
>> 0> File v8/buildtools/linux64/gn exists and SHA1 matches. Skipping.
>> Success!
>> Downloading 1 files took 0.004107 second(s)
>>
>>  running '/usr/bin/python 
>> v8/build/linux/sysroot_scripts/install-sysroot.py --running-as-hook' in 
>> '/root'
>> Installing Debian Wheezy amd64 root image: 
>> /root/v8/build/linux/debian_wh