Title: [257866] trunk/Source/WebKit
Revision
257866
Author
sihui_...@apple.com
Date
2020-03-04 11:35:59 -0800 (Wed, 04 Mar 2020)

Log Message

Assertion failed: !m_function in CompletionHandler::~CompletionHandler()
https://bugs.webkit.org/show_bug.cgi?id=208457

Reviewed by Chris Dumez.

Ensure completion handler is called in WebsiteDataStore::getResourceLoadStatisticsDataSummary.

* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::getResourceLoadStatisticsDataSummary):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (257865 => 257866)


--- trunk/Source/WebKit/ChangeLog	2020-03-04 19:29:19 UTC (rev 257865)
+++ trunk/Source/WebKit/ChangeLog	2020-03-04 19:35:59 UTC (rev 257866)
@@ -1,3 +1,15 @@
+2020-03-04  Sihui Liu  <sihui_...@apple.com>
+
+        Assertion failed: !m_function in CompletionHandler::~CompletionHandler()
+        https://bugs.webkit.org/show_bug.cgi?id=208457
+
+        Reviewed by Chris Dumez.
+
+        Ensure completion handler is called in WebsiteDataStore::getResourceLoadStatisticsDataSummary.
+
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::getResourceLoadStatisticsDataSummary):
+
 2020-03-04  Ben Nham  <n...@apple.com>
 
         Remove initial layout throttler

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (257865 => 257866)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2020-03-04 19:29:19 UTC (rev 257865)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2020-03-04 19:35:59 UTC (rev 257866)
@@ -1514,9 +1514,37 @@
 {
     ASSERT(RunLoop::isMain());
 
+    struct CallbackAggregator : RefCounted<CallbackAggregator> {
+        CallbackAggregator(CompletionHandler<void(Vector<WebResourceLoadStatisticsStore::ThirdPartyData>&&)>&& completionHandler)
+            : m_completionHandler(WTFMove(completionHandler))
+        {
+            ASSERT(RunLoop::isMain());
+        };
+
+        ~CallbackAggregator()
+        {
+            ASSERT(RunLoop::isMain());
+
+            m_completionHandler(WTFMove(m_results));
+        }
+
+        void addResult(Vector<WebResourceLoadStatisticsStore::ThirdPartyData>&& results)
+        {
+            m_results.appendVector(WTFMove(results));
+        }
+
+        CompletionHandler<void(Vector<WebResourceLoadStatisticsStore::ThirdPartyData>&&)> m_completionHandler;
+        Vector<WebResourceLoadStatisticsStore::ThirdPartyData> m_results;
+    };
+
+    RefPtr<CallbackAggregator> callbackAggregator = adoptRef(new CallbackAggregator(WTFMove(completionHandler)));
+
     for (auto& processPool : ensureProcessPools()) {
-        if (auto* process = processPool->networkProcess())
-            process->getResourceLoadStatisticsDataSummary(m_sessionID, WTFMove(completionHandler));
+        if (auto* process = processPool->networkProcess()) {
+            process->getResourceLoadStatisticsDataSummary(m_sessionID, [callbackAggregator = callbackAggregator.copyRef()](Vector<WebResourceLoadStatisticsStore::ThirdPartyData>&& data) {
+                callbackAggregator->addResult(WTFMove(data));
+            });
+        }
     }
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to