Chromium Code Reviews| Index: Source/bindings/common/ScriptValue.h |
| diff --git a/Source/bindings/common/ScriptValue.h b/Source/bindings/common/ScriptValue.h |
| index fd3fc10c43b8e476fdb6f34cfcb6a4c0e5825576..491a54beff519c9e63ab4ec57ff75dccab58aa37 100644 |
| --- a/Source/bindings/common/ScriptValue.h |
| +++ b/Source/bindings/common/ScriptValue.h |
| @@ -38,6 +38,7 @@ |
| #include "wtf/PassRefPtr.h" |
| #include "wtf/RefPtr.h" |
| #include "wtf/text/WTFString.h" |
| +#include <dart_debugger_api.h> |
| #include <v8.h> |
| namespace WebCore { |
| @@ -184,6 +185,88 @@ private: |
| RefPtr<AbstractScriptValue> m_implScriptValue; |
| }; |
| +// FIXMEDART: where should we define this class that holds either a V8 or Dart |
| +// stack trace? |
| +class StackTrace { |
| +public: |
| + explicit StackTrace() |
| + { |
| + m_isJavaScript = true; |
| + m_dartStackTrace = 0; |
| + } |
| + |
| + explicit StackTrace(const ScriptValue& stackTrace) |
| + { |
| + m_isJavaScript = true; |
| + m_scriptValue = stackTrace; |
| + m_dartStackTrace = 0; |
| + } |
| + |
| + explicit StackTrace(Dart_StackTrace stackTrace) |
| + { |
| + m_isJavaScript = false; |
| + m_dartStackTrace = stackTrace; |
| + } |
| + |
| + bool isJavaScript() const |
| + { |
| + return m_isJavaScript; |
| + } |
| + |
| + ScriptValue asJavaScript() const |
| + { |
|
vsm
2014/06/03 14:24:49
ASSERT(m_isJavaScript) ?
Jacob
2014/06/03 20:23:12
Done.
|
| + return m_scriptValue; |
| + } |
| + |
| + Dart_StackTrace asDart() const |
| + { |
|
vsm
2014/06/03 14:24:49
ASSERT(!m_isJavaScript) ?
Jacob
2014/06/03 20:23:12
Done.
|
| + return m_dartStackTrace; |
| + } |
| + |
| + bool isNull() const |
| + { |
| + return m_isJavaScript ? m_scriptValue.isNull() : !m_dartStackTrace; |
| + } |
| + |
| +private: |
| + bool m_isJavaScript; |
| + ScriptValue m_scriptValue; |
|
rmacnak
2014/06/03 17:32:34
RefPtr<V8ScriptValue>
Jacob
2014/06/03 20:23:13
Done.
|
| + Dart_StackTrace m_dartStackTrace; |
| +}; |
| + |
| +// FIXMEDART: where should we define this class that holds either a V8 or Dart |
| +// activation frame? |
| +class ActivationFrame { |
| +public: |
| + explicit ActivationFrame() |
| + { |
| + m_isJavaScript = true; |
| + m_dartActivationFrame = 0; |
| + } |
| + |
| + explicit ActivationFrame(const ScriptValue& activationFrame) |
| + { |
| + m_isJavaScript = true; |
| + m_scriptValue = activationFrame; |
| + m_dartActivationFrame = 0; |
| + } |
| + |
| + explicit ActivationFrame(Dart_ActivationFrame activationFrame) |
| + { |
| + m_isJavaScript = false; |
| + m_dartActivationFrame = activationFrame; |
| + } |
| + |
| + bool isJavaScript() const { return m_isJavaScript; } |
| + ScriptValue asJavaScript() const { return m_scriptValue; } |
| + Dart_ActivationFrame asDart() const { return m_dartActivationFrame; } |
|
vsm
2014/06/03 14:24:49
Ditto on asserts for these two.
Jacob
2014/06/03 20:23:13
Done.
|
| + |
| +private: |
| + bool m_isJavaScript; |
| + ScriptValue m_scriptValue; |
|
rmacnak
2014/06/03 17:32:34
RefPtr<V8ScriptValue>
Jacob
2014/06/03 20:23:12
Done.
|
| + Dart_ActivationFrame m_dartActivationFrame; |
| +}; |
| + |
| } // namespace WebCore |
| #endif // ScriptValue_h |