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

Unified Diff: src/inspector/wasm-translation.cc

Issue 2555433002: [inspector] [wasm] Add folder structure to wasm urls (Closed)
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/wasm-translation.cc
diff --git a/src/inspector/wasm-translation.cc b/src/inspector/wasm-translation.cc
index c23bdce8075ebed55175f82dde6872c11dfa4806..1a7c9cfe40aa4b9ebe8dacd73495744e3eef08c0 100644
--- a/src/inspector/wasm-translation.cc
+++ b/src/inspector/wasm-translation.cc
@@ -134,17 +134,24 @@ class WasmTranslation::TranslatorImpl::DisassemblingTranslator
}
private:
- String16 GetScriptName(v8::Isolate *isolate) {
- return toProtocolString(script_.Get(isolate)->Name().ToLocalChecked());
- }
-
String16 GetFakeScriptUrl(v8::Isolate *isolate, int func_index) {
- String16 script_name = GetScriptName(isolate);
- return String16::concat("wasm://wasm/", script_name, '/', script_name, '-',
- String16::fromInteger(func_index));
- }
- String16 GetFakeScriptUrl(const TransLocation *loc) {
- return GetFakeScriptUrl(loc->translation->isolate_, loc->line);
+ Local<debug::WasmScript> script = script_.Get(isolate);
+ String16 script_name = toProtocolString(script->Name().ToLocalChecked());
+ int numFunctions = script->NumFunctions();
+ int numImported = script->NumImportedFunctions();
+ String16Builder builder;
+ builder.appendAll("wasm://wasm/", script_name, '/');
+ if (numFunctions - numImported > 300) {
+ size_t digits = String16::fromInteger(numFunctions - 1).length();
+ String16 thisCategory = String16::fromInteger((func_index / 100) * 100);
+ DCHECK_LE(thisCategory.length(), digits);
+ for (size_t i = thisCategory.length(); i < digits; ++i)
+ builder.append('0');
+ builder.appendAll(thisCategory, '/');
+ }
+ builder.appendAll(script_name, '-');
+ builder.appendNumber(func_index);
+ return builder.toString();
}
String16 GetFakeScriptId(const String16 script_id, int func_index) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698