32 has_value_(has_value) {}
39 bool expected =
false;
40 if (is_pending_.compare_exchange_strong(expected,
true)) {
42 LOG(WARNING) <<
"Resolve called on Promise that should have a " 43 "value, resolving with false.";
47 bool has_value = has_value_;
50 LocalVar<JsValue> value;
55 promise->ResolveWith(value);
61 bool expected =
false;
62 if (is_pending_.compare_exchange_strong(expected,
true)) {
64 LOG(WARNING) <<
"ResolveWith called on Promise that shouldn't have a " 65 "value, ignoring value.";
69 bool has_value = has_value_;
72 LocalVar<JsValue> js_value;
77 promise->ResolveWith(js_value);
84 bool expected =
false;
85 if (is_pending_.compare_exchange_strong(expected,
true)) {
89 switch (except_type) {
121 : impl_(
new Impl(promise, has_value)) {}
139 impl_->ResolveWith(value);
143 impl_->Reject(except_type, message);
virtual void ResolveWith(bool value)
ReturnVal< JsValue > JsUndefined()
EmePromise & operator=(const EmePromise &other)
ReturnVal< JsValue > ToJsValue(T &&source)
static JsManagerImpl * Instance()
void ResolveWith(bool value)
std::shared_ptr< ThreadEvent< impl::RetOf< Func > > > AddInternalTask(TaskPriority priority, const std::string &name, Func &&callback)
RefPtr< T > MakeJsRef(Args &&... args)
static JsError TypeError(const std::string &message)
static JsError DOMException(ExceptionCode code)
static JsError RangeError(const std::string &message)
virtual void Reject(ExceptionType except_type, const std::string &message)
void Reject(ExceptionType except_type, const std::string &message)
TaskRunner * MainThread()