Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 13 matching lines...) Expand all Loading... | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef PromiseTracker_h | 31 #ifndef PromiseTracker_h |
| 32 #define PromiseTracker_h | 32 #define PromiseTracker_h |
| 33 | 33 |
| 34 #include "bindings/v8/ScriptValue.h" | |
|
aandrey
2014/05/20 15:51:41
FYI this file and few more were removed in https:/
| |
| 34 #include "bindings/v8/custom/V8PromiseCustom.h" | 35 #include "bindings/v8/custom/V8PromiseCustom.h" |
| 35 #include "bindings/v8/ScriptObjectTraits.h" | |
| 36 #include "core/inspector/ScriptCallStack.h" | 36 #include "core/inspector/ScriptCallStack.h" |
| 37 #include "wtf/HashMap.h" | 37 #include "wtf/HashMap.h" |
| 38 #include "wtf/Noncopyable.h" | 38 #include "wtf/Noncopyable.h" |
| 39 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
| 40 | 40 |
| 41 namespace WebCore { | 41 namespace WebCore { |
| 42 | 42 |
| 43 class ExecutionContext; | 43 class ExecutionContext; |
| 44 | 44 |
| 45 class PromiseTracker { | 45 class PromiseTracker { |
| 46 WTF_MAKE_NONCOPYABLE(PromiseTracker); | 46 WTF_MAKE_NONCOPYABLE(PromiseTracker); |
| 47 public: | 47 public: |
| 48 PromiseTracker() : m_isEnabled(false) { } | 48 PromiseTracker() : m_isEnabled(false) { } |
| 49 | 49 |
| 50 bool isEnabled() const { return m_isEnabled; } | 50 bool isEnabled() const { return m_isEnabled; } |
| 51 void enable(); | 51 void enable(); |
| 52 void disable(); | 52 void disable(); |
| 53 | 53 |
| 54 void clear(); | 54 void clear(); |
| 55 | 55 |
| 56 void didCreatePromise(const ScriptObject& promise); | 56 void didCreatePromise(const ScriptValue& promise); |
| 57 void didUpdatePromiseParent(const ScriptObject& promise, const ScriptObject& parentPromise); | 57 void didUpdatePromiseParent(const ScriptValue& promise, const ScriptValue& p arentPromise); |
| 58 void didUpdatePromiseState(const ScriptObject& promise, V8PromiseCustom::Pro miseState, const ScriptValue& result); | 58 void didUpdatePromiseState(const ScriptValue& promise, V8PromiseCustom::Prom iseState, const ScriptValue& result); |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 class PromiseData : public RefCounted<PromiseData> { | 61 class PromiseData : public RefCounted<PromiseData> { |
| 62 public: | 62 public: |
| 63 PromiseData(const ScriptObject& promise, const ScriptObject& parentPromi se, const ScriptValue& result, V8PromiseCustom::PromiseState state, double times tamp); | 63 PromiseData(const ScriptValue& promise, const ScriptValue& parentPromise , const ScriptValue& result, V8PromiseCustom::PromiseState, double timestamp); |
| 64 | 64 |
| 65 void didSettlePromise(double timestamp); | 65 void didSettlePromise(double timestamp); |
| 66 | 66 |
| 67 ScriptObject m_promise; | 67 ScriptValue m_promise; |
| 68 ScriptObject m_parentPromise; | 68 ScriptValue m_parentPromise; |
| 69 ScriptValue m_result; | 69 ScriptValue m_result; |
| 70 V8PromiseCustom::PromiseState m_state; | 70 V8PromiseCustom::PromiseState m_state; |
| 71 | 71 |
| 72 // Time in milliseconds. | 72 // Time in milliseconds. |
| 73 double m_timeOnCreate; | 73 double m_timeOnCreate; |
| 74 double m_timeOnSettle; | 74 double m_timeOnSettle; |
| 75 | 75 |
| 76 RefPtr<ScriptCallStack> m_callStackOnCreate; | 76 RefPtr<ScriptCallStack> m_callStackOnCreate; |
| 77 RefPtr<ScriptCallStack> m_callStackOnSettle; | 77 RefPtr<ScriptCallStack> m_callStackOnSettle; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 bool m_isEnabled; | 80 bool m_isEnabled; |
| 81 typedef HashMap<ScriptObject, RefPtr<PromiseData>, ScriptObjectHash, ScriptO bjectHashTraits> PromiseDataMap; | 81 typedef HashMap<ScriptValue, RefPtr<PromiseData>, ScriptValueHash, ScriptVal ueHashTraits> PromiseDataMap; |
| 82 PromiseDataMap m_promiseDataMap; | 82 PromiseDataMap m_promiseDataMap; |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 } // namespace WebCore | 85 } // namespace WebCore |
| 86 | 86 |
| 87 #endif // !defined(PromiseTracker_h) | 87 #endif // !defined(PromiseTracker_h) |
| OLD | NEW |