| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ScriptPromisePropertyBase_h | 5 #ifndef ScriptPromisePropertyBase_h |
| 6 #define ScriptPromisePropertyBase_h | 6 #define ScriptPromisePropertyBase_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScopedPersistent.h" | 8 #include "bindings/core/v8/ScopedPersistent.h" |
| 9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
| 10 #include "bindings/core/v8/ScriptPromiseProperties.h" | 10 #include "bindings/core/v8/ScriptPromiseProperties.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 ScriptPromisePropertyBase(ExecutionContext*, Name); | 47 ScriptPromisePropertyBase(ExecutionContext*, Name); |
| 48 | 48 |
| 49 void resolveOrReject(State targetState); | 49 void resolveOrReject(State targetState); |
| 50 | 50 |
| 51 // ScriptPromiseProperty overrides these to wrap the holder, | 51 // ScriptPromiseProperty overrides these to wrap the holder, |
| 52 // rejected value and resolved value. The | 52 // rejected value and resolved value. The |
| 53 // ScriptPromisePropertyBase caller will enter the V8Context for | 53 // ScriptPromisePropertyBase caller will enter the V8Context for |
| 54 // the property's execution context and the world it is | 54 // the property's execution context and the world it is |
| 55 // creating/settling promises in; the implementation should use | 55 // creating/settling promises in; the implementation should use |
| 56 // this context. | 56 // this context. |
| 57 virtual v8::Handle<v8::Object> holder(v8::Handle<v8::Object> creationContext
, v8::Isolate*) = 0; | 57 virtual v8::Handle<v8::Object> holder(v8::Isolate*, v8::Handle<v8::Object> c
reationContext) = 0; |
| 58 virtual v8::Handle<v8::Value> resolvedValue(v8::Isolate*, v8::Handle<v8::Obj
ect> creationContext) = 0; | 58 virtual v8::Handle<v8::Value> resolvedValue(v8::Isolate*, v8::Handle<v8::Obj
ect> creationContext) = 0; |
| 59 virtual v8::Handle<v8::Value> rejectedValue(v8::Isolate*, v8::Handle<v8::Obj
ect> creationContext) = 0; | 59 virtual v8::Handle<v8::Value> rejectedValue(v8::Isolate*, v8::Handle<v8::Obj
ect> creationContext) = 0; |
| 60 | 60 |
| 61 void resetBase(); | 61 void resetBase(); |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 typedef Vector<OwnPtr<ScopedPersistent<v8::Object>>> WeakPersistentSet; | 64 typedef Vector<OwnPtr<ScopedPersistent<v8::Object>>> WeakPersistentSet; |
| 65 | 65 |
| 66 void resolveOrRejectInternal(v8::Handle<v8::Promise::Resolver>); | 66 void resolveOrRejectInternal(v8::Handle<v8::Promise::Resolver>); |
| 67 v8::Local<v8::Object> ensureHolderWrapper(ScriptState*); | 67 v8::Local<v8::Object> ensureHolderWrapper(ScriptState*); |
| 68 void clearWrappers(); | 68 void clearWrappers(); |
| 69 | 69 |
| 70 v8::Handle<v8::String> promiseName(); | 70 v8::Handle<v8::String> promiseName(); |
| 71 v8::Handle<v8::String> resolverName(); | 71 v8::Handle<v8::String> resolverName(); |
| 72 | 72 |
| 73 v8::Isolate* m_isolate; | 73 v8::Isolate* m_isolate; |
| 74 Name m_name; | 74 Name m_name; |
| 75 State m_state; | 75 State m_state; |
| 76 | 76 |
| 77 WeakPersistentSet m_wrappers; | 77 WeakPersistentSet m_wrappers; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 } // namespace blink | 80 } // namespace blink |
| 81 | 81 |
| 82 #endif // ScriptPromisePropertyBase_h | 82 #endif // ScriptPromisePropertyBase_h |
| OLD | NEW |