Revert flush behavior when disconnecting PerformanceObserver
This CL reverts the flush behavior introduced in
https://crrev.com/32102c0baf205ff54cd16644ddd823a6cb6538f5
This is reverted after upstream agreement that it is not really the
desired behavior, and to align with Mozilla's behavior:
https://github.com/w3c/performance-timeline/issues/66#issuecomment-282396844
Bug: chromium:607324
Change-Id: Ia38649f29f99d9c71f06da1a1a3318cc83a82e12
Reviewed-on: https://chromium-review.googlesource.com/606209
Reviewed-by: Timothy Dresser <tdresser@chromium.org>
Reviewed-by: Shubhie Panicker <panicker@chromium.org>
Reviewed-by: Steve Kobes <skobes@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#492826}
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index e1e9a8d..e9b6f16 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -2607,7 +2607,6 @@
crbug.com/709227 external/wpt/offscreen-canvas/the-offscreen-canvas/size.attributes.parse.onlyspace.worker.html [ Failure ]
crbug.com/709227 external/wpt/offscreen-canvas/the-offscreen-canvas/size.attributes.parse.percent.worker.html [ Failure ]
crbug.com/709227 external/wpt/offscreen-canvas/the-offscreen-canvas/size.attributes.parse.trailingjunk.worker.html [ Failure ]
-crbug.com/709227 external/wpt/performance-timeline/po-disconnect.any.worker.html [ Failure ]
crbug.com/709227 external/wpt/user-timing/invoke_with_timing_attributes.worker.html [ Failure ]
crbug.com/709227 external/wpt/websockets/closing-handshake/002.html?wss [ Failure ]
crbug.com/709227 external/wpt/websockets/closing-handshake/003.html?wss [ Failure ]
@@ -2663,7 +2662,6 @@
crbug.com/709227 external/wpt/websockets/unload-a-document/002.html?wss [ Failure ]
crbug.com/709227 external/wpt/performance-timeline/po-callback-mutate.any.html [ Failure ]
crbug.com/709227 external/wpt/performance-timeline/po-callback-mutate.any.worker.html [ Failure ]
-crbug.com/709227 external/wpt/performance-timeline/po-disconnect.any.html [ Failure ]
# Timeouts
crbug.com/709227 external/wpt/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/serialization-via-idb.any.worker.html [ Timeout ]
diff --git a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
index 2fd642a5..6513758 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
@@ -452,12 +452,6 @@
void PerformanceBase::UnregisterPerformanceObserver(
PerformanceObserver& old_observer) {
- // Deliver any pending observations on this observer before unregistering.
- if (active_observers_.Contains(&old_observer) &&
- !old_observer.ShouldBeSuspended()) {
- old_observer.Deliver();
- active_observers_.erase(&old_observer);
- }
observers_.erase(&old_observer);
UpdatePerformanceObserverFilterOptions();
UpdateLongTaskInstrumentation();
diff --git a/third_party/WebKit/Source/core/timing/PerformanceBaseTest.cpp b/third_party/WebKit/Source/core/timing/PerformanceBaseTest.cpp
index bb66152..54debdd 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceBaseTest.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceBaseTest.cpp
@@ -111,7 +111,7 @@
base_->UnregisterPerformanceObserver(*observer_.Get());
EXPECT_EQ(0, base_->NumObservers());
- EXPECT_EQ(0, base_->NumActiveObservers());
+ EXPECT_EQ(1, base_->NumActiveObservers());
}
TEST_F(PerformanceBaseTest, AddLongTaskTiming) {
diff --git a/third_party/WebKit/Source/core/timing/PerformanceObserver.cpp b/third_party/WebKit/Source/core/timing/PerformanceObserver.cpp
index 2f51f1a..7efae8a 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceObserver.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceObserver.cpp
@@ -86,9 +86,9 @@
}
void PerformanceObserver::disconnect() {
+ performance_entries_.clear();
if (performance_)
performance_->UnregisterPerformanceObserver(*this);
- performance_entries_.clear();
is_registered_ = false;
}