Commit e52fcc1d authored by Yoav Weiss's avatar Yoav Weiss Committed by Commit Bot

Change Resource Timing default buffer size to 250.

Following a proposed spec change[1], this CL changes the number of entries
buffered by default before the Resource Timing buffer is full.

[1] https://github.com/w3c/resource-timing/pull/155

Bug: 847689
Change-Id: Id93bfea902b0cf049abdac12a98cc4fba7ff1dd3
Reviewed-on: https://chromium-review.googlesource.com/1078107Reviewed-by: default avatarNicolás Peña Moreno <npm@chromium.org>
Commit-Queue: Yoav Weiss <yoav@yoav.ws>
Cr-Commit-Position: refs/heads/master@{#563133}
parent b333bdee
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
<title>This test validates that resource timing implementations have a finite number of entries in their buffer.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
const t = async_test("Finite resource timing entries buffer size");
performance.onresourcetimingbufferfull = t.step_func_done(function() {
});
window.onload = t.step_func(
function() {
// Scripts appended in JS to ensure setResourceTimingBufferSize is called before.
let counter = performance.getEntriesByType("resource").length;
function appendScript() {
const src = "resources/empty.js?" + counter;
const script = document.createElement('script');
script.type = 'text/javascript';
script.onload = function() { ++counter; appendScript()};
script.src = src;
document.body.appendChild(script);
}
appendScript();
});
</script>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<link rel="help" href="http://www.w3.org/TR/resource-timing/#performanceresourcetiming"/>
<title>This test validates that resource timing implementations have a finite number of entries in their buffer.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
const t = async_test("Default resource timing entries buffer size");
const default_buffer_size = 250;
performance.onresourcetimingbufferfull = t.step_func_done(function() {
assert_equals(performance.getEntriesByType("resource").length, default_buffer_size);
});
window.onload = t.step_func(
function() {
// Scripts appended in JS to ensure setResourceTimingBufferSize is called before.
let counter = performance.getEntriesByType("resource").length;
function appendScript() {
if (counter > default_buffer_size) {
t.step_timeout(function() {
assert_unreached("Got no buffer full event at " + counter + " resources");
}, 100);
return;
}
const src = "../loading/resources/empty.js?" + counter;
const script = document.createElement('script');
script.type = 'text/javascript';
script.onload = function() { ++counter; appendScript()};
script.src = src;
document.body.appendChild(script);
}
appendScript();
});
</script>
</body>
</html>
...@@ -84,7 +84,7 @@ DOMHighResTimeStamp GetUnixAtZeroMonotonic() { ...@@ -84,7 +84,7 @@ DOMHighResTimeStamp GetUnixAtZeroMonotonic() {
using PerformanceObserverVector = HeapVector<Member<PerformanceObserver>>; using PerformanceObserverVector = HeapVector<Member<PerformanceObserver>>;
static const size_t kDefaultResourceTimingBufferSize = 150; static const size_t kDefaultResourceTimingBufferSize = 250;
static const size_t kDefaultFrameTimingBufferSize = 150; static const size_t kDefaultFrameTimingBufferSize = 150;
constexpr size_t kDefaultEventTimingBufferSize = 150; constexpr size_t kDefaultEventTimingBufferSize = 150;
......
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