Title: [218760] trunk/Source/WebKit2
- Revision
- 218760
- Author
- [email protected]
- Date
- 2017-06-23 13:45:46 -0700 (Fri, 23 Jun 2017)
Log Message
v3: REGRESSION (r218419): 3 NSMutableDictionary leaks calling -[WKProcessPool _pluginLoadClientPolicies]
<https://webkit.org/b/173689>
Reviewed by Tim Horton.
* UIProcess/API/Cocoa/WKProcessPool.mm:
(policiesHashMapToDictionary): Use adoptNS().get() to avoid
dumping objects into autoreleasepools unnecessarily.
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
(-[WKProcessPool _pluginLoadClientPolicies]): Add back 'copy'
attribute to document that we're returning a new object on each
invocation. I shouldn't have removed it in the v2 patch.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (218759 => 218760)
--- trunk/Source/WebKit2/ChangeLog 2017-06-23 20:43:41 UTC (rev 218759)
+++ trunk/Source/WebKit2/ChangeLog 2017-06-23 20:45:46 UTC (rev 218760)
@@ -1,3 +1,18 @@
+2017-06-23 David Kilzer <[email protected]>
+
+ v3: REGRESSION (r218419): 3 NSMutableDictionary leaks calling -[WKProcessPool _pluginLoadClientPolicies]
+ <https://webkit.org/b/173689>
+
+ Reviewed by Tim Horton.
+
+ * UIProcess/API/Cocoa/WKProcessPool.mm:
+ (policiesHashMapToDictionary): Use adoptNS().get() to avoid
+ dumping objects into autoreleasepools unnecessarily.
+ * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
+ (-[WKProcessPool _pluginLoadClientPolicies]): Add back 'copy'
+ attribute to document that we're returning a new object on each
+ invocation. I shouldn't have removed it in the v2 patch.
+
2017-06-23 Youenn Fablet <[email protected]>
LibWebRTCSocketClient should not destroy its socket within signalClose callback
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm (218759 => 218760)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm 2017-06-23 20:43:41 UTC (rev 218759)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm 2017-06-23 20:45:46 UTC (rev 218760)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -313,20 +313,20 @@
static NSDictionary *policiesHashMapToDictionary(const HashMap<String, HashMap<String, HashMap<String, uint8_t>>>& map)
{
- NSMutableDictionary *policies = [NSMutableDictionary dictionaryWithCapacity:map.size()];
+ auto policies = adoptNS([[NSMutableDictionary alloc] initWithCapacity:map.size()]);
for (auto& hostPair : map) {
NSString *host = hostPair.key;
- policies[host] = [NSMutableDictionary dictionaryWithCapacity:hostPair.value.size()];
+ policies.get()[host] = adoptNS([[NSMutableDictionary alloc] initWithCapacity:hostPair.value.size()]).get();
for (auto& bundleIdentifierPair : hostPair.value) {
NSString *bundlerIdentifier = bundleIdentifierPair.key;
- policies[host][bundlerIdentifier] = [NSMutableDictionary dictionaryWithCapacity:bundleIdentifierPair.value.size()];
+ policies.get()[host][bundlerIdentifier] = adoptNS([[NSMutableDictionary alloc] initWithCapacity:bundleIdentifierPair.value.size()]).get();
for (auto& versionPair : bundleIdentifierPair.value) {
NSString *version = versionPair.key;
- policies[host][bundlerIdentifier][version] = [NSNumber numberWithUnsignedInt:versionPair.value];
+ policies.get()[host][bundlerIdentifier][version] = adoptNS([[NSNumber alloc] initWithUnsignedInt:versionPair.value]).get();
}
}
}
- return policies;
+ return policies.autorelease();
}
#endif
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h (218759 => 218760)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h 2017-06-23 20:43:41 UTC (rev 218759)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h 2017-06-23 20:45:46 UTC (rev 218760)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -54,7 +54,7 @@
#if !TARGET_OS_IPHONE
- (void)_resetPluginLoadClientPolicies:(NSDictionary *)policies WK_API_AVAILABLE(macosx(WK_MAC_TBA));
-@property (nonatomic, readonly) NSDictionary *_pluginLoadClientPolicies WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+@property (nonatomic, readonly, copy) 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