Handler in libcef_dll_wrapper

Think CEF could benefit from a new feature or capability? Discuss CEF feature requests here.

Handler in libcef_dll_wrapper

Postby yuuGeek » Fri May 31, 2019 1:31 pm

Hi there,
I am working on a swift project which needs to use the message router in the libcef_dll_wrapper. I did all the bridging including the capi and cpptoc classes. But there are several APIs in CefMessageRouterBrowserSide class:
Code: Select all
virtual bool AddHandler(Hanlder* handler, bool first) = 0;
virtual bool RemoveHandler(Hanlder* handler) = 0;
virtual void CancelPending(CefRefPtr<CefBrowser> browser,
                             Hanlder* handler) = 0;
virtual int GetPendingCount(CefRefPtr<CefBrowser> browser,
                              Hanlder* handler) = 0;

Seems the Handler param in these functions is raw pointer instead of CefRefPtr. Which makes the bridging painful.
I saw that the Hanlder is based on CefBaseRefCounted, so is it possible that we use the refptr instead of raw pointers? For example:
Code: Select all
virtual bool AddHandler(CefRefPtr<Handler> handler, bool first) = 0;

I have made the changes in libcef_dll_wrapper project on my local machine, and it works fine.
But I believe such change will effect the client_handler class and several testing classes outside libcef_dll_wrapper. I can try to get them changed together and make a pull request if possible.
yuuGeek
Newbie
 
Posts: 4
Joined: Fri May 31, 2019 12:56 pm

Re: Handler in libcef_dll_wrapper

Postby magreenblatt » Fri May 31, 2019 2:18 pm

Handler is not ref-counted, and this is intentional. Sources that are only inside of libcef_dll_wrapper are C++ sources by design. You can create your own version of CefMessageRouter in swift code without relying on the libcef_dll_wrapper version.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Handler in libcef_dll_wrapper

Postby yuuGeek » Mon Jun 03, 2019 10:02 am

OK, is there any risk if I make the hanlder ref counted? Since you said it' intentionally not ref counted.
yuuGeek
Newbie
 
Posts: 4
Joined: Fri May 31, 2019 12:56 pm

Re: Handler in libcef_dll_wrapper

Postby magreenblatt » Mon Jun 03, 2019 10:30 am

yuuGeek wrote:OK, is there any risk if I make the hanlder ref counted? Since you said it' intentionally not ref counted.

Nothing that I would consider out of the ordinary.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm


Return to Feature Request Forum

Who is online

Users browsing this forum: No registered users and 15 guests