Replies: 2 comments 8 replies
-
You cannot directly call
You can execute javascript that returns a function, then execute that function multiple times via IJavascriptCallback. If your planning on executing the callback multiple times then don't forget to check the See https://github.com/cefsharp/CefSharp/blob/cefsharp/109/CefSharp.Test/Javascript/JavascriptCallbackFacts.cs for some test case examples. |
Beta Was this translation helpful? Give feedback.
-
Don't know if this helps for your case, but one of the things I do to overcome this, is to move your results into javascript, then return an object (either as expando or JSON)
|
Beta Was this translation helpful? Give feedback.
-
We're using CefSharp to embed a page with a WebGL canvas in our application, allowing us to use the same renderer for both our desktop and web applications.
It works remarkably well, but in some situations we're calling a large number of Javascript functions to query the geometry loaded in the WebGL canvas and Javascript context. This was cheap and fast with our old renderer, which used C++/CLI and OpenGL.
Profiling in Visual Studio shows >99% of the C# time is spent waiting for
EvaluateScriptAsync
, and profiling in the Cef dev tools shows that >70% of that time is spent in "Compile Script" and "Compile Code".I'm looking at ways to reduce that time, and one option I found is to use the
CefV8Context
'sGetGlobal
method, and then useExecuteFunction
to call the functions we need.My understanding is that going that route would avoid the compilation, and so it should execute faster, but it doesn't look like those capabilities of the
CefV8Context
are exposed in CefSharp.So my questions are:
Is there a way to execute Javascript functions in CefSharp directly via the
CefV8Context
, without compiling Javascript strings?If not, any suggestions for speeding up a large number of Javascript calls? The alternatives I've come up with involve a pretty big refactor for our existing code...
Beta Was this translation helpful? Give feedback.
All reactions