Title: [218704] trunk/Source/WebKit2
Revision
218704
Author
[email protected]
Date
2017-06-22 10:07:52 -0700 (Thu, 22 Jun 2017)

Log Message

v2: REGRESSION (r218419): 3 NSMutableDictionary leaks calling -[WKProcessPool _pluginLoadClientPolicies]
<https://webkit.org/b/173689>

Reviewed by Chris Dumez.

* UIProcess/API/Cocoa/WKProcessPool.mm:
(policiesHashMapToDictionary): Use -dictionaryWithCapacity:
instead of -new since the former returns an autoreleased object
while the latter does not.  This has the added benefit of tuning
the size of each NSMutableDictionary.
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
(-[WKProcessPool _pluginLoadClientPolicies]): Remove 'copy'
attribute from @property declaration since it is read-only.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (218703 => 218704)


--- trunk/Source/WebKit2/ChangeLog	2017-06-22 16:43:52 UTC (rev 218703)
+++ trunk/Source/WebKit2/ChangeLog	2017-06-22 17:07:52 UTC (rev 218704)
@@ -1,3 +1,19 @@
+2017-06-22  David Kilzer  <[email protected]>
+
+        v2: REGRESSION (r218419): 3 NSMutableDictionary leaks calling -[WKProcessPool _pluginLoadClientPolicies]
+        <https://webkit.org/b/173689>
+
+        Reviewed by Chris Dumez.
+
+        * UIProcess/API/Cocoa/WKProcessPool.mm:
+        (policiesHashMapToDictionary): Use -dictionaryWithCapacity:
+        instead of -new since the former returns an autoreleased object
+        while the latter does not.  This has the added benefit of tuning
+        the size of each NSMutableDictionary.
+        * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
+        (-[WKProcessPool _pluginLoadClientPolicies]): Remove 'copy'
+        attribute from @property declaration since it is read-only.
+
 2017-06-22  Carlos Garcia Campos  <[email protected]>
 
         [WPE] Downloads never have a web view associated in WPE
@@ -77,7 +93,7 @@
 
 2017-06-21  David Kilzer  <[email protected]>
 
-        REGRESSION (r218419): 3 NSMutableDiciontary leaks calling -[WKProcessPool _pluginLoadClientPolicies]
+        REGRESSION (r218419): 3 NSMutableDictionary leaks calling -[WKProcessPool _pluginLoadClientPolicies]
         <https://webkit.org/b/173689>
 
         Reviewed by Chris Dumez.

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm (218703 => 218704)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm	2017-06-22 16:43:52 UTC (rev 218703)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm	2017-06-22 17:07:52 UTC (rev 218704)
@@ -313,13 +313,13 @@
 
 static NSDictionary *policiesHashMapToDictionary(const HashMap<String, HashMap<String, HashMap<String, uint8_t>>>& map)
 {
-    NSMutableDictionary *policies = [NSMutableDictionary new];
+    NSMutableDictionary *policies = [NSMutableDictionary dictionaryWithCapacity:map.size()];
     for (auto& hostPair : map) {
         NSString *host = hostPair.key;
-        policies[host] = [NSMutableDictionary new];
+        policies[host] = [NSMutableDictionary dictionaryWithCapacity:hostPair.value.size()];
         for (auto& bundleIdentifierPair : hostPair.value) {
             NSString *bundlerIdentifier = bundleIdentifierPair.key;
-            policies[host][bundlerIdentifier] = [NSMutableDictionary new];
+            policies[host][bundlerIdentifier] = [NSMutableDictionary dictionaryWithCapacity:bundleIdentifierPair.value.size()];
             for (auto& versionPair : bundleIdentifierPair.value) {
                 NSString *version = versionPair.key;
                 policies[host][bundlerIdentifier][version] = [NSNumber numberWithUnsignedInt:versionPair.value];

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h (218703 => 218704)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h	2017-06-22 16:43:52 UTC (rev 218703)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h	2017-06-22 17:07:52 UTC (rev 218704)
@@ -54,7 +54,7 @@
 
 #if !TARGET_OS_IPHONE
 - (void)_resetPluginLoadClientPolicies:(NSDictionary *)policies WK_API_AVAILABLE(macosx(WK_MAC_TBA));
-@property (nonatomic, readonly, copy) NSDictionary *_pluginLoadClientPolicies WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+@property (nonatomic, readonly) NSDictionary *_pluginLoadClientPolicies WK_API_AVAILABLE(macosx(WK_MAC_TBA));
 #endif
 
 @property (nonatomic, weak, setter=_setDownloadDelegate:) id <_WKDownloadDelegate> _downloadDelegate;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to