Some promise.resolve cannot set Promise state to resolved.

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.

Some promise.resolve cannot set Promise state to resolved.

Postby blackknife » Fri Nov 06, 2020 3:49 am

CEF VERSION: 81.2.25+g3afea62+chromium-81.0.4044.113

I post 10 task that call CefV8Value to TID_RENDERER thread on other thread. But only 4 or 6 "promise.then(callback)" is invoked.
The resolve is invoked then c++ call CefV8Value, but cannot set Promise state to resolved and it's not invoke promise.then(cb).

It's my promise wrap function.
Code: Select all
return new Promise(function(args, resolve, reject)
{
   args.push(function(err)
   {
      if(err)
         reject(err);
      else
      {
         if(arguments.length > 1)
            resolve(arguments[1]);
         else
            resolve();
      }
   });
   this.func.apply(this, args);
}.bind(this, args));


It's c++ code. ZefPostTask is function post a CefTask to call std::function<void()>.
Code: Select all
ZefPostTask(TID_RENDERER, [context, callback, base64Str]()
{
   if (!context->IsValid() || !context->Enter())
      return;
   callback->ExecuteFunction(nullptr, { CefV8Value::CreateNull(), CefV8Value::CreateString(base64Str.data()) });
   context->Exit();
});
blackknife
Techie
 
Posts: 30
Joined: Sun Apr 14, 2019 11:53 pm

Return to Support Forum

Who is online

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