Title: [212787] trunk/Source/WebKit
Revision
212787
Author
[email protected]
Date
2017-02-21 17:58:29 -0800 (Tue, 21 Feb 2017)

Log Message

Unreviewed, rolling out r212768.
https://bugs.webkit.org/show_bug.cgi?id=168698

Rolling out since this would break other projects. (Requested
by aakashjain on #webkit).

Reverted changeset:

"[iOS] Remove old WebKit1 MemoryMeasure helper."
https://bugs.webkit.org/show_bug.cgi?id=168675
http://trac.webkit.org/changeset/212768

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (212786 => 212787)


--- trunk/Source/WebKit/ChangeLog	2017-02-22 01:35:13 UTC (rev 212786)
+++ trunk/Source/WebKit/ChangeLog	2017-02-22 01:58:29 UTC (rev 212787)
@@ -1,3 +1,17 @@
+2017-02-21  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r212768.
+        https://bugs.webkit.org/show_bug.cgi?id=168698
+
+        Rolling out since this would break other projects. (Requested
+        by aakashjain on #webkit).
+
+        Reverted changeset:
+
+        "[iOS] Remove old WebKit1 MemoryMeasure helper."
+        https://bugs.webkit.org/show_bug.cgi?id=168675
+        http://trac.webkit.org/changeset/212768
+
 2017-02-21  Andreas Kling  <[email protected]>
 
         [iOS] Remove old WebKit1 MemoryMeasure helper.

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (212786 => 212787)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2017-02-22 01:35:13 UTC (rev 212786)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2017-02-22 01:58:29 UTC (rev 212787)
@@ -693,6 +693,8 @@
 		A10C1D1D18202F9C0036883A /* WebDefaultResourceLoadDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A10C1D1518202F9C0036883A /* WebDefaultResourceLoadDelegate.m */; };
 		A10C1D1E18202F9C0036883A /* WebDefaultUIKitDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = A10C1D1618202F9C0036883A /* WebDefaultUIKitDelegate.h */; };
 		A10C1D1F18202F9C0036883A /* WebDefaultUIKitDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A10C1D1718202F9C0036883A /* WebDefaultUIKitDelegate.m */; };
