Page 1 of 1

Implementing V8 snapshot feature in CEF

PostPosted: Fri Apr 28, 2017 1:35 am
by Panneerselvam
Hi,
I have a CEF based app running for sometime. Now, I would like to add V8 snapshot functionality in the app. As part of the implementation, i need to get access to following v8 functions:
v8::CreateSnapshotDataBlob
v8::ScriptCompiler
Can you please let me know, how to access these functions from CEF environment?
Thanks!!!

Re: Implementing V8 snapshot feature in CEF

PostPosted: Sat Apr 29, 2017 12:13 pm
by Czarek
CEF doesn't expose such functionality. You would need to hack CEF sources.

Re: Implementing V8 snapshot feature in CEF

PostPosted: Tue May 02, 2017 5:26 am
by Panneerselvam
Thanks, Is there a plan to add in the future? Are you aware of any existing PR for this feature?

Re: Implementing V8 snapshot feature in CEF

PostPosted: Tue May 02, 2017 8:11 am
by Czarek
Not aware of. Search the tracker to be sure.

Re: Implementing V8 snapshot feature in CEF

PostPosted: Tue May 02, 2017 11:09 am
by magreenblatt
Presumably you're interested in V8 snapshots because you read this article about Electron: http://blog.atom.io/2017/04/18/improvin ... -time.html

As noted in that article it is difficult to use V8 snapshot functionality correctly (you can't access the DOM) and any potential benefits depend a lot on the structure of the HTML/JS/CSS involved. For example, in Electron's case most of their performance gain came from improving their JavaScript "require" implementation and from optimizing CSS files. Those are both things that could be accomplished without the use of V8 snapshots.

Since usage is difficult and any potential performance benefits can likely be achieved by other means there are no plans to expose V8 snapshot functionality in CEF at this time.

Re: Implementing V8 snapshot feature in CEF

PostPosted: Thu May 04, 2017 10:25 am
by Panneerselvam
Thanks, I am looking for achieving the functionality similar to http://docs.nwjs.io/en/latest/For%20Use ... ce%20Code/
I feel it serves for source code protection and faster loading time.
I think, chrome is taking bigger steps towards wasm; snapshot eventually lead to wasm.
Please correct me if i am wrong.
Thanks again!!

Re: Implementing V8 snapshot feature in CEF

PostPosted: Thu May 04, 2017 11:39 am
by magreenblatt
The nwjs implementation seems equally troublesome to use: https://github.com/nwjs/nw.js/wiki/prot ... 8-snapshot

Re: Implementing V8 snapshot feature in CEF

PostPosted: Thu May 04, 2017 11:46 am
by magreenblatt
For source code protection you could load your resources from a password-protected zip archive and disable access to DevTools so that nobody can view source.