| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // to be in a v8 context. | 58 // to be in a v8 context. |
| 59 | 59 |
| 60 detachPromise(); | 60 detachPromise(); |
| 61 m_resolver.clear(); | 61 m_resolver.clear(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 PassRefPtr<ScriptPromiseResolver> ScriptPromiseResolver::create(ScriptExecutionC
ontext* context) | 64 PassRefPtr<ScriptPromiseResolver> ScriptPromiseResolver::create(ScriptExecutionC
ontext* context) |
| 65 { | 65 { |
| 66 ASSERT(v8::Context::InContext()); | 66 ASSERT(v8::Context::InContext()); |
| 67 ASSERT(context); | 67 ASSERT(context); |
| 68 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 68 return adoptRef(new ScriptPromiseResolver(toV8Context(context, DOMWrapperWor
ld::current())->Global(), toIsolate(context))); |
| 69 return adoptRef(new ScriptPromiseResolver(toV8Context(context, DOMWrapperWor
ld::current())->Global(), isolate)); | |
| 70 } | 69 } |
| 71 | 70 |
| 72 PassRefPtr<ScriptPromiseResolver> ScriptPromiseResolver::create() | 71 PassRefPtr<ScriptPromiseResolver> ScriptPromiseResolver::create() |
| 73 { | 72 { |
| 74 ASSERT(v8::Context::InContext()); | 73 ASSERT(v8::Context::InContext()); |
| 75 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 74 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 76 return adoptRef(new ScriptPromiseResolver(v8::Object::New(), isolate)); | 75 return adoptRef(new ScriptPromiseResolver(v8::Object::New(), isolate)); |
| 77 } | 76 } |
| 78 | 77 |
| 79 bool ScriptPromiseResolver::isPending() const | 78 bool ScriptPromiseResolver::isPending() const |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 return false; | 141 return false; |
| 143 v8::Local<v8::Object> resolver = m_resolver.newLocal(m_isolate); | 142 v8::Local<v8::Object> resolver = m_resolver.newLocal(m_isolate); |
| 144 if (V8PromiseCustom::isInternalDetached(resolver)) | 143 if (V8PromiseCustom::isInternalDetached(resolver)) |
| 145 return false; | 144 return false; |
| 146 v8::Local<v8::Object> internal = V8PromiseCustom::getInternal(resolver); | 145 v8::Local<v8::Object> internal = V8PromiseCustom::getInternal(resolver); |
| 147 V8PromiseCustom::PromiseState state = V8PromiseCustom::getState(internal); | 146 V8PromiseCustom::PromiseState state = V8PromiseCustom::getState(internal); |
| 148 return state == V8PromiseCustom::Pending; | 147 return state == V8PromiseCustom::Pending; |
| 149 } | 148 } |
| 150 | 149 |
| 151 } // namespace WebCore | 150 } // namespace WebCore |
| OLD | NEW |