Changeset 218704 in webkit


Ignore:
Timestamp:
Jun 22, 2017 10:07:52 AM (7 years ago)
Author:
ddkilzer@apple.com
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.

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r218691 r218704  
     12017-06-22  David Kilzer  <ddkilzer@apple.com>
     2
     3        v2: REGRESSION (r218419): 3 NSMutableDictionary leaks calling -[WKProcessPool _pluginLoadClientPolicies]
     4        <https://webkit.org/b/173689>
     5
     6        Reviewed by Chris Dumez.
     7
     8        * UIProcess/API/Cocoa/WKProcessPool.mm:
     9        (policiesHashMapToDictionary): Use -dictionaryWithCapacity:
     10        instead of -new since the former returns an autoreleased object
     11        while the latter does not.  This has the added benefit of tuning
     12        the size of each NSMutableDictionary.
     13        * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
     14        (-[WKProcessPool _pluginLoadClientPolicies]): Remove 'copy'
     15        attribute from @property declaration since it is read-only.
     16
    1172017-06-22  Carlos Garcia Campos  <cgarcia@igalia.com>
    218
     
    78942017-06-21  David Kilzer  <ddkilzer@apple.com>
    7995
    80         REGRESSION (r218419): 3 NSMutableDiciontary leaks calling -[WKProcessPool _pluginLoadClientPolicies]
     96        REGRESSION (r218419): 3 NSMutableDictionary leaks calling -[WKProcessPool _pluginLoadClientPolicies]
    8197        <https://webkit.org/b/173689>
    8298
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm

    r218678 r218704  
    314314static NSDictionary *policiesHashMapToDictionary(const HashMap<String, HashMap<String, HashMap<String, uint8_t>>>& map)
    315315{
    316     NSMutableDictionary *policies = [NSMutableDictionary new];
     316    NSMutableDictionary *policies = [NSMutableDictionary dictionaryWithCapacity:map.size()];
    317317    for (auto& hostPair : map) {
    318318        NSString *host = hostPair.key;
    319         policies[host] = [NSMutableDictionary new];
     319        policies[host] = [NSMutableDictionary dictionaryWithCapacity:hostPair.value.size()];
    320320        for (auto& bundleIdentifierPair : hostPair.value) {
    321321            NSString *bundlerIdentifier = bundleIdentifierPair.key;
    322             policies[host][bundlerIdentifier] = [NSMutableDictionary new];
     322            policies[host][bundlerIdentifier] = [NSMutableDictionary dictionaryWithCapacity:bundleIdentifierPair.value.size()];
    323323            for (auto& versionPair : bundleIdentifierPair.value) {
    324324                NSString *version = versionPair.key;
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h

    r218444 r218704  
    5555#if !TARGET_OS_IPHONE
    5656- (void)_resetPluginLoadClientPolicies:(NSDictionary *)policies WK_API_AVAILABLE(macosx(WK_MAC_TBA));
    57 @property (nonatomic, readonly, copy) NSDictionary *_pluginLoadClientPolicies WK_API_AVAILABLE(macosx(WK_MAC_TBA));
     57@property (nonatomic, readonly) NSDictionary *_pluginLoadClientPolicies WK_API_AVAILABLE(macosx(WK_MAC_TBA));
    5858#endif
    5959
Note: See TracChangeset for help on using the changeset viewer.