OLD | NEW |
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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 return ScriptPromise(); | 292 return ScriptPromise(); |
293 InternalResolver resolver(scriptState); | 293 InternalResolver resolver(scriptState); |
294 ScriptPromise promise = resolver.promise(); | 294 ScriptPromise promise = resolver.promise(); |
295 resolver.reject(value); | 295 resolver.reject(value); |
296 return promise; | 296 return promise; |
297 } | 297 } |
298 | 298 |
299 ScriptPromise ScriptPromise::rejectWithDOMException(ScriptState* scriptState, | 299 ScriptPromise ScriptPromise::rejectWithDOMException(ScriptState* scriptState, |
300 DOMException* exception) { | 300 DOMException* exception) { |
301 ASSERT(scriptState->isolate()->InContext()); | 301 ASSERT(scriptState->isolate()->InContext()); |
302 return reject(scriptState, ToV8(exception, scriptState->context()->Global(), | 302 return reject(scriptState, |
303 scriptState->isolate())); | 303 ToV8(exception, scriptState->context()->Global(), |
| 304 scriptState->isolate())); |
304 } | 305 } |
305 | 306 |
306 v8::Local<v8::Promise> ScriptPromise::rejectRaw(ScriptState* scriptState, | 307 v8::Local<v8::Promise> ScriptPromise::rejectRaw(ScriptState* scriptState, |
307 v8::Local<v8::Value> value) { | 308 v8::Local<v8::Value> value) { |
308 if (value.IsEmpty()) | 309 if (value.IsEmpty()) |
309 return v8::Local<v8::Promise>(); | 310 return v8::Local<v8::Promise>(); |
310 v8::Local<v8::Promise::Resolver> resolver; | 311 v8::Local<v8::Promise::Resolver> resolver; |
311 if (!v8::Promise::Resolver::New(scriptState->context()).ToLocal(&resolver)) | 312 if (!v8::Promise::Resolver::New(scriptState->context()).ToLocal(&resolver)) |
312 return v8::Local<v8::Promise>(); | 313 return v8::Local<v8::Promise>(); |
313 v8::Local<v8::Promise> promise = resolver->GetPromise(); | 314 v8::Local<v8::Promise> promise = resolver->GetPromise(); |
314 resolver->Reject(scriptState->context(), value); | 315 resolver->Reject(scriptState->context(), value); |
315 return promise; | 316 return promise; |
316 } | 317 } |
317 | 318 |
318 ScriptPromise ScriptPromise::all(ScriptState* scriptState, | 319 ScriptPromise ScriptPromise::all(ScriptState* scriptState, |
319 const Vector<ScriptPromise>& promises) { | 320 const Vector<ScriptPromise>& promises) { |
320 return PromiseAllHandler::all(scriptState, promises); | 321 return PromiseAllHandler::all(scriptState, promises); |
321 } | 322 } |
322 | 323 |
323 void ScriptPromise::increaseInstanceCount() { | 324 void ScriptPromise::increaseInstanceCount() { |
324 InstanceCounters::incrementCounter(InstanceCounters::ScriptPromiseCounter); | 325 InstanceCounters::incrementCounter(InstanceCounters::ScriptPromiseCounter); |
325 } | 326 } |
326 | 327 |
327 void ScriptPromise::decreaseInstanceCount() { | 328 void ScriptPromise::decreaseInstanceCount() { |
328 InstanceCounters::decrementCounter(InstanceCounters::ScriptPromiseCounter); | 329 InstanceCounters::decrementCounter(InstanceCounters::ScriptPromiseCounter); |
329 } | 330 } |
330 | 331 |
331 } // namespace blink | 332 } // namespace blink |
OLD | NEW |