perfetto-ui: Remove _wasm suffix from js files
Remove the recently tntroduced "_wasm" suffix from:
trace_processor_wasm.wasm
trace_processor_wasm.js
trace_processor_wasm.d.ts
While retaining the target name of trace_processor_wasm.
To do this we enforce users of wasm_lib set a name variable such that
name + "_wasm" == target_name
(i.e. "trace_processor" + "_wasm" == "trace_processor_wasm").
This isn't ideal but there is only one user of wasm_lib at the moment.
This implicilty fixes the bug where we had forgot to update a refrence
to the new name somewhere.
Change-Id: I5641f62ac68f2f185a28e2203f5760ef949c8294
diff --git a/gn/standalone/wasm.gni b/gn/standalone/wasm.gni
index be108dd..0304007 100644
--- a/gn/standalone/wasm.gni
+++ b/gn/standalone/wasm.gni
@@ -34,7 +34,11 @@
# generate_html: when true generates also an example .html file which contains
# a minimal console to interact with the module (useful for testing).
template("wasm_lib") {
- _lib_name = target_name
+ assert(defined(invoker.name))
+
+ # If the name is foo the target_name must be foo_wasm.
+ assert(invoker.name + "_wasm" == target_name)
+ _lib_name = invoker.name
if (is_wasm) {
assert(defined(invoker.sources))
diff --git a/src/trace_processor/BUILD.gn b/src/trace_processor/BUILD.gn
index 9215c8d..ba2e29e 100644
--- a/src/trace_processor/BUILD.gn
+++ b/src/trace_processor/BUILD.gn
@@ -16,6 +16,7 @@
import("../../gn/wasm.gni")
wasm_lib("trace_processor_wasm") {
+ name = "trace_processor"
sources = [
"wasm_bridge.cc",
]
diff --git a/ui/BUILD.gn b/ui/BUILD.gn
index fca5f67..104b6e8 100644
--- a/ui/BUILD.gn
+++ b/ui/BUILD.gn
@@ -325,10 +325,10 @@
copy("wasm_dist") {
deps = [
- "//src/trace_processor:trace_processor_wasm.wasm($wasm_toolchain)",
+ "//src/trace_processor:trace_processor.wasm($wasm_toolchain)",
]
sources = [
- "$root_build_dir/wasm/trace_processor_wasm.wasm",
+ "$root_build_dir/wasm/trace_processor.wasm",
]
outputs = [
"$ui_dir/{{source_file_part}}",
@@ -338,14 +338,14 @@
copy("wasm_gen") {
deps = [
":dist_symlink",
- "//src/trace_processor:trace_processor_wasm.d.ts($wasm_toolchain)",
- "//src/trace_processor:trace_processor_wasm.js($wasm_toolchain)",
- "//src/trace_processor:trace_processor_wasm.wasm($wasm_toolchain)",
+ "//src/trace_processor:trace_processor.d.ts($wasm_toolchain)",
+ "//src/trace_processor:trace_processor.js($wasm_toolchain)",
+ "//src/trace_processor:trace_processor.wasm($wasm_toolchain)",
]
sources = [
- "$root_build_dir/wasm/trace_processor_wasm.d.ts",
- "$root_build_dir/wasm/trace_processor_wasm.js",
- "$root_build_dir/wasm/trace_processor_wasm.wasm",
+ "$root_build_dir/wasm/trace_processor.d.ts",
+ "$root_build_dir/wasm/trace_processor.js",
+ "$root_build_dir/wasm/trace_processor.wasm",
]
outputs = [
"$ui_gen_dir/{{source_file_part}}",
diff --git a/ui/index.html b/ui/index.html
index c49b2a5..e0cfa3f 100644
--- a/ui/index.html
+++ b/ui/index.html
@@ -7,7 +7,7 @@
<link rel="icon" type="image/png" href="/assets/logo.png">
<link rel="preload" href="controller_bundle.js" as="script">
<link rel="preload" href="engine_bundle.js" as="script">
- <link rel="preload" href="trace_processor_wasm.wasm" as="fetch">
+ <link rel="preload" href="trace_processor.wasm" as="fetch">
<link href='https://fonts.googleapis.com/css?family=Raleway:100,400|Google+Sans:100,400,500|Roboto+Mono|Material+Icons' rel='stylesheet' type='text/css'>
</head>
<body>
diff --git a/ui/src/engine/wasm_bridge.ts b/ui/src/engine/wasm_bridge.ts
index 580911a..609ff01 100644
--- a/ui/src/engine/wasm_bridge.ts
+++ b/ui/src/engine/wasm_bridge.ts
@@ -13,7 +13,7 @@
// limitations under the License.
import {defer, Deferred} from '../base/deferred';
-import * as init_trace_processor from '../gen/trace_processor_wasm';
+import * as init_trace_processor from '../gen/trace_processor';
function writeToUIConsole(line: string) {
console.log(line);