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

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

Issue 2532433003: [inspector] Split V8DebuggerScript implementation for wasm (Closed)
Patch Set: Minor refactoring Created 4 years 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
1 // Copyright 2016 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/inspector/wasm-translation.h" 5 #include "src/inspector/wasm-translation.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "src/debug/debug-interface.h" 9 #include "src/debug/debug-interface.h"
10 #include "src/inspector/protocol/Debugger.h" 10 #include "src/inspector/protocol/Debugger.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 DebugInterface::DisassembleWasmFunction(isolate, script_.Get(isolate), 176 DebugInterface::DisassembleWasmFunction(isolate, script_.Get(isolate),
177 func_index); 177 func_index);
178 178
179 it = offset_tables_ 179 it = offset_tables_
180 .insert(std::make_pair(func_index, std::move(disassembly.second))) 180 .insert(std::make_pair(func_index, std::move(disassembly.second)))
181 .first; 181 .first;
182 182
183 String16 fake_script_id = GetFakeScriptId(loc); 183 String16 fake_script_id = GetFakeScriptId(loc);
184 String16 fake_script_url = GetFakeScriptUrl(loc); 184 String16 fake_script_url = GetFakeScriptUrl(loc);
185 String16 source(disassembly.first.data(), disassembly.first.length()); 185 String16 source(disassembly.first.data(), disassembly.first.length());
186 std::unique_ptr<V8DebuggerScript> fake_script(new V8DebuggerScript(
187 fake_script_id, std::move(fake_script_url), source));
188 186
189 loc->translation->AddFakeScript(std::move(fake_script), this, 187 Local<DebugInterface::Script> script_wrapper =
190 loc->context_group_id); 188 DebugInterface::Script::Wrap(isolate, script_.Get(isolate))
189 .ToLocalChecked();
190 loc->translation->AddFakeScript(
191 V8DebuggerScript::CreateWasm(script_wrapper, std::move(fake_script_id),
192 std::move(fake_script_url),
193 std::move(source)),
194 this, loc->context_group_id);
191 195
192 return it->second; 196 return it->second;
193 } 197 }
194 198
195 const OffsetTable *GetReverseTable(int func_index) { 199 const OffsetTable *GetReverseTable(int func_index) {
196 auto it = reverse_tables_.find(func_index); 200 auto it = reverse_tables_.find(func_index);
197 if (it != reverse_tables_.end()) return &it->second; 201 if (it != reverse_tables_.end()) return &it->second;
198 202
199 // Find offset table, copy and sort it to get reverse table. 203 // Find offset table, copy and sort it to get reverse table.
200 it = offset_tables_.find(func_index); 204 it = offset_tables_.find(func_index);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 int context_group_id) { 305 int context_group_id) {
302 bool inserted = 306 bool inserted =
303 fake_scripts_.insert(std::make_pair(fake_script->scriptId(), translator)) 307 fake_scripts_.insert(std::make_pair(fake_script->scriptId(), translator))
304 .second; 308 .second;
305 DCHECK(inserted); 309 DCHECK(inserted);
306 USE(inserted); 310 USE(inserted);
307 V8DebuggerAgentImpl *agent = 311 V8DebuggerAgentImpl *agent =
308 debugger_->inspector()->enabledDebuggerAgentForGroup(context_group_id); 312 debugger_->inspector()->enabledDebuggerAgentForGroup(context_group_id);
309 agent->didParseSource(std::move(fake_script), true); 313 agent->didParseSource(std::move(fake_script), true);
310 } 314 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698