Index: src/inspector/wasm-translation.h |
diff --git a/src/inspector/wasm-translation.h b/src/inspector/wasm-translation.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9f8825aea2fd5cc9e34c82a7dedd996f2dd95e20 |
--- /dev/null |
+++ b/src/inspector/wasm-translation.h |
@@ -0,0 +1,72 @@ |
+// Copyright 2016 the V8 project authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef V8_INSPECTOR_WASMTRANSLATION_H_ |
+#define V8_INSPECTOR_WASMTRANSLATION_H_ |
+ |
+#include <unordered_map> |
+ |
+#include "include/v8.h" |
+#include "src/base/macros.h" |
+#include "src/inspector/string-16.h" |
+ |
+namespace v8_inspector { |
+ |
+// Forward declarations. |
+class V8DebuggerAgentImpl; |
+class V8DebuggerScript; |
+struct ScriptBreakpoint; |
+namespace protocol { |
+namespace Debugger { |
+class Location; |
+} |
+} |
+ |
+class WasmTranslation { |
+ public: |
+ enum Mode { Raw, Disassemble }; |
+ |
+ WasmTranslation(v8::Isolate* isolate, V8DebuggerAgentImpl* debugger); |
+ ~WasmTranslation(); |
+ |
+ void SetMode(Mode mode) { mode_ = mode; } |
+ |
+ void AddScript(v8::Local<v8::Object> script_wrapper); |
+ |
+ void Clear(); |
+ |
+ /** |
+ * Translate a protocol-location to artificial wasm scripts. |
+ */ |
titzer
2016/11/11 10:59:02
Line comments instead of block comments?
Clemens Hammacher
2016/11/16 11:36:28
Done.
|
+ bool Translate(protocol::Debugger::Location* location); |
dgozman
2016/11/11 21:50:35
What's the result of this function?
Clemens Hammacher
2016/11/16 11:36:28
Documented now.
|
+ |
+ /** |
+ * Translate raw data to wasm scripts. Line and column are 0-based. |
+ */ |
+ bool Translate(String16* script_id, int* line_number, int* column_number); |
+ |
+ /** |
+ * Translate back from ariticial wasm scripts to the underlying original |
+ * script. |
+ */ |
+ bool TranslateBack(ScriptBreakpoint* breakpoint); |
+ |
+ private: |
+ class TranslatorImpl; |
+ friend class TranslatorImpl; |
+ |
+ void AddFakeScript(std::unique_ptr<V8DebuggerScript> fake_script, |
+ TranslatorImpl* translator); |
+ |
+ v8::Isolate* isolate_; |
+ V8DebuggerAgentImpl* debugger_agent_; |
+ std::unordered_map<int, std::unique_ptr<TranslatorImpl>> wasm_translators_; |
+ std::unordered_map<String16, TranslatorImpl*> fake_scripts_; |
+ Mode mode_; |
+ DISALLOW_COPY_AND_ASSIGN(WasmTranslation); |
+}; |
+ |
+} // namespace v8_inspector |
+ |
+#endif // V8_INSPECTOR_WASMTRANSLATION_H_ |