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

Side by Side Diff: src/inspector/wasm-translation.h

Issue 2493773003: [inspector] Introduce translation of wasm frames (Closed)
Patch Set: Address comments Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
(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 // Translate a protocol-location to artificial wasm scripts. Does nothing for
40 // non-wasm locations. Returns true if the location was translated, false
41 // otherwise.
42 bool Translate(protocol::Debugger::Location* location);
titzer 2016/11/16 14:23:59 Should this be AddTranslation()? From what I can
Clemens Hammacher 2016/11/16 15:21:19 Updated the documentation and renamed as discussed
43
44 // Translate raw data to wasm scripts. Line and column are 0-based.
45 // Does nothing for non-wasm locations. Returns true if the location was
46 // translated, false otherwise.
47 bool Translate(String16* script_id, int* line_number, int* column_number);
48
49 // Translate a breakpoint location back from artificial wasm scripts to the
50 // underlying original script.
51 // Returns true if the translation was translated, false otherwise.
52 bool TranslateBack(ScriptBreakpoint* breakpoint);
titzer 2016/11/16 14:23:59 Can you name this method closer to what the commen
Clemens Hammacher 2016/11/16 15:21:19 Changed as discussed offline.
53
54 private:
55 class TranslatorImpl;
56 friend class TranslatorImpl;
57
58 void AddFakeScript(std::unique_ptr<V8DebuggerScript> fake_script,
59 TranslatorImpl* translator);
60
61 v8::Isolate* isolate_;
62 V8DebuggerAgentImpl* debugger_agent_;
63 std::unordered_map<int, std::unique_ptr<TranslatorImpl>> wasm_translators_;
64 std::unordered_map<String16, TranslatorImpl*> fake_scripts_;
65 Mode mode_;
66 DISALLOW_COPY_AND_ASSIGN(WasmTranslation);
67 };
68
69 } // namespace v8_inspector
70
71 #endif // V8_INSPECTOR_WASMTRANSLATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698