Title: [179720] trunk/Source/WebKit2
Revision
179720
Author
[email protected]
Date
2015-02-05 15:47:35 -0800 (Thu, 05 Feb 2015)

Log Message

[iOS] Remove False Positive dispatch_source Leak in WebMemoryPressureHandler singleton
https://bugs.webkit.org/show_bug.cgi?id=141307

Patch by Joseph Pecoraro <[email protected]> on 2015-02-05
Reviewed by Anders Carlsson.

* UIProcess/ios/WebMemoryPressureHandlerIOS.h:
* UIProcess/ios/WebMemoryPressureHandlerIOS.mm:
(WebKit::WebMemoryPressureHandler::WebMemoryPressureHandler):
We want to keep the dispatch_source around, so just tie it to the
singleton so that it is not reported as a leak.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (179719 => 179720)


--- trunk/Source/WebKit2/ChangeLog	2015-02-05 23:36:06 UTC (rev 179719)
+++ trunk/Source/WebKit2/ChangeLog	2015-02-05 23:47:35 UTC (rev 179720)
@@ -1,3 +1,16 @@
+2015-02-05  Joseph Pecoraro  <[email protected]>
+
+        [iOS] Remove False Positive dispatch_source Leak in WebMemoryPressureHandler singleton
+        https://bugs.webkit.org/show_bug.cgi?id=141307
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/ios/WebMemoryPressureHandlerIOS.h:
+        * UIProcess/ios/WebMemoryPressureHandlerIOS.mm:
+        (WebKit::WebMemoryPressureHandler::WebMemoryPressureHandler):
+        We want to keep the dispatch_source around, so just tie it to the
+        singleton so that it is not reported as a leak.
+
 2015-02-05  Antti Koivisto  <[email protected]>
 
         Switch to file backed buffer when resource is cached to disk

Modified: trunk/Source/WebKit2/UIProcess/ios/WebMemoryPressureHandlerIOS.h (179719 => 179720)


--- trunk/Source/WebKit2/UIProcess/ios/WebMemoryPressureHandlerIOS.h	2015-02-05 23:36:06 UTC (rev 179719)
+++ trunk/Source/WebKit2/UIProcess/ios/WebMemoryPressureHandlerIOS.h	2015-02-05 23:47:35 UTC (rev 179720)
@@ -28,7 +28,8 @@
 
 #if PLATFORM(IOS)
 
-#include <wtf/NeverDestroyed.h>
+#import <dispatch/dispatch.h>
+#import <wtf/NeverDestroyed.h>
 
 namespace WebKit {
 
@@ -39,6 +40,7 @@
 
 private:
     WebMemoryPressureHandler();
+    dispatch_source_t _source;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/ios/WebMemoryPressureHandlerIOS.mm (179719 => 179720)


--- trunk/Source/WebKit2/UIProcess/ios/WebMemoryPressureHandlerIOS.mm	2015-02-05 23:36:06 UTC (rev 179719)
+++ trunk/Source/WebKit2/UIProcess/ios/WebMemoryPressureHandlerIOS.mm	2015-02-05 23:47:35 UTC (rev 179720)
@@ -45,12 +45,12 @@
     // Right now it cannot because WebKit1 and WebKit2 need to be able to coexist in the UI process,
     // and you can only have one WebCore::MemoryPressureHandler.
 
-    dispatch_source_t source = dispatch_source_create(DISPATCH_SOURCE_TYPE_MEMORYSTATUS, 0, DISPATCH_MEMORYSTATUS_PRESSURE_WARN, dispatch_get_main_queue());
-    dispatch_set_context(source, this);
-    dispatch_source_set_event_handler(source, ^{
+    _source = dispatch_source_create(DISPATCH_SOURCE_TYPE_MEMORYSTATUS, 0, DISPATCH_MEMORYSTATUS_PRESSURE_WARN, dispatch_get_main_queue());
+    dispatch_set_context(_source, this);
+    dispatch_source_set_event_handler(_source, ^{
         ViewSnapshotStore::singleton().discardSnapshotImages();
     });
-    dispatch_resume(source);
+    dispatch_resume(_source);
 }
 
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to