+		A10C1D3218202FC50036883A /* MemoryMeasure.h in Headers */ = {isa = PBXBuildFile; fileRef = A10C1D2318202FC50036883A /* MemoryMeasure.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		A10C1D3318202FC50036883A /* MemoryMeasure.mm in Sources */ = {isa = PBXBuildFile; fileRef = A10C1D2418202FC50036883A /* MemoryMeasure.mm */; };
 		A10C1D3418202FC50036883A /* WebGeolocationCoreLocationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = A10C1D2518202FC50036883A /* WebGeolocationCoreLocationProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A10C1D3518202FC50036883A /* WebGeolocationCoreLocationProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = A10C1D2618202FC50036883A /* WebGeolocationCoreLocationProvider.mm */; };
 		A10C1D3618202FC50036883A /* WebGeolocationProviderIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = A10C1D2718202FC50036883A /* WebGeolocationProviderIOS.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -1435,6 +1437,8 @@
 		A10C1D1518202F9C0036883A /* WebDefaultResourceLoadDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WebDefaultResourceLoadDelegate.m; path = ios/DefaultDelegates/WebDefaultResourceLoadDelegate.m; sourceTree = SOURCE_ROOT; };
 		A10C1D1618202F9C0036883A /* WebDefaultUIKitDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebDefaultUIKitDelegate.h; path = ios/DefaultDelegates/WebDefaultUIKitDelegate.h; sourceTree = SOURCE_ROOT; };
 		A10C1D1718202F9C0036883A /* WebDefaultUIKitDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WebDefaultUIKitDelegate.m; path = ios/DefaultDelegates/WebDefaultUIKitDelegate.m; sourceTree = SOURCE_ROOT; };
+		A10C1D2318202FC50036883A /* MemoryMeasure.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MemoryMeasure.h; path = ios/Misc/MemoryMeasure.h; sourceTree = SOURCE_ROOT; };
+		A10C1D2418202FC50036883A /* MemoryMeasure.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MemoryMeasure.mm; path = ios/Misc/MemoryMeasure.mm; sourceTree = SOURCE_ROOT; };
 		A10C1D2518202FC50036883A /* WebGeolocationCoreLocationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGeolocationCoreLocationProvider.h; path = ios/Misc/WebGeolocationCoreLocationProvider.h; sourceTree = SOURCE_ROOT; };
 		A10C1D2618202FC50036883A /* WebGeolocationCoreLocationProvider.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebGeolocationCoreLocationProvider.mm; path = ios/Misc/WebGeolocationCoreLocationProvider.mm; sourceTree = SOURCE_ROOT; };
 		A10C1D2718202FC50036883A /* WebGeolocationProviderIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGeolocationProviderIOS.h; path = ios/Misc/WebGeolocationProviderIOS.h; sourceTree = SOURCE_ROOT; };
@@ -2117,6 +2121,8 @@
 		A10C1D2018202FAF0036883A /* ios */ = {
 			isa = PBXGroup;
 			children = (
+				A10C1D2318202FC50036883A /* MemoryMeasure.h */,
+				A10C1D2418202FC50036883A /* MemoryMeasure.mm */,
 				A10C1D2518202FC50036883A /* WebGeolocationCoreLocationProvider.h */,
 				A10C1D2618202FC50036883A /* WebGeolocationCoreLocationProvider.mm */,
 				A10C1D2718202FC50036883A /* WebGeolocationProviderIOS.h */,
@@ -2936,6 +2942,7 @@
 				939810680824BF01008DF038 /* HIViewAdapter.h in Headers */,
 				939810690824BF01008DF038 /* HIWebView.h in Headers */,
 				1A8DED500EE88B8A00F25022 /* HostedNetscapePluginStream.h in Headers */,
+				A10C1D3218202FC50036883A /* MemoryMeasure.h in Headers */,
 				1AAF5CEA0EDDE1FE008D883D /* NetscapePluginHostManager.h in Headers */,
 				1AAF5CEC0EDDE1FE008D883D /* NetscapePluginHostProxy.h in Headers */,
 				1AAF5CEE0EDDE1FE008D883D /* NetscapePluginInstanceProxy.h in Headers */,
@@ -3523,6 +3530,7 @@
 				939811000824BF01008DF038 /* HIViewAdapter.m in Sources */,
 				939811020824BF01008DF038 /* HIWebView.mm in Sources */,
 				1A8DED510EE88B8A00F25022 /* HostedNetscapePluginStream.mm in Sources */,
+				A10C1D3318202FC50036883A /* MemoryMeasure.mm in Sources */,
 				1AAF5CEB0EDDE1FE008D883D /* NetscapePluginHostManager.mm in Sources */,
 				1AAF5CED0EDDE1FE008D883D /* NetscapePluginHostProxy.mm in Sources */,
 				1AAF5CEF0EDDE1FE008D883D /* NetscapePluginInstanceProxy.mm in Sources */,

Modified: trunk/Source/WebKit/ios/ChangeLog (212786 => 212787)


--- trunk/Source/WebKit/ios/ChangeLog	2017-02-22 01:35:13 UTC (rev 212786)
+++ trunk/Source/WebKit/ios/ChangeLog	2017-02-22 01:58:29 UTC (rev 212787)
@@ -1,3 +1,17 @@
+2017-02-21  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r212768.
+        https://bugs.webkit.org/show_bug.cgi?id=168698
+
+        Rolling out since this would break other projects. (Requested
+        by aakashjain on #webkit).
+
+        Reverted changeset:
+
+        "[iOS] Remove old WebKit1 MemoryMeasure helper."
+        https://bugs.webkit.org/show_bug.cgi?id=168675
+        http://trac.webkit.org/changeset/212768
+
 2017-02-21  Andreas Kling  <[email protected]>
 
         [iOS] Remove old WebKit1 MemoryMeasure helper.

Added: trunk/Source/WebKit/ios/Misc/MemoryMeasure.h (0 => 212787)


--- trunk/Source/WebKit/ios/Misc/MemoryMeasure.h	                        (rev 0)
+++ trunk/Source/WebKit/ios/Misc/MemoryMeasure.h	2017-02-22 01:58:29 UTC (rev 212787)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MemoryMeasure_h
+#define MemoryMeasure_h
+
+namespace WebKit {
+
+/*!
+ * A simple class that measures the difference in the resident memory of the
+ * process between its contruction and destruction. It uses the mach API -
+ * task_info - to figure this out.
+ */
+class MemoryMeasure {
+public:
+    MemoryMeasure()
+        : m_logString("")
+        , m_initialMemory(taskMemory())
+    {
+    }
+
+    MemoryMeasure(const char *log)
+        : m_logString(log)
+        , m_initialMemory(taskMemory())
+    {
+    }
+
+    ~MemoryMeasure();
+
+    static void enableLogging(bool enabled);
+    static bool isLoggingEnabled();
+
+private:
+    const char *m_logString;
+    long m_initialMemory;
+    static bool m_isLoggingEnabled;
+
+    /*!
+     * @return The resident memory (in bytes) consumed by the process. It uses
+     *         task_info() to get this information. If there is an error, it
+     *         returns -1.
+     */
+    long taskMemory();
+};
+
+}
+#endif

Added: trunk/Source/WebKit/ios/Misc/MemoryMeasure.mm (0 => 212787)


--- trunk/Source/WebKit/ios/Misc/MemoryMeasure.mm	                        (rev 0)
+++ trunk/Source/WebKit/ios/Misc/MemoryMeasure.mm	2017-02-22 01:58:29 UTC (rev 212787)
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if PLATFORM(IOS)
+
+#include "MemoryMeasure.h"
+
+#include <stdio.h>
+#include <mach/mach.h>
+
+static const int measureMemoryFailed = -1;
+
+namespace WebKit {
+
+bool MemoryMeasure::m_isLoggingEnabled;
+
+void MemoryMeasure::enableLogging(bool enabled)
+{
+    m_isLoggingEnabled = enabled;
+}
+
+bool MemoryMeasure::isLoggingEnabled()
+{
+    return m_isLoggingEnabled;
+}
+
+long MemoryMeasure::taskMemory()
+{
+    if (!MemoryMeasure::isLoggingEnabled())
+        return 0;
+
+    task_vm_info_data_t vmInfo;
+    mach_msg_type_number_t count = TASK_VM_INFO_COUNT;
+    kern_return_t err = task_info(mach_task_self(), TASK_VM_INFO, (task_info_t) &vmInfo, &count);
+    if (err != KERN_SUCCESS)
+        return measureMemoryFailed;
+
+    return (long) vmInfo.internal;
+}
+
+MemoryMeasure::~MemoryMeasure()
+{
+    if (!MemoryMeasure::isLoggingEnabled())
+        return;
+
+    long currentMemory = taskMemory();
+    if (currentMemory == measureMemoryFailed || m_initialMemory == measureMemoryFailed) {
+        NSLog(@"%s (Unable to get dirty memory information for process)\n", m_logString);
+        return;
+    }
+
+    long memoryDiff = currentMemory - m_initialMemory;
+    if (memoryDiff < 0)
+        NSLog(@"%s Dirty memory reduced by %ld bytes (from %ld to %ld)\n", m_logString, (memoryDiff * -1), m_initialMemory, currentMemory);
+    else if (memoryDiff > 0)
+        NSLog(@"%s Dirty memory increased by %ld bytes (from %ld to %ld)\n", m_logString, memoryDiff, m_initialMemory, currentMemory);
+    else
+        NSLog(@"%s No change in dirty memory used by process (at %ld bytes)\n", m_logString, currentMemory);
+}
+
+}
+
+#endif // PLATFORM(IOS)

Modified: trunk/Source/WebKit/ios/WebKit.iOS.exp (212786 => 212787)


--- trunk/Source/WebKit/ios/WebKit.iOS.exp	2017-02-22 01:35:13 UTC (rev 212786)
+++ trunk/Source/WebKit/ios/WebKit.iOS.exp	2017-02-22 01:58:29 UTC (rev 212787)
@@ -27,6 +27,13 @@
 _WebViewportShrinkToFitKey
 _WebViewportWidthKey
 
+# So that we can use the MemoryMeasure class in MobileSafari
+__ZN6WebKit13MemoryMeasure10taskMemoryEv
+__ZN6WebKit13MemoryMeasure13enableLoggingEb
+__ZN6WebKit13MemoryMeasure16isLoggingEnabledEv
+__ZN6WebKit13MemoryMeasureD1Ev
+__ZN6WebKit13MemoryMeasureD2Ev
+
 # For estimated progress notifications
 _WebViewProgressBackgroundColorKey
 _WebViewProgressEstimatedProgressKey

Modified: trunk/Source/WebKit/mac/ChangeLog (212786 => 212787)


--- trunk/Source/WebKit/mac/ChangeLog	2017-02-22 01:35:13 UTC (rev 212786)
+++ trunk/Source/WebKit/mac/ChangeLog	2017-02-22 01:58:29 UTC (rev 212787)
@@ -1,3 +1,17 @@
+2017-02-21  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r212768.
+        https://bugs.webkit.org/show_bug.cgi?id=168698
+
+        Rolling out since this would break other projects. (Requested
+        by aakashjain on #webkit).
+
+        Reverted changeset:
+
+        "[iOS] Remove old WebKit1 MemoryMeasure helper."
+        https://bugs.webkit.org/show_bug.cgi?id=168675
+        http://trac.webkit.org/changeset/212768
+
 2017-02-20  Simon Fraser  <[email protected]>
 
         Add support to PlatformCALayer/GraphicsLayerCA for subpixel-antialiased text, with a Setting and a MiniBrowser switch

Modified: trunk/Source/WebKit/mac/Configurations/WebKitLegacy.xcconfig (212786 => 212787)


--- trunk/Source/WebKit/mac/Configurations/WebKitLegacy.xcconfig	2017-02-22 01:35:13 UTC (rev 212786)
+++ trunk/Source/WebKit/mac/Configurations/WebKitLegacy.xcconfig	2017-02-22 01:58:29 UTC (rev 212787)
@@ -25,7 +25,7 @@
 #include "Version.xcconfig"
 
 EXCLUDED_SOURCE_FILE_NAMES[sdk=iphone*] = *.defs *.nib *.pdf *.tiff CarbonUtils.* CarbonWindowAdapter.* CarbonWindowContentView.* CarbonWindowFrame.* HIViewAdapter.* HIWebView.* OutlookQuirksUserScript.js PopupMenuMac.* SearchPopupMenuMac.* WebClipView.* WebDashboardRegion.* WebDynamicScrollBarsView.* WebIconDatabase.* WebIconDatabasePrivate.* WebInspectorClient.* WebJavaScriptTextInputPanel.* WebNSEventExtras.* WebNSPasteboardExtras.* WebNSWindowExtras.* WebPanelAuthenticationHandler.* WebPluginsPrivate.* WebStringTruncator.* WebTextCompletionController.*;
-EXCLUDED_SOURCE_FILE_NAMES[sdk=macosx*] = *IOS.mm WebCaretChangeListener.h WebFixedPositionContent.h WebFrameIOS.h WebFrameIPhone.h WebGeolocationCoreLocationProvider.h WebGeolocationPrivate.h WebGeolocationProviderIOS.h WebMIMETypeRegistry.h WebNSStringExtrasIOS.h WebNSStringExtrasIPhone.h WebPDFViewIOS.h WebPDFViewIPhone.h WebPDFViewPlaceholder.h WebSelectionRect.h WebUIKitDelegate.h WebUIKitSupport.h WebVisiblePosition.h DOMHTMLTextAreaElementPrivate.h DOMUIKitExtensions.h;
+EXCLUDED_SOURCE_FILE_NAMES[sdk=macosx*] = *IOS.mm MemoryMeasure.h WebCaretChangeListener.h WebFixedPositionContent.h WebFrameIOS.h WebFrameIPhone.h WebGeolocationCoreLocationProvider.h WebGeolocationPrivate.h WebGeolocationProviderIOS.h WebMIMETypeRegistry.h WebNSStringExtrasIOS.h WebNSStringExtrasIPhone.h WebPDFViewIOS.h WebPDFViewIPhone.h WebPDFViewPlaceholder.h WebSelectionRect.h WebUIKitDelegate.h WebUIKitSupport.h WebVisiblePosition.h DOMHTMLTextAreaElementPrivate.h DOMUIKitExtensions.h;
 
 EXPORTED_SYMBOLS_FILE = $(EXPORTED_SYMBOLS_FILE_$(CURRENT_ARCH));
 EXPORTED_SYMBOLS_FILE_ = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKitLegacy/WebKitLegacy.generated.exp;

Modified: trunk/Source/WebKit/mac/Misc/WebCache.mm (212786 => 212787)


--- trunk/Source/WebKit/mac/Misc/WebCache.mm	2017-02-22 01:35:13 UTC (rev 212786)
+++ trunk/Source/WebKit/mac/Misc/WebCache.mm	2017-02-22 01:58:29 UTC (rev 212787)
@@ -41,6 +41,7 @@
 #import <wtf/RunLoop.h>
 
 #if PLATFORM(IOS)
+#import "MemoryMeasure.h"
 #import "WebFrameInternal.h"
 #import <WebCore/CachedImage.h>
 #import <WebCore/Frame.h>
@@ -130,6 +131,8 @@
     // schedule this method on the WebThread as well so as to pick up all the
     // dead resources left behind after closing the WebViews
     WebThreadRun(^{
+        WebKit::MemoryMeasure measurer("[WebCache emptyInMemoryResources]");
+
         // Toggling the cache model like this forces the cache to evict all its in-memory resources.
         WebCacheModel cacheModel = [WebView _cacheModel];
         [WebView _setCacheModel:WebCacheModelDocumentViewer];

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (212786 => 212787)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2017-02-22 01:35:13 UTC (rev 212786)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2017-02-22 01:58:29 UTC (rev 212787)
@@ -243,6 +243,7 @@
 #import <WebCore/TextIndicatorWindow.h>
 #import <WebCore/WebVideoFullscreenController.h>
 #else
+#import "MemoryMeasure.h"
 #import "WebCaretChangeListener.h"
 #import "WebChromeClientIOS.h"
 #import "WebDefaultFormDelegate.h"
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to