OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 the V8 project authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef V8_INSPECTOR_WASMTRANSLATION_H_ | |
6 #define V8_INSPECTOR_WASMTRANSLATION_H_ | |
7 | |
8 #include <unordered_map> | |
9 | |
10 #include "include/v8.h" | |
11 #include "src/base/macros.h" | |
12 #include "src/inspector/string-16.h" | |
13 | |
14 namespace v8_inspector { | |
15 | |
16 // Forward declarations. | |
17 class V8DebuggerAgentImpl; | |
18 class V8DebuggerScript; | |
19 struct ScriptBreakpoint; | |
20 namespace protocol { | |
21 namespace Debugger { | |
22 class Location; | |
23 } | |
24 } | |
25 | |
26 class WasmTranslation { | |
27 public: | |
28 enum Mode { Raw, Disassemble }; | |
29 | |
30 WasmTranslation(v8::Isolate* isolate, V8DebuggerAgentImpl* debugger); | |
31 ~WasmTranslation(); | |
32 | |
33 void SetMode(Mode mode) { mode_ = mode; } | |
34 | |
35 void AddScript(v8::Local<v8::Object> script_wrapper); | |
36 | |
37 void Clear(); | |
38 | |
39 /** | |
40 * Translate a protocol-location to artificial wasm scripts. | |
41 */ | |
titzer
2016/11/11 10:59:02
Line comments instead of block comments?
Clemens Hammacher
2016/11/16 11:36:28
Done.
| |
42 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.
| |
43 | |
44 /** | |
45 * Translate raw data to wasm scripts. Line and column are 0-based. | |
46 */ | |
47 bool Translate(String16* script_id, int* line_number, int* column_number); | |
48 | |
49 /** | |
50 * Translate back from ariticial wasm scripts to the underlying original | |
51 * script. | |
52 */ | |
53 bool TranslateBack(ScriptBreakpoint* breakpoint); | |
54 | |
55 private: | |
56 class TranslatorImpl; | |
57 friend class TranslatorImpl; | |
58 | |
59 void AddFakeScript(std::unique_ptr<V8DebuggerScript> fake_script, | |
60 TranslatorImpl* translator); | |
61 | |
62 v8::Isolate* isolate_; | |
63 V8DebuggerAgentImpl* debugger_agent_; | |
64 std::unordered_map<int, std::unique_ptr<TranslatorImpl>> wasm_translators_; | |
65 std::unordered_map<String16, TranslatorImpl*> fake_scripts_; | |
66 Mode mode_; | |
67 DISALLOW_COPY_AND_ASSIGN(WasmTranslation); | |
68 }; | |
69 | |
70 } // namespace v8_inspector | |
71 | |
72 #endif // V8_INSPECTOR_WASMTRANSLATION_H_ | |
OLD | NEW |