Title: [254604] branches/safari-609-branch
Revision
254604
Author
alanc...@apple.com
Date
2020-01-15 11:15:27 -0800 (Wed, 15 Jan 2020)

Log Message

Cherry-pick r254254. rdar://problem/58548978

    WebKitTestRunner leaks objects in a top-level autoreleasePool that's never cleared
    <https://webkit.org/b/205950>
    <rdar://problem/50987831>

    Reviewed by Joseph Pecoraro.

    Source/WebKit:

    * UIProcess/mac/WebPreferencesMac.mm:
    (WebKit::WebPreferences::platformInitializeStore):
    - Add an @autoreleasepool block around the contents of
      this method since it generates numerous autoreleased
      objects when run.

    Tools:

    * WebKitTestRunner/ios/mainIOS.mm:
    (main):
    - Add an @autoreleasepool block around a line of code
      that generates autoreleased objects.  These objects
      would never be released for the life of the process
      prior to this change.
    * WebKitTestRunner/mac/main.mm:
    (main):
    - Move instantiation of WTR::TestController outside of
      @autoreleasepool block so the pool can be drained
      while running tests.  Prior to this change, this
      autoreleasePool would never be drained.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254254 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-609-branch/Source/WebKit/ChangeLog (254603 => 254604)


--- branches/safari-609-branch/Source/WebKit/ChangeLog	2020-01-15 19:15:24 UTC (rev 254603)
+++ branches/safari-609-branch/Source/WebKit/ChangeLog	2020-01-15 19:15:27 UTC (rev 254604)
@@ -1,5 +1,55 @@
 2020-01-14  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r254254. rdar://problem/58548978
+
+    WebKitTestRunner leaks objects in a top-level autoreleasePool that's never cleared
+    <https://webkit.org/b/205950>
+    <rdar://problem/50987831>
+    
+    Reviewed by Joseph Pecoraro.
+    
+    Source/WebKit:
+    
+    * UIProcess/mac/WebPreferencesMac.mm:
+    (WebKit::WebPreferences::platformInitializeStore):
+    - Add an @autoreleasepool block around the contents of
+      this method since it generates numerous autoreleased
+      objects when run.
+    
+    Tools:
+    
+    * WebKitTestRunner/ios/mainIOS.mm:
+    (main):
+    - Add an @autoreleasepool block around a line of code
+      that generates autoreleased objects.  These objects
+      would never be released for the life of the process
+      prior to this change.
+    * WebKitTestRunner/mac/main.mm:
+    (main):
+    - Move instantiation of WTR::TestController outside of
+      @autoreleasepool block so the pool can be drained
+      while running tests.  Prior to this change, this
+      autoreleasePool would never be drained.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-01-09  David Kilzer  <ddkil...@apple.com>
+
+            WebKitTestRunner leaks objects in a top-level autoreleasePool that's never cleared
+            <https://webkit.org/b/205950>
+            <rdar://problem/50987831>
+
+            Reviewed by Joseph Pecoraro.
+
+            * UIProcess/mac/WebPreferencesMac.mm:
+            (WebKit::WebPreferences::platformInitializeStore):
+            - Add an @autoreleasepool block around the contents of
+              this method since it generates numerous autoreleased
+              objects when run.
+
+2020-01-14  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r254239. rdar://problem/58549100
 
     Resource Load Statistics: Flip experimental cookie blocking setting from an enable to a disable

Modified: branches/safari-609-branch/Source/WebKit/UIProcess/mac/WebPreferencesMac.mm (254603 => 254604)


