V8 initialization in CEF

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

V8 initialization in CEF

Postby rishgarg » Fri Jan 31, 2020 2:33 pm

Can someone help me with how is V8 initialized in CEF?
Specifically how is the v8::platform created?
rishgarg
Techie
 
Posts: 16
Joined: Wed Feb 13, 2019 1:11 pm

Re: V8 initialization in CEF

Postby magreenblatt » Fri Jan 31, 2020 2:45 pm

All initialization is performed in Blink. See the V8Initializer class.
magreenblatt
Site Admin
 
Posts: 9837
Joined: Fri May 29, 2009 6:57 pm

Re: V8 initialization in CEF

Postby rishgarg » Sat Feb 01, 2020 12:14 am

Thanks Marshall!
I think, if I understand correctly, blink uses gin to initialize and create the v8::platform.

Let me give you a bit of context upon my question (OS - MAC OSX) (Application : CefSimple) :
I am posting tasks (C++/JS) on the main thread of renderer process. I was trying to call v8::platform::PumpMessageLoop after executing the task in order to tell v8 to execute its delayed tasks(Microtasks). I am seeing a crash as I can see the platform creation is not done via v8::platform::NewDefaultPlatform().
I was wondering how do I notify v8 to run its microtasks upon completion of my task.

Consider the case where I post a JS task(say task1) and in execution of that task I post another JS task(say task2). I would want the microtasks to be cleared up before the execution of task2.
rishgarg
Techie
 
Posts: 16
Joined: Wed Feb 13, 2019 1:11 pm

Re: V8 initialization in CEF

Postby magreenblatt » Sat Feb 01, 2020 12:30 am

Are you making changes in CEF/Chromium code? You can’t call V8 functions directly from a client application.
magreenblatt
Site Admin
 
Posts: 9837
Joined: Fri May 29, 2009 6:57 pm

Re: V8 initialization in CEF

Postby rishgarg » Sat Feb 01, 2020 12:37 am

Yes, I have modified CEF
rishgarg
Techie
 
Posts: 16
Joined: Wed Feb 13, 2019 1:11 pm

Re: V8 initialization in CEF

Postby rishgarg » Sat Feb 01, 2020 12:38 am

I have also exposed the GetCurrentPlatform API from v8 to get v8::Platform*.
rishgarg
Techie
 
Posts: 16
Joined: Wed Feb 13, 2019 1:11 pm

Re: V8 initialization in CEF

Postby magreenblatt » Sat Feb 01, 2020 6:11 pm

rishgarg wrote:I have also exposed the GetCurrentPlatform API from v8 to get v8::Platform*.

For this approach to work you likely need to build V8 as a shared library or export additional symbols from Chromium, and make sure your header files match the versions used by Chromium.
magreenblatt
Site Admin
 
Posts: 9837
Joined: Fri May 29, 2009 6:57 pm

Re: V8 initialization in CEF

Postby rishgarg » Sun Feb 02, 2020 4:03 am

I am calling the GetCurrentPlatform API from CEF itself.
rishgarg
Techie
 
Posts: 16
Joined: Wed Feb 13, 2019 1:11 pm

Re: V8 initialization in CEF

Postby rishgarg » Mon Feb 03, 2020 11:12 pm

rishgarg wrote:I am posting tasks (C++/JS) on the main thread of renderer process. I was trying to call v8::platform::PumpMessageLoop after executing the task in order to tell v8 to execute its delayed tasks(Microtasks). I am seeing a crash as I can see the platform creation is not done via v8::platform::NewDefaultPlatform().
I was wondering how do I notify v8 to run its microtasks upon completion of my task.

Consider the case where I post a JS task(say task1) and in execution of that task I post another JS task(say task2). I would want the microtasks to be cleared up before the execution of task2.


Can you please help me with the above scenario? I am more than happy to discuss this further.
rishgarg
Techie
 
Posts: 16
Joined: Wed Feb 13, 2019 1:11 pm

Re: V8 initialization in CEF

Postby magreenblatt » Tue Feb 04, 2020 11:45 am

Your question is more related to Blink and V8. I suggest you ask on an appropriate developer mailing list.
magreenblatt
Site Admin
 
Posts: 9837
Joined: Fri May 29, 2009 6:57 pm


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 1 guest