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 21 matching lines...) Expand all Loading... | |
| 32 #define StackTrace_h | 32 #define StackTrace_h |
| 33 | 33 |
| 34 #include "bindings/common/ScriptValue.h" | 34 #include "bindings/common/ScriptValue.h" |
| 35 #include <dart_debugger_api.h> | 35 #include <dart_debugger_api.h> |
| 36 | 36 |
| 37 namespace WebCore { | 37 namespace WebCore { |
| 38 | 38 |
| 39 class JSONValue; | 39 class JSONValue; |
| 40 class ScriptState; | 40 class ScriptState; |
| 41 class V8ScriptState; | 41 class V8ScriptState; |
| 42 class DartScriptState; | |
| 42 | 43 |
| 43 class StackTrace { | 44 class StackTrace { |
| 44 public: | 45 public: |
| 45 explicit StackTrace() | 46 explicit StackTrace(); |
| 47 explicit StackTrace(const StackTrace& javaScriptStackTrace, const StackTrace & dartStackTrace); | |
|
vsm
2014/08/29 08:42:08
Can you add a comment here clarifying whether this
Jacob
2014/09/05 23:35:56
Rolled back the change to the StackTrace class and
| |
| 48 explicit StackTrace(const ScriptValue& stackTrace, V8ScriptState*); | |
| 49 explicit StackTrace(Dart_StackTrace, DartScriptState*); | |
| 50 | |
| 51 bool hasJavaScript() const | |
| 46 { | 52 { |
| 47 m_isJavaScript = true; | 53 return m_hasJavaScript; |
| 48 m_dartStackTrace = 0; | |
| 49 } | 54 } |
| 50 | 55 |
| 51 explicit StackTrace(const ScriptValue& stackTrace) | 56 bool hasDart() const |
| 52 { | 57 { |
| 53 m_isJavaScript = true; | 58 return m_hasDart; |
| 54 m_scriptValue = stackTrace; | |
| 55 m_dartStackTrace = 0; | |
| 56 } | |
| 57 | |
| 58 explicit StackTrace(Dart_StackTrace stackTrace) | |
| 59 { | |
| 60 m_isJavaScript = false; | |
| 61 m_dartStackTrace = stackTrace; | |
| 62 } | |
| 63 | |
| 64 bool isJavaScript() const | |
| 65 { | |
| 66 return m_isJavaScript; | |
| 67 } | 59 } |
| 68 | 60 |
| 69 ScriptValue asJavaScript() const | 61 ScriptValue asJavaScript() const |
| 70 { | 62 { |
| 71 ASSERT(m_isJavaScript); | 63 ASSERT(m_hasJavaScript); |
| 72 return m_scriptValue; | 64 return m_scriptValue; |
| 73 } | 65 } |
| 74 | 66 |
| 75 Dart_StackTrace asDart() const | 67 Dart_StackTrace asDart() const |
| 76 { | 68 { |
| 77 ASSERT(!m_isJavaScript); | 69 ASSERT(m_hasDart); |
| 78 return m_dartStackTrace; | 70 return m_dartStackTrace; |
| 79 } | 71 } |
| 80 | 72 |
| 81 bool isNull() const | 73 bool isNull() const |
| 82 { | 74 { |
| 83 return m_isJavaScript ? m_scriptValue.isEmpty() : !m_dartStackTrace; | 75 return !m_hasDart && !m_hasJavaScript; |
| 84 } | 76 } |
| 85 | 77 |
| 78 bool isMixedLanguageStackTrace() const | |
| 79 { | |
| 80 return m_hasJavaScript && m_hasDart; | |
| 81 } | |
| 82 | |
| 83 DartScriptState* dartScriptState() const | |
| 84 { | |
| 85 return m_dartScriptState; | |
| 86 } | |
| 87 | |
| 88 V8ScriptState* v8ScriptState() const | |
| 89 { | |
| 90 return m_v8ScriptState; | |
| 91 } | |
| 92 | |
| 93 void merge(const StackTrace& other); | |
| 94 | |
| 86 private: | 95 private: |
| 87 bool m_isJavaScript; | 96 bool m_hasJavaScript; |
| 97 bool m_hasDart; | |
| 88 ScriptValue m_scriptValue; | 98 ScriptValue m_scriptValue; |
| 89 Dart_StackTrace m_dartStackTrace; | 99 Dart_StackTrace m_dartStackTrace; |
| 100 V8ScriptState* m_v8ScriptState; | |
| 101 DartScriptState* m_dartScriptState; | |
| 90 }; | 102 }; |
| 91 | 103 |
| 92 class ActivationFrame { | 104 class ActivationFrame { |
| 93 public: | 105 public: |
| 94 explicit ActivationFrame() | 106 explicit ActivationFrame() |
| 95 { | 107 { |
| 96 m_isJavaScript = true; | 108 m_isJavaScript = true; |
| 97 m_dartActivationFrame = 0; | 109 m_dartActivationFrame = 0; |
| 98 } | 110 } |
| 99 | 111 |
| 100 explicit ActivationFrame(const ScriptValue& activationFrame) | 112 explicit ActivationFrame(const ScriptValue& activationFrame) |
| 101 { | 113 { |
| 102 m_isJavaScript = true; | 114 m_isJavaScript = true; |
| 103 m_scriptValue = activationFrame; | 115 m_scriptValue = activationFrame; |
| 104 m_dartActivationFrame = 0; | 116 m_dartActivationFrame = 0; |
| 105 } | 117 } |
| 106 | 118 |
| 107 explicit ActivationFrame(Dart_ActivationFrame activationFrame) | 119 explicit ActivationFrame(Dart_ActivationFrame activationFrame) |
| 108 { | 120 { |
| 109 m_isJavaScript = false; | 121 m_isJavaScript = false; |
| 110 m_dartActivationFrame = activationFrame; | 122 m_dartActivationFrame = activationFrame; |
| 111 } | 123 } |
| 112 | 124 |
| 113 bool isJavaScript() const { return m_isJavaScript; } | 125 bool isJavaScript() const { return m_isJavaScript; } |
| 126 | |
| 114 ScriptValue asJavaScript() const | 127 ScriptValue asJavaScript() const |
| 115 { | 128 { |
| 116 ASSERT(m_isJavaScript); | 129 ASSERT(m_isJavaScript); |
| 117 return m_scriptValue; | 130 return m_scriptValue; |
| 118 } | 131 } |
| 119 | 132 |
| 120 Dart_ActivationFrame asDart() const | 133 Dart_ActivationFrame asDart() const |
| 121 { | 134 { |
| 122 ASSERT(!m_isJavaScript); | 135 ASSERT(!m_isJavaScript); |
| 123 return m_dartActivationFrame; | 136 return m_dartActivationFrame; |
| 124 } | 137 } |
| 125 | 138 |
| 126 private: | 139 private: |
| 127 bool m_isJavaScript; | 140 bool m_isJavaScript; |
| 128 ScriptValue m_scriptValue; | 141 ScriptValue m_scriptValue; |
| 129 Dart_ActivationFrame m_dartActivationFrame; | 142 Dart_ActivationFrame m_dartActivationFrame; |
| 130 }; | 143 }; |
| 131 | 144 |
| 145 class StackTraceTimestamp { | |
|
vsm
2014/08/29 08:42:08
Can you add a class or file level comment sketchin
Jacob
2014/09/05 23:35:55
Removed this class as it is obsolete if both VMs p
| |
| 146 public: | |
| 147 StackTraceTimestamp(size_t stackDepth); | |
| 148 | |
| 149 int64_t timestamp() const { return m_timestamp; } | |
| 150 size_t stackDepth() const { return m_stackDepth; } | |
|
vsm
2014/08/29 08:42:08
Add comment: depth in frames or bytes?
Jacob
2014/09/05 23:35:55
removed this class with switch to new faster appro
| |
| 151 private: | |
| 152 int64_t m_timestamp; | |
| 153 size_t m_stackDepth; | |
| 154 }; | |
| 155 | |
| 156 class StackTraceTimestampTracker { | |
| 157 public: | |
| 158 void decrementRecursionLevel() { m_samples.removeLast(); } | |
| 159 | |
| 160 void incrementRecursionLevel(size_t stackDepth) | |
| 161 { | |
| 162 m_samples.append(StackTraceTimestamp(stackDepth)); | |
| 163 } | |
| 164 | |
| 165 size_t recursionLevel() { return m_samples.size(); } | |
| 166 int64_t getTimestamp(size_t frame); | |
| 167 private: | |
| 168 Vector<StackTraceTimestamp> m_samples; | |
| 169 }; | |
| 170 | |
| 132 } // namespace WebCore | 171 } // namespace WebCore |
| 133 | 172 |
| 134 #endif // StackTrace_h | 173 #endif // StackTrace_h |
| OLD | NEW |