Bug 1338886 - nsDocument::UpdateIntersectionObservations() should call perf->Now() only if needed, r=tschneider
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Wed, 15 Feb 2017 17:04:16 +0200
changeset 343102 2f5ea49d65cf21e1ecf7c7c6c348abd3b9d2a456
parent 343101 8f45618754feef3ba059cf47a5d7b8ed437113a5
child 343103 3cac14211742ccb4b1f98fc4e44236eeb0d7c27e
push id31369
push userkwierso@gmail.com
push dateThu, 16 Feb 2017 00:18:40 +0000
treeherdermozilla-central@e9b926463f9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstschneider
bugs1338886
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1338886 - nsDocument::UpdateIntersectionObservations() should call perf->Now() only if needed, r=tschneider
dom/base/nsDocument.cpp
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -12610,16 +12610,20 @@ void
 nsDocument::RemoveIntersectionObserver(DOMIntersectionObserver* aObserver)
 {
   mIntersectionObservers.RemoveElement(aObserver);
 }
 
 void
 nsDocument::UpdateIntersectionObservations()
 {
+  if (mIntersectionObservers.IsEmpty()) {
+    return;
+  }
+
   DOMHighResTimeStamp time = 0;
   if (nsPIDOMWindowInner* window = GetInnerWindow()) {
     Performance* perf = window->GetPerformance();
     if (perf) {
       time = perf->Now();
     }
   }
   for (const auto& observer : mIntersectionObservers) {