Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Unified Diff: Source/bindings/common/ScriptValue.h

Issue 300393002: Merge DevTools Refactor CL to Blink36 (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/1985
Patch Set: PTAL Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/common/ScriptValue.h
diff --git a/Source/bindings/common/ScriptValue.h b/Source/bindings/common/ScriptValue.h
index 95a6ac95d0427c944843c8005bdb83e4f6593923..cba00e0baa204c091097053d6c523fb5a9b95c39 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 {
@@ -173,6 +174,99 @@ 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
+ {
+ ASSERT(m_isJavaScript);
+ return m_scriptValue;
+ }
+
+ Dart_StackTrace asDart() const
+ {
+ ASSERT(!m_isJavaScript);
+ 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
+ {
+ ASSERT(m_isJavaScript);
+ return m_scriptValue;
+ }
+
+ Dart_ActivationFrame asDart() const
+ {
+ ASSERT(!m_isJavaScript);
+ return m_dartActivationFrame;
+ }
+
+private:
+ bool m_isJavaScript;
+ ScriptValue m_scriptValue;
+ Dart_ActivationFrame m_dartActivationFrame;
+};
+
} // namespace WebCore
#endif // ScriptValue_h

Powered by Google App Engine
This is Rietveld 408576698