Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: Source/bindings/v8/ScriptPromiseResolver.cpp

Issue 24980002: Implement AP2 Promises (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 void ScriptPromiseResolver::fulfill(v8::Handle<v8::Value> value) 117 void ScriptPromiseResolver::fulfill(v8::Handle<v8::Value> value)
118 { 118 {
119 resolve(value); 119 resolve(value);
120 } 120 }
121 121
122 void ScriptPromiseResolver::resolve(v8::Handle<v8::Value> value) 122 void ScriptPromiseResolver::resolve(v8::Handle<v8::Value> value)
123 { 123 {
124 ASSERT(v8::Context::InContext()); 124 ASSERT(v8::Context::InContext());
125 if (!isPending()) 125 if (!isPending())
126 return; 126 return;
127 V8PromiseCustom::resolve(m_promise.v8Value().As<v8::Object>(), value, V8Prom iseCustom::Asynchronous, m_isolate); 127 V8PromiseCustom::resolve(m_promise.v8Value().As<v8::Object>(), value, m_isol ate);
128 detachPromiseForResolve(); 128 detachPromiseForResolve();
129 } 129 }
130 130
131 void ScriptPromiseResolver::reject(v8::Handle<v8::Value> value) 131 void ScriptPromiseResolver::reject(v8::Handle<v8::Value> value)
132 { 132 {
133 ASSERT(v8::Context::InContext()); 133 ASSERT(v8::Context::InContext());
134 if (!isPending()) 134 if (!isPending())
135 return; 135 return;
136 V8PromiseCustom::reject(m_promise.v8Value().As<v8::Object>(), value, V8Promi seCustom::Asynchronous, m_isolate); 136 V8PromiseCustom::reject(m_promise.v8Value().As<v8::Object>(), value, m_isola te);
137 detachPromiseForResolve(); 137 detachPromiseForResolve();
138 } 138 }
139 139
140 void ScriptPromiseResolver::fulfill(ScriptValue value) 140 void ScriptPromiseResolver::fulfill(ScriptValue value)
141 { 141 {
142 resolve(value); 142 resolve(value);
143 } 143 }
144 144
145 void ScriptPromiseResolver::resolve(ScriptValue value) 145 void ScriptPromiseResolver::resolve(ScriptValue value)
146 { 146 {
147 ASSERT(v8::Context::InContext()); 147 ASSERT(v8::Context::InContext());
148 resolve(value.v8Value()); 148 resolve(value.v8Value());
149 } 149 }
150 150
151 void ScriptPromiseResolver::reject(ScriptValue value) 151 void ScriptPromiseResolver::reject(ScriptValue value)
152 { 152 {
153 ASSERT(v8::Context::InContext()); 153 ASSERT(v8::Context::InContext());
154 reject(value.v8Value()); 154 reject(value.v8Value());
155 } 155 }
156 156
157 } // namespace WebCore 157 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/js/resources/Promise-then-in-workers.js ('k') | Source/bindings/v8/V8HiddenPropertyName.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698