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 30 matching lines...) Expand all Loading... |
41 #include <v8.h> | 41 #include <v8.h> |
42 | 42 |
43 namespace WebCore { | 43 namespace WebCore { |
44 | 44 |
45 ScriptPromiseResolver::ScriptPromiseResolver(v8::Handle<v8::Object> creationCont
ext, v8::Isolate* isolate) | 45 ScriptPromiseResolver::ScriptPromiseResolver(v8::Handle<v8::Object> creationCont
ext, v8::Isolate* isolate) |
46 : m_isolate(isolate) | 46 : m_isolate(isolate) |
47 { | 47 { |
48 ASSERT(RuntimeEnabledFeatures::promiseEnabled()); | 48 ASSERT(RuntimeEnabledFeatures::promiseEnabled()); |
49 v8::Local<v8::Object> promise, resolver; | 49 v8::Local<v8::Object> promise, resolver; |
50 V8PromiseCustom::createPromise(creationContext, &promise, &resolver, isolate
); | 50 V8PromiseCustom::createPromise(creationContext, &promise, &resolver, isolate
); |
51 m_promise = ScriptPromise(promise); | 51 m_promise = ScriptPromise(promise, isolate); |
52 m_resolver.set(isolate, resolver); | 52 m_resolver.set(isolate, resolver); |
53 } | 53 } |
54 | 54 |
55 ScriptPromiseResolver::~ScriptPromiseResolver() | 55 ScriptPromiseResolver::~ScriptPromiseResolver() |
56 { | 56 { |
57 // We don't call "detach" here because it requires a caller | 57 // We don't call "detach" here because it requires a caller |
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(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 return false; | 142 return false; |
143 v8::Local<v8::Object> resolver = m_resolver.newLocal(m_isolate); | 143 v8::Local<v8::Object> resolver = m_resolver.newLocal(m_isolate); |
144 if (V8PromiseCustom::isInternalDetached(resolver)) | 144 if (V8PromiseCustom::isInternalDetached(resolver)) |
145 return false; | 145 return false; |
146 v8::Local<v8::Object> internal = V8PromiseCustom::getInternal(resolver); | 146 v8::Local<v8::Object> internal = V8PromiseCustom::getInternal(resolver); |
147 V8PromiseCustom::PromiseState state = V8PromiseCustom::getState(internal); | 147 V8PromiseCustom::PromiseState state = V8PromiseCustom::getState(internal); |
148 return state == V8PromiseCustom::Pending; | 148 return state == V8PromiseCustom::Pending; |
149 } | 149 } |
150 | 150 |
151 } // namespace WebCore | 151 } // namespace WebCore |
OLD | NEW |