Commit 19168e5f authored by Jasper Chapman-Black's avatar Jasper Chapman-Black Committed by Commit Bot

SuperSize: Caspian: Display .sizediffs in diff mode

Previously the WebAssembly web worker assumed that it should render in
diff mode if and only if it was passed a |before| to compare against.
With .sizediffs, this assumption no longer holds - the WebAssembly
worker extracts both .size files from a single field, so we have to tell
JavaScript that it's a diff.

Change-Id: I972f7eaca9508c87c033b3f78ad169afa70f2ebc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1954194
Commit-Queue: Jasper Chapman-Black <jaspercb@chromium.org>
Reviewed-by: default avatarSamuel Huang <huangs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#722528}
parent ff00227a
...@@ -60,7 +60,10 @@ void LoadBeforeSizeFile(const char* compressed, size_t size) { ...@@ -60,7 +60,10 @@ void LoadBeforeSizeFile(const char* compressed, size_t size) {
ParseSizeInfo(compressed, size, before_info.get()); ParseSizeInfo(compressed, size, before_info.get());
} }
void BuildTree(bool method_count_mode, // Updates |builder| with provided filters and constructs the new tree.
// Typically called when the front-end form updates, to apply any new filters.
// Returns: True if the resulting tree is a diff, false if it is a snapshot.
bool BuildTree(bool method_count_mode,
const char* group_by, const char* group_by,
const char* include_regex_str, const char* include_regex_str,
const char* exclude_regex_str, const char* exclude_regex_str,
...@@ -158,6 +161,8 @@ void BuildTree(bool method_count_mode, ...@@ -158,6 +161,8 @@ void BuildTree(bool method_count_mode,
exit(1); exit(1);
} }
builder->Build(std::move(lens), sep, method_count_mode, filters); builder->Build(std::move(lens), sep, method_count_mode, filters);
return bool(diff_info);
} }
const char* Open(const char* path) { const char* Open(const char* path) {
......
...@@ -128,10 +128,10 @@ async function buildTree( ...@@ -128,10 +128,10 @@ async function buildTree(
} }
const BuildTree = Module.cwrap( const BuildTree = Module.cwrap(
'BuildTree', 'void', 'BuildTree', 'bool',
['bool', 'string', 'string', 'string', 'string', 'number', 'number']); ['bool', 'string', 'string', 'string', 'string', 'number', 'number']);
const start_time = Date.now(); const start_time = Date.now();
BuildTree( const diffMode = BuildTree(
methodCountMode, groupBy, includeRegex, excludeRegex, methodCountMode, groupBy, includeRegex, excludeRegex,
includeSections, minSymbolSize, flagToFilter); includeSections, minSymbolSize, flagToFilter);
console.log( console.log(
...@@ -141,9 +141,9 @@ async function buildTree( ...@@ -141,9 +141,9 @@ async function buildTree(
const root = await Open(''); const root = await Open('');
return { return {
root: root, root,
percent: 1.0, percent: 1.0,
diffMode: beforeFetcher !== null, // diff mode diffMode,
}; };
}); });
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment