Index: Source/bindings/common/StackTrace.h |
diff --git a/Source/bindings/common/ScriptValue.h b/Source/bindings/common/StackTrace.h |
similarity index 69% |
copy from Source/bindings/common/ScriptValue.h |
copy to Source/bindings/common/StackTrace.h |
index 95a6ac95d0427c944843c8005bdb83e4f6593923..491a54beff519c9e63ab4ec57ff75dccab58aa37 100644 |
--- a/Source/bindings/common/ScriptValue.h |
+++ b/Source/bindings/common/StackTrace.h |
@@ -38,13 +38,13 @@ |
#include "wtf/PassRefPtr.h" |
#include "wtf/RefPtr.h" |
#include "wtf/text/WTFString.h" |
+#include <dart_debugger_api.h> |
#include <v8.h> |
namespace WebCore { |
class JSONValue; |
class ScriptState; |
-class V8ScriptState; |
// Indirection to avoid re-writing the parts of Blink that pass ScriptValue by |
// value. |
@@ -66,7 +66,7 @@ public: |
{ |
} |
- ScriptValue(V8ScriptState* scriptState, v8::Handle<v8::Value> value) |
+ ScriptValue(ScriptState* scriptState, v8::Handle<v8::Value> value) |
: m_implScriptValue(V8ScriptValue::create(scriptState, value)) |
{ |
} |
@@ -81,6 +81,18 @@ public: |
{ |
} |
+ // FIXME: Replace with an instance member of ScriptState. |
+ static ScriptValue createNull() |
+ { |
+ return ScriptValue(V8ScriptValue::createNull()); |
+ } |
+ |
+ // FIXME: Replace with an instance member of ScriptState. |
+ static ScriptValue createBoolean(bool b) |
+ { |
+ return ScriptValue(V8ScriptValue::createBoolean(b)); |
+ } |
+ |
ScriptState* scriptState() const |
{ |
return m_implScriptValue->scriptState(); |
@@ -173,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 |
+ { |
+ return m_scriptValue; |
+ } |
+ |
+ Dart_StackTrace asDart() const |
+ { |
+ return m_dartStackTrace; |
+ } |
+ |
+ bool isNull() const |
+ { |
+ return m_isJavaScript ? m_scriptValue.isNull() : !m_dartStackTrace; |
+ } |
+ |
+private: |
+ bool m_isJavaScript; |
+ ScriptValue m_scriptValue; |
+ 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; } |
+ |
+private: |
+ bool m_isJavaScript; |
+ ScriptValue m_scriptValue; |
+ Dart_ActivationFrame m_dartActivationFrame; |
+}; |
+ |
} // namespace WebCore |
#endif // ScriptValue_h |