Title: [199088] trunk/Source/WebKit2
Revision
199088
Author
[email protected]
Date
2016-04-05 18:31:13 -0700 (Tue, 05 Apr 2016)

Log Message

Correct applicationWillTerminate logic for ResourceLoadStatistics
https://bugs.webkit.org/show_bug.cgi?id=156249
<rdar://problem/25179611>

Reviewed by Andy Estes.

The applicationWillTerminate handling for ResourceLoadStatistics incorrectly
assumes that a ResourceLoadStatistics object will always be present.
1. The termination handling for 'dataStoresWithStorageManagers' should be
   calling 'applicationWillTerminate' on any ResourceLoadStatistics
   objects attached to the dataStore.
2. platformInitialize should null-check before attempting to dispatch.
3. platformDestroy should null check before attempting to dispatch.

* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::platformInitialize):
(WebKit::WebsiteDataStore::platformDestroy): Invoke 'applicationWillTerminate' on
m_resourceLoadStatistics if present.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (199087 => 199088)


--- trunk/Source/WebKit2/ChangeLog	2016-04-06 01:18:05 UTC (rev 199087)
+++ trunk/Source/WebKit2/ChangeLog	2016-04-06 01:31:13 UTC (rev 199088)
@@ -1,3 +1,24 @@
+2016-04-05  Brent Fulgham  <[email protected]>
+
+        Correct applicationWillTerminate logic for ResourceLoadStatistics
+        https://bugs.webkit.org/show_bug.cgi?id=156249
+        <rdar://problem/25179611>
+
+        Reviewed by Andy Estes.
+
+        The applicationWillTerminate handling for ResourceLoadStatistics incorrectly
+        assumes that a ResourceLoadStatistics object will always be present.
+        1. The termination handling for 'dataStoresWithStorageManagers' should be
+           calling 'applicationWillTerminate' on any ResourceLoadStatistics
+           objects attached to the dataStore.
+        2. platformInitialize should null-check before attempting to dispatch.
+        3. platformDestroy should null check before attempting to dispatch.
+
+        * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
+        (WebKit::WebsiteDataStore::platformInitialize): 
+        (WebKit::WebsiteDataStore::platformDestroy): Invoke 'applicationWillTerminate' on
+        m_resourceLoadStatistics if present.
+
 2016-04-05  Youenn Fablet  <[email protected]>
 
         [Fetch API] Add a runtime flag to fetch API and related constructs

Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm (199087 => 199088)


--- trunk/Source/WebKit2/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm	2016-04-06 01:18:05 UTC (rev 199087)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm	2016-04-06 01:31:13 UTC (rev 199088)
@@ -60,20 +60,25 @@
         NSString *notificationName = UIApplicationWillTerminateNotification;
 #endif
         terminationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:notificationName object:nil queue:nil usingBlock:^(NSNotification *note) {
-            for (auto& dataStore : dataStoresWithStorageManagers())
+            for (auto& dataStore : dataStoresWithStorageManagers()) {
                 dataStore->m_storageManager->applicationWillTerminate();
-
-            m_resourceLoadStatistics->applicationWillTerminate();
+                if (dataStore->m_resourceLoadStatistics)
+                    dataStore->m_resourceLoadStatistics->applicationWillTerminate();
+            }
         }];
     }
 
     ASSERT(!dataStoresWithStorageManagers().contains(this));
     dataStoresWithStorageManagers().append(this);
-    m_resourceLoadStatistics->readDataFromDiskIfNeeded();
+    if (m_resourceLoadStatistics)
+        m_resourceLoadStatistics->readDataFromDiskIfNeeded();
 }
 
 void WebsiteDataStore::platformDestroy()
 {
+    if (m_resourceLoadStatistics)
+        m_resourceLoadStatistics->applicationWillTerminate();
+
     if (!m_storageManager)
         return;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to