| 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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 | 621 |
| 622 v8::Local<v8::Object> V8PromiseCustom::getInternal(v8::Handle<v8::Object> promis
e) | 622 v8::Local<v8::Object> V8PromiseCustom::getInternal(v8::Handle<v8::Object> promis
e) |
| 623 { | 623 { |
| 624 v8::Local<v8::Value> value = promise->GetInternalField(v8DOMWrapperObjectInd
ex); | 624 v8::Local<v8::Value> value = promise->GetInternalField(v8DOMWrapperObjectInd
ex); |
| 625 return value.As<v8::Object>(); | 625 return value.As<v8::Object>(); |
| 626 } | 626 } |
| 627 | 627 |
| 628 V8PromiseCustom::PromiseState V8PromiseCustom::getState(v8::Handle<v8::Object> i
nternal) | 628 V8PromiseCustom::PromiseState V8PromiseCustom::getState(v8::Handle<v8::Object> i
nternal) |
| 629 { | 629 { |
| 630 v8::Handle<v8::Value> value = internal->GetInternalField(V8PromiseCustom::In
ternalStateIndex); | 630 v8::Handle<v8::Value> value = internal->GetInternalField(V8PromiseCustom::In
ternalStateIndex); |
| 631 bool ok = false; | 631 uint32_t number = toInt32(value); |
| 632 uint32_t number = toInt32(value, ok); | 632 ASSERT(number == Pending || number == Fulfilled || number == Rejected || num
ber == Following); |
| 633 ASSERT(ok && (number == Pending || number == Fulfilled || number == Rejected
|| number == Following)); | |
| 634 return static_cast<PromiseState>(number); | 633 return static_cast<PromiseState>(number); |
| 635 } | 634 } |
| 636 | 635 |
| 637 void V8PromiseCustom::setState(v8::Handle<v8::Object> internal, PromiseState sta
te, v8::Handle<v8::Value> value, v8::Isolate* isolate) | 636 void V8PromiseCustom::setState(v8::Handle<v8::Object> internal, PromiseState sta
te, v8::Handle<v8::Value> value, v8::Isolate* isolate) |
| 638 { | 637 { |
| 639 ASSERT(!value.IsEmpty()); | 638 ASSERT(!value.IsEmpty()); |
| 640 ASSERT(state == Pending || state == Fulfilled || state == Rejected || state
== Following); | 639 ASSERT(state == Pending || state == Fulfilled || state == Rejected || state
== Following); |
| 641 internal->SetInternalField(InternalStateIndex, v8::Integer::New(isolate, sta
te)); | 640 internal->SetInternalField(InternalStateIndex, v8::Integer::New(isolate, sta
te)); |
| 642 internal->SetInternalField(InternalResultIndex, value); | 641 internal->SetInternalField(InternalResultIndex, value); |
| 643 } | 642 } |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 } | 784 } |
| 786 | 785 |
| 787 void V8PromiseCustom::callHandler(v8::Handle<v8::Object> promise, v8::Handle<v8:
:Function> handler, v8::Handle<v8::Value> argument, v8::Isolate* isolate) | 786 void V8PromiseCustom::callHandler(v8::Handle<v8::Object> promise, v8::Handle<v8:
:Function> handler, v8::Handle<v8::Value> argument, v8::Isolate* isolate) |
| 788 { | 787 { |
| 789 ExecutionContext* executionContext = getExecutionContext(); | 788 ExecutionContext* executionContext = getExecutionContext(); |
| 790 ASSERT(executionContext && executionContext->isContextThread()); | 789 ASSERT(executionContext && executionContext->isContextThread()); |
| 791 executionContext->postTask(adoptPtr(new CallHandlerTask(promise, handler, ar
gument, isolate, executionContext))); | 790 executionContext->postTask(adoptPtr(new CallHandlerTask(promise, handler, ar
gument, isolate, executionContext))); |
| 792 } | 791 } |
| 793 | 792 |
| 794 } // namespace WebCore | 793 } // namespace WebCore |
| OLD | NEW |