Page 1 of 1
V8 initialization in CEF
Posted:
Fri Jan 31, 2020 2:33 pm
by rishgarg
Can someone help me with how is V8 initialized in CEF?
Specifically how is the v8::platform created?
Re: V8 initialization in CEF
Posted:
Fri Jan 31, 2020 2:45 pm
by magreenblatt
All initialization is performed in Blink. See the
V8Initializer class.
Re: V8 initialization in CEF
Posted:
Sat Feb 01, 2020 12:14 am
by rishgarg
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.
Re: V8 initialization in CEF
Posted:
Sat Feb 01, 2020 12:30 am
by magreenblatt
Are you making changes in CEF/Chromium code? You can’t call V8 functions directly from a client application.
Re: V8 initialization in CEF
Posted:
Sat Feb 01, 2020 12:37 am
by rishgarg
Yes, I have modified CEF
Re: V8 initialization in CEF
Posted:
Sat Feb 01, 2020 12:38 am
by rishgarg
I have also exposed the GetCurrentPlatform API from v8 to get v8::Platform*.
Re: V8 initialization in CEF
Posted:
Sat Feb 01, 2020 6:11 pm
by magreenblatt
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.
Re: V8 initialization in CEF
Posted:
Sun Feb 02, 2020 4:03 am
by rishgarg
I am calling the GetCurrentPlatform API from CEF itself.
Re: V8 initialization in CEF
Posted:
Mon Feb 03, 2020 11:12 pm
by rishgarg
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.
Re: V8 initialization in CEF
Posted:
Tue Feb 04, 2020 11:45 am
by magreenblatt
Your question is more related to Blink and V8. I suggest you ask on an appropriate
developer mailing list.