Commit 2d69cb75 authored by Kramer Ge's avatar Kramer Ge Committed by Commit Bot

Revert "[Longtasks] Fix buffering before observer"

This reverts commit c2d62d36.

Reason for revert: suspect for crbug.com/1138522

Original change's description:
> [Longtasks] Fix buffering before observer
>
> When we shipped longtasks with buffered flag, we forgot to remove a
> check that would prevent longtask creation when there's no observer.
> This CL fixes this and adds a test for this case. It also moves the
> UseCounter to the observe() method.
>
> Bug: 1131385
> Change-Id: I2911b9ab044db7394bcf64f64b1e599959cbdc37
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2463594
> Reviewed-by: Steve Kobes <skobes@chromium.org>
> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#816664}

TBR=skobes@chromium.org,npm@chromium.org

Change-Id: I03483b9cc1e8ce03b518d90df16e54e4503f5ffc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1131385
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2472258Reviewed-by: default avatarKramer Ge <fangzhoug@chromium.org>
Commit-Queue: Kramer Ge <fangzhoug@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817101}
parent 2de73b1d
......@@ -675,6 +675,10 @@ void Performance::AddLongTaskTiming(base::TimeTicks start_time,
const String& container_src,
const String& container_id,
const String& container_name) {
if (!HasObserverFor(PerformanceEntry::kLongTask))
return;
UseCounter::Count(GetExecutionContext(), WebFeature::kLongTaskObserver);
auto* entry = MakeGarbageCollected<PerformanceLongTaskTiming>(
MonotonicTimeToDOMHighResTimeStamp(start_time),
MonotonicTimeToDOMHighResTimeStamp(end_time), name, container_type,
......
......@@ -211,9 +211,6 @@ void PerformanceObserver::observe(const PerformanceObserverInit* observer_init,
if (filter_options_ & PerformanceEntry::kResource) {
UseCounter::Count(GetExecutionContext(), WebFeature::kResourceTiming);
}
if (filter_options_ & PerformanceEntry::kLongTask) {
UseCounter::Count(GetExecutionContext(), WebFeature::kLongTaskObserver);
}
if (is_registered_)
performance_->UpdatePerformanceObserverFilterOptions();
else
......
async_test(t => {
assert_implements(window.PerformanceLongTaskTiming, 'Longtasks are not supported.');
// Create a long task before any observer.
const begin = window.performance.now();
while (window.performance.now() < begin + 60);
// After a timeout, add an observer with buffered flag.
t.step_timeout(() => {
new PerformanceObserver(t.step_func_done(list => {
list.getEntries().forEach(entry => {
assert_equals(entry.entryType, 'longtask');
assert_equals(entry.name, 'self');
assert_greater_than(entry.duration, 50);
});
})).observe({type: 'longtask', buffered: true});
}, 0);
}, 'PerformanceObserver with buffered flag can see previous longtask entries.');
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