Hi
CefCookieManager I/F usage (58 => 79 upgrade, callbacks switched to UI thread from IO thread)
I'm following the example in ceftests, which I notice invokes the CefCookieManager::GetGlobalManager() on the IO thread, where as in our
upgraded CEF 79 App CefCookieManager::GetGlobalManager() is invoked on the UI thread.
The problem I'm having is event->Wait(); it doesn't block like in the ceftest harness
(wait until Completion callback fires which sets the CefWaitableEvent event object) and the only difference I can see is above.
Q. What am I doing wrong
Many Thanks
Can't wait on CefWaitableEvent synchronization object
chromium\src>out\Debug_GN_x64\ceftests.exe --gtest_filter=CookieTest.BasicDomainCookie
TID Main/UI : 21048
TID IO : 5512
00000001 20:50:22.104 [18096] [21048] 172 ::CefExecuteProcess(args, application, windows_sandbox_info)
. . .
. . .
00000012 20:50:22.292 [18096] [5512] 516 ::TestBody()
00000013 20:50:22.292 [18096] [5512] 312 CefCookieManager::GetGlobalManager()
00000014 20:50:22.292 [18096] [5512] 316 CefCookieManager::GetGlobalManager(context * 0x0000000002B76960)
00000015 20:50:22.292 [18096] [5512] 105 CefCookieManagerImpl::CefCookieManagerImpl()
00000016 20:50:22.292 [18096] [5512] 116 CefCookieManagerImpl::Initialize()
00000017 20:50:22.292 [18096] [21048] 42 anon_ns::TestCompletionCallback::OnComplete()
00000018 20:50:22.293 [18096] [5512] 524 ::TestBody() calling event->Wait(), CefCookieManager * 0x000000000298E5A0
00000019 20:50:22.293 [18096] [5512] 529 ::TestBody() returned from event->Wait(), CefCookieManager * 0x000000000298E5A0
// On IO Thread
TEST(CookieTest, BasicDomainCookie) {
CefRefPtr<CefWaitableEvent> event = CefWaitableEvent::CreateWaitableEvent(true, false);
CefRefPtr<CefCookieManager> manager = CefCookieManager::GetGlobalManager(new TestCompletionCallback(event));
event->Wait(); // <=== this blocks (works)
Our CEF 79.x App
TID Main/UI : 21656
TID IO : 5512
00000383 21:41:20.782 [18356] [21656] 312 CefCookieManager::GetGlobalManager()
00000384 21:41:20.783 [18356] [21656] 316 CefCookieManager::GetGlobalManager(context * 0x0000000000DAE080)
00000385 21:41:20.783 [18356] [21656] 105 CefCookieManagerImpl::CefCookieManagerImpl()
00000386 21:41:20.783 [18356] [21656] 116 CefCookieManagerImpl::Initialize()
00000412 21:41:20.837 [18356] [21656] 845 AsyncCompletionCallback::OnComplete()
class AsyncCompletionCallback : public CefCompletionCallback {
public:
explicit AsyncCompletionCallback(CefRefPtr<CefWaitableEvent> event) : event_(event) {
}
void OnComplete() override {
event_->Signal(); // allow 1 thread to run
}
// On Main/UI Thread
MyCefApp() {
CefRefPtr<CefWaitableEvent> event = CefWaitableEvent::CreateWaitableEvent(true, false);
CefRefPtr<CefCookieManager> manager = CefCookieManager::GetGlobalManager(new AsyncCompletionCallback(event));
event->Wait(); // <=== this doesn't block ?