Is it valid to retain arguments from CefV8Handler::Execute?

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Is it valid to retain arguments from CefV8Handler::Execute?

Postby ScottKevill » Wed Dec 19, 2012 5:20 am

Is it valid to retain the arguments CefV8ValueList outside of CefV8Handler::Execute?

Essentially, I'm wanting to handle the native JS function processing on another thread (return values are not needed), and it would be very convenient to just copy the arguments list. From inspection, it seems that the refcounts for all CefV8Values are being correctly managed, but I'm wondering if it's the GC that is biting me.

Edit: The arguments in this case are only basic JS types (bool, int, string) if that matters.
ScottKevill
Techie
 
Posts: 16
Joined: Sun Oct 14, 2012 10:34 pm

Re: Is it valid to retain arguments from CefV8Handler::Execu

Postby magreenblatt » Wed Dec 19, 2012 9:30 am

The refcounting implementation is thread safe (so you could pass a reference to another thread and then back to the main thread), but you can't call CefV8Value methods on other threads.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Is it valid to retain arguments from CefV8Handler::Execu

Postby ScottKevill » Wed Dec 19, 2012 9:55 am

Okay, yeah, that's what I'm seeing. I'm using multi_threaded_message_loop with MFC so in this case, the UI thread is not the main thread, which is what is making this inconvenient.

Does that also mean I cannot even (painfully) re-create a copy of the list values (eg. IsBool + GetBoolValue + CreateBool)? A pity to not be able to re-use such a flexible method for marshalling.
ScottKevill
Techie
 
Posts: 16
Joined: Sun Oct 14, 2012 10:34 pm

Re: Is it valid to retain arguments from CefV8Handler::Execu

Postby magreenblatt » Wed Dec 19, 2012 9:58 am

If you're using CEF3 you can convert to something like CefListValue (from cef_values.h) which is thread safe.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Is it valid to retain arguments from CefV8Handler::Execu

Postby ScottKevill » Wed Dec 19, 2012 10:22 am

Oops, I should have mentioned that I'm using CEF1. That's okay, I don't have very many native functions to worry about, so I'll package them manually. Thank you for the quick responses.
ScottKevill
Techie
 
Posts: 16
Joined: Sun Oct 14, 2012 10:34 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 200 guests