--- branches/safari-609-branch/Source/WebKit/UIProcess/mac/WebPreferencesMac.mm	2020-01-15 19:15:24 UTC (rev 254603)
+++ branches/safari-609-branch/Source/WebKit/UIProcess/mac/WebPreferencesMac.mm	2020-01-15 19:15:27 UTC (rev 254604)
@@ -138,24 +138,26 @@
 
 void WebPreferences::platformInitializeStore()
 {
+    @autoreleasepool {
 #define INITIALIZE_DEBUG_PREFERENCE_FROM_NSUSERDEFAULTS(KeyUpper, KeyLower, TypeName, Type, DefaultValue, HumanReadableName, HumanReadableDescription) \
-    setDebug##TypeName##ValueIfInUserDefaults(m_identifier, m_keyPrefix, m_globalDebugKeyPrefix, WebPreferencesKey::KeyLower##Key(), m_store);
+        setDebug##TypeName##ValueIfInUserDefaults(m_identifier, m_keyPrefix, m_globalDebugKeyPrefix, WebPreferencesKey::KeyLower##Key(), m_store);
 
-    FOR_EACH_WEBKIT_DEBUG_PREFERENCE(INITIALIZE_DEBUG_PREFERENCE_FROM_NSUSERDEFAULTS)
+        FOR_EACH_WEBKIT_DEBUG_PREFERENCE(INITIALIZE_DEBUG_PREFERENCE_FROM_NSUSERDEFAULTS)
 
 #undef INITIALIZE_DEBUG_PREFERENCE_FROM_NSUSERDEFAULTS
 
-    if (!m_identifier)
-        return;
+        if (!m_identifier)
+            return;
 
 #define INITIALIZE_PREFERENCE_FROM_NSUSERDEFAULTS(KeyUpper, KeyLower, TypeName, Type, DefaultValue, HumanReadableName, HumanReadableDescription) \
-    Type user##KeyUpper##Value; \
-    if (platformGet##TypeName##UserValueForKey(WebPreferencesKey::KeyLower##Key(), user##KeyUpper##Value)) \
-        m_store.set##TypeName##ValueForKey(WebPreferencesKey::KeyLower##Key(), user##KeyUpper##Value);
+        Type user##KeyUpper##Value; \
+        if (platformGet##TypeName##UserValueForKey(WebPreferencesKey::KeyLower##Key(), user##KeyUpper##Value)) \
+            m_store.set##TypeName##ValueForKey(WebPreferencesKey::KeyLower##Key(), user##KeyUpper##Value);
 
-    FOR_EACH_WEBKIT_PREFERENCE(INITIALIZE_PREFERENCE_FROM_NSUSERDEFAULTS)
+        FOR_EACH_WEBKIT_PREFERENCE(INITIALIZE_PREFERENCE_FROM_NSUSERDEFAULTS)
 
 #undef INITIALIZE_PREFERENCE_FROM_NSUSERDEFAULTS
+    }
 }
 
 void WebPreferences::platformUpdateStringValueForKey(const String& key, const String& value)

Modified: branches/safari-609-branch/Tools/ChangeLog (254603 => 254604)


--- branches/safari-609-branch/Tools/ChangeLog	2020-01-15 19:15:24 UTC (rev 254603)
+++ branches/safari-609-branch/Tools/ChangeLog	2020-01-15 19:15:27 UTC (rev 254604)
@@ -1,5 +1,62 @@
 2020-01-14  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r254254. rdar://problem/58548978
+
+    WebKitTestRunner leaks objects in a top-level autoreleasePool that's never cleared
+    <https://webkit.org/b/205950>
+    <rdar://problem/50987831>
+    
+    Reviewed by Joseph Pecoraro.
+    
+    Source/WebKit:
+    
+    * UIProcess/mac/WebPreferencesMac.mm:
+    (WebKit::WebPreferences::platformInitializeStore):
+    - Add an @autoreleasepool block around the contents of
+      this method since it generates numerous autoreleased
+      objects when run.
+    
+    Tools:
+    
+    * WebKitTestRunner/ios/mainIOS.mm:
+    (main):
+    - Add an @autoreleasepool block around a line of code
+      that generates autoreleased objects.  These objects
+      would never be released for the life of the process
+      prior to this change.
+    * WebKitTestRunner/mac/main.mm:
+    (main):
+    - Move instantiation of WTR::TestController outside of
+      @autoreleasepool block so the pool can be drained
+      while running tests.  Prior to this change, this
+      autoreleasePool would never be drained.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@254254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-01-09  David Kilzer  <ddkil...@apple.com>
+
+            WebKitTestRunner leaks objects in a top-level autoreleasePool that's never cleared
+            <https://webkit.org/b/205950>
+            <rdar://problem/50987831>
+
+            Reviewed by Joseph Pecoraro.
+
+            * WebKitTestRunner/ios/mainIOS.mm:
+            (main):
+            - Add an @autoreleasepool block around a line of code
+              that generates autoreleased objects.  These objects
+              would never be released for the life of the process
+              prior to this change.
+            * WebKitTestRunner/mac/main.mm:
+            (main):
+            - Move instantiation of WTR::TestController outside of
+              @autoreleasepool block so the pool can be drained
+              while running tests.  Prior to this change, this
+              autoreleasePool would never be drained.
+
+2020-01-14  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r254042. rdar://problem/58549102
 
     Source/WebCore/PAL:

Modified: branches/safari-609-branch/Tools/WebKitTestRunner/ios/mainIOS.mm (254603 => 254604)


--- branches/safari-609-branch/Tools/WebKitTestRunner/ios/mainIOS.mm	2020-01-15 19:15:24 UTC (rev 254603)
+++ branches/safari-609-branch/Tools/WebKitTestRunner/ios/mainIOS.mm	2020-01-15 19:15:27 UTC (rev 254604)
@@ -66,7 +66,9 @@
     _argc = argc;
     _argv = argv;
 
-    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"WebKitLinkedOnOrAfterEverything"];
+    @autoreleasepool {
+        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"WebKitLinkedOnOrAfterEverything"];
+    }
 
     UIApplicationMain(argc, (char**)argv, @"WebKitTestRunnerApp", @"WebKitTestRunnerApp");
     return 0;

Modified: branches/safari-609-branch/Tools/WebKitTestRunner/mac/main.mm (254603 => 254604)


--- branches/safari-609-branch/Tools/WebKitTestRunner/mac/main.mm	2020-01-15 19:15:24 UTC (rev 254603)
+++ branches/safari-609-branch/Tools/WebKitTestRunner/mac/main.mm	2020-01-15 19:15:27 UTC (rev 254604)
@@ -64,8 +64,8 @@
         [NSApplication sharedApplication];
         setDefaultsToConsistentValuesForTesting();
         disableAppNapInUIProcess(); // For secondary processes, app nap is disabled using WKPreferencesSetPageVisibilityBasedProcessSuppressionEnabled().
-        WTR::TestController controller(argc, argv);
     }
+    WTR::TestController controller(argc, argv);
     return 0;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to