Web Inspector: Memory timeline starts from zero when both CPU and Memory timeline...
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2019 21:24:14 +0000 (21:24 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2019 21:24:14 +0000 (21:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194111
<rdar://problem/47714555>

Rubber-stamped by Devin Rousso.

* page/ResourceUsageThread.cpp:
(WebCore::ResourceUsageThread::waitUntilObservers):
(WebCore::ResourceUsageThread::threadBody):
Wait a short period of time before the first listener registers
and we start sampling. This will allow multiple listeners to
register, each that wants different data.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240868 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/ResourceUsageThread.cpp

index 70ee09c..fc1c9a8 100644 (file)
@@ -1,3 +1,18 @@
+2019-02-01  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Memory timeline starts from zero when both CPU and Memory timeline are enabled
+        https://bugs.webkit.org/show_bug.cgi?id=194111
+        <rdar://problem/47714555>
+
+        Rubber-stamped by Devin Rousso.
+
+        * page/ResourceUsageThread.cpp:
+        (WebCore::ResourceUsageThread::waitUntilObservers):
+        (WebCore::ResourceUsageThread::threadBody):
+        Wait a short period of time before the first listener registers
+        and we start sampling. This will allow multiple listeners to
+        register, each that wants different data.
+
 2019-02-01  Antti Koivisto  <antti@apple.com>
 
         Don't use base layer() as the scroll layer in scrolling tree.
index d9dd3e7..5036260 100644 (file)
@@ -78,8 +78,12 @@ void ResourceUsageThread::removeObserver(void* key)
 void ResourceUsageThread::waitUntilObservers()
 {
     LockHolder locker(m_lock);
-    while (m_observers.isEmpty())
+    while (m_observers.isEmpty()) {
         m_condition.wait(m_lock);
+
+        // Wait a bit after waking up for the first time.
+        WTF::sleep(10_ms);
+    }
 }
 
 void ResourceUsageThread::notifyObservers(ResourceUsageData&& data)
@@ -119,6 +123,9 @@ void ResourceUsageThread::createThreadIfNeeded()
 
 NO_RETURN void ResourceUsageThread::threadBody()
 {
+    // Wait a bit after waking up for the first time.
+    WTF::sleep(10_ms);
+    
     while (true) {
         // Only do work if we have observers.
         waitUntilObservers();