| 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 14 matching lines...) Expand all Loading... |
| 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 StackTrace_h | 31 #ifndef StackTrace_h |
| 32 #define StackTrace_h | 32 #define StackTrace_h |
| 33 | 33 |
| 34 #include "bindings/common/ScriptValue.h" | 34 #include "bindings/common/ScriptValue.h" |
| 35 #include "wtf/HashMap.h" |
| 36 |
| 35 #include <dart_debugger_api.h> | 37 #include <dart_debugger_api.h> |
| 36 | 38 |
| 37 namespace WebCore { | 39 namespace WebCore { |
| 38 | 40 |
| 39 class JSONValue; | 41 class JSONValue; |
| 40 class ScriptState; | 42 class ScriptState; |
| 41 class V8ScriptState; | 43 class V8ScriptState; |
| 42 | 44 |
| 43 class StackTrace { | 45 class StackTrace { |
| 44 public: | 46 public: |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 { | 84 { |
| 83 return m_isJavaScript ? m_scriptValue.isEmpty() : !m_dartStackTrace; | 85 return m_isJavaScript ? m_scriptValue.isEmpty() : !m_dartStackTrace; |
| 84 } | 86 } |
| 85 | 87 |
| 86 private: | 88 private: |
| 87 bool m_isJavaScript; | 89 bool m_isJavaScript; |
| 88 ScriptValue m_scriptValue; | 90 ScriptValue m_scriptValue; |
| 89 Dart_StackTrace m_dartStackTrace; | 91 Dart_StackTrace m_dartStackTrace; |
| 90 }; | 92 }; |
| 91 | 93 |
| 94 class StackTraces { |
| 95 public: |
| 96 typedef HashMap<ScriptState*, StackTrace> StackTraceMap; |
| 97 typedef StackTraceMap::iterator iterator; |
| 98 typedef StackTraceMap::const_iterator const_iterator; |
| 99 |
| 100 StackTraces() { } |
| 101 StackTraces(StackTrace, ScriptState*); |
| 102 |
| 103 StackTrace lookup(ScriptState*) const; |
| 104 void add(const StackTrace&, ScriptState*); |
| 105 void add(const StackTraces&); |
| 106 |
| 107 bool isNull() const { return m_traces.isEmpty(); } |
| 108 |
| 109 iterator begin() { return m_traces.begin(); } |
| 110 iterator end() { return m_traces.end(); } |
| 111 const_iterator begin() const { return m_traces.begin(); } |
| 112 const_iterator end() const { return m_traces.end(); } |
| 113 private: |
| 114 |
| 115 StackTraceMap m_traces; |
| 116 }; |
| 117 |
| 92 class ActivationFrame { | 118 class ActivationFrame { |
| 93 public: | 119 public: |
| 94 explicit ActivationFrame() | 120 explicit ActivationFrame() |
| 95 { | 121 { |
| 96 m_isJavaScript = true; | 122 m_isJavaScript = true; |
| 97 m_dartActivationFrame = 0; | 123 m_dartActivationFrame = 0; |
| 98 } | 124 } |
| 99 | 125 |
| 100 explicit ActivationFrame(const ScriptValue& activationFrame) | 126 explicit ActivationFrame(const ScriptValue& activationFrame) |
| 101 { | 127 { |
| 102 m_isJavaScript = true; | 128 m_isJavaScript = true; |
| 103 m_scriptValue = activationFrame; | 129 m_scriptValue = activationFrame; |
| 104 m_dartActivationFrame = 0; | 130 m_dartActivationFrame = 0; |
| 105 } | 131 } |
| 106 | 132 |
| 107 explicit ActivationFrame(Dart_ActivationFrame activationFrame) | 133 explicit ActivationFrame(Dart_ActivationFrame activationFrame) |
| 108 { | 134 { |
| 109 m_isJavaScript = false; | 135 m_isJavaScript = false; |
| 110 m_dartActivationFrame = activationFrame; | 136 m_dartActivationFrame = activationFrame; |
| 111 } | 137 } |
| 112 | 138 |
| 113 bool isJavaScript() const { return m_isJavaScript; } | 139 bool isJavaScript() const { return m_isJavaScript; } |
| 140 |
| 114 ScriptValue asJavaScript() const | 141 ScriptValue asJavaScript() const |
| 115 { | 142 { |
| 116 ASSERT(m_isJavaScript); | 143 ASSERT(m_isJavaScript); |
| 117 return m_scriptValue; | 144 return m_scriptValue; |
| 118 } | 145 } |
| 119 | 146 |
| 120 Dart_ActivationFrame asDart() const | 147 Dart_ActivationFrame asDart() const |
| 121 { | 148 { |
| 122 ASSERT(!m_isJavaScript); | 149 ASSERT(!m_isJavaScript); |
| 123 return m_dartActivationFrame; | 150 return m_dartActivationFrame; |
| 124 } | 151 } |
| 125 | 152 |
| 126 private: | 153 private: |
| 127 bool m_isJavaScript; | 154 bool m_isJavaScript; |
| 128 ScriptValue m_scriptValue; | 155 ScriptValue m_scriptValue; |
| 129 Dart_ActivationFrame m_dartActivationFrame; | 156 Dart_ActivationFrame m_dartActivationFrame; |
| 130 }; | 157 }; |
| 131 | 158 |
| 132 } // namespace WebCore | 159 } // namespace WebCore |
| 133 | 160 |
| 134 #endif // StackTrace_h | 161 #endif // StackTrace_h |
| OLD | NEW |