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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 void resolveOrReject(State targetState); | 47 void resolveOrReject(State targetState); |
48 | 48 |
49 // ScriptPromiseProperty overrides these to wrap the holder, | 49 // ScriptPromiseProperty overrides these to wrap the holder, |
50 // rejected value and resolved value. The | 50 // rejected value and resolved value. The |
51 // ScriptPromisePropertyBase caller will enter the V8Context for | 51 // ScriptPromisePropertyBase caller will enter the V8Context for |
52 // the property's execution context and the world it is | 52 // the property's execution context and the world it is |
53 // creating/settling promises in; the implementation should use | 53 // creating/settling promises in; the implementation should use |
54 // this context. | 54 // this context. |
55 virtual v8::Handle<v8::Object> holder(v8::Handle<v8::Object> creationContext
, v8::Isolate*) = 0; | 55 virtual v8::Handle<v8::Object> holder(v8::Handle<v8::Object> creationContext
, v8::Isolate*) = 0; |
56 virtual v8::Handle<v8::Value> resolvedValue(v8::Handle<v8::Object> creationC
ontext, v8::Isolate*) = 0; | 56 virtual v8::Handle<v8::Value> resolvedValue(v8::Isolate*, v8::Handle<v8::Obj
ect> creationContext) = 0; |
57 virtual v8::Handle<v8::Value> rejectedValue(v8::Handle<v8::Object> creationC
ontext, v8::Isolate*) = 0; | 57 virtual v8::Handle<v8::Value> rejectedValue(v8::Isolate*, v8::Handle<v8::Obj
ect> creationContext) = 0; |
58 | 58 |
59 void resetBase(); | 59 void resetBase(); |
60 | 60 |
61 private: | 61 private: |
62 typedef Vector<OwnPtr<ScopedPersistent<v8::Object> > > WeakPersistentSet; | 62 typedef Vector<OwnPtr<ScopedPersistent<v8::Object> > > WeakPersistentSet; |
63 | 63 |
64 void resolveOrRejectInternal(v8::Handle<v8::Promise::Resolver>); | 64 void resolveOrRejectInternal(v8::Handle<v8::Promise::Resolver>); |
65 v8::Local<v8::Object> ensureHolderWrapper(ScriptState*); | 65 v8::Local<v8::Object> ensureHolderWrapper(ScriptState*); |
66 void clearWrappers(); | 66 void clearWrappers(); |
67 | 67 |
68 v8::Handle<v8::String> promiseName(); | 68 v8::Handle<v8::String> promiseName(); |
69 v8::Handle<v8::String> resolverName(); | 69 v8::Handle<v8::String> resolverName(); |
70 | 70 |
71 v8::Isolate* m_isolate; | 71 v8::Isolate* m_isolate; |
72 Name m_name; | 72 Name m_name; |
73 State m_state; | 73 State m_state; |
74 | 74 |
75 WeakPersistentSet m_wrappers; | 75 WeakPersistentSet m_wrappers; |
76 }; | 76 }; |
77 | 77 |
78 } // namespace blink | 78 } // namespace blink |
79 | 79 |
80 #endif // ScriptPromisePropertyBase_h | 80 #endif // ScriptPromisePropertyBase_h |
OLD | NEW |