Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit 019a83d

Browse files
ulanchromium-wpt-export-bot
authored andcommitted
Initial implementation of performance.measureMemory API
This adds IDL files and an experimental feature flag for the API. The implementation simply forwards to v8::Isolate::MeasureMemory. Bug: 973627 Change-Id: I80ac8b78e81a6fad6b25370b419a0392f6589cee Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1796364 Reviewed-by: Yoav Weiss <[email protected]> Reviewed-by: Kentaro Hara <[email protected]> Commit-Queue: Ulan Degenbaev <[email protected]> Cr-Commit-Position: refs/heads/master@{#703262}
1 parent 238225a commit 019a83d

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

measure-memory/META.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
suggested_reviewers:
2+
- ulan

measure-memory/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Tentative tests for performance.measureMemory API
2+
3+
Tests in this directory are for the proposed performance.measureMemory API.
4+
This is not yet standardised and browsers should not be expected to pass
5+
these tests.
6+
7+
See the explainer at
8+
https://github.com/ulan/javascript-agent-memory/blob/master/explainer.md
9+
for more information about the API.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
function checkMeasureMemoryResultSummary(result) {
2+
assert_own_property(result, "total");
3+
assert_own_property(result.total, "jsMemoryEstimate");
4+
assert_own_property(result.total, "jsMemoryRange");
5+
assert_equals(result.total.jsMemoryRange.length, 2);
6+
assert_greater_than_equal(
7+
result.total.jsMemoryRange[1],
8+
result.total.jsMemoryRange[0]);
9+
assert_greater_than_equal(
10+
result.total.jsMemoryEstimate,
11+
result.total.jsMemoryRange[0]);
12+
assert_greater_than_equal(
13+
result.total.jsMemoryRange[1],
14+
result.total.jsMemoryEstimate);
15+
}
16+
17+
promise_test(async testCase => {
18+
let result = await performance.measureMemory();
19+
checkMeasureMemoryResultSummary(result);
20+
}, 'Well-formed result of performance.measureMemory with default arguments.');
21+
22+
promise_test(async testcase => {
23+
let result = await performance.measureMemory({detailed: false});
24+
checkMeasureMemoryResultSummary(result);
25+
}, 'well-formed result of performance.measurememory with detailed=false.');

0 commit comments

Comments
 (0)