- Revision
- 208580
- Author
- achristen...@apple.com
- Date
- 2016-11-10 22:16:08 -0800 (Thu, 10 Nov 2016)
Log Message
Fix assertion after r208534.
https://bugs.webkit.org/show_bug.cgi?id=160497
Source/WebKit/mac:
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(WebInstallMemoryPressureHandler):
WebInstallMemoryPressureHandler can be called before [WebView initWithFrame:frameName:groupName:]
When this happens, we should use the same std::once_flag to make sure we install the MemoryPressureHandler::singleton
only once, otherwise we get an assertion !m_installed in MemoryPressureHandler::setLowMemoryHandler.
Tools:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/mac/MemoryPressureHandler.mm: Added.
(TestWebKitAPI::TEST):
Add a regression test.
Modified Paths
Added Paths
Diff
Modified: trunk/Source/WebKit/mac/ChangeLog (208579 => 208580)
--- trunk/Source/WebKit/mac/ChangeLog 2016-11-11 06:08:18 UTC (rev 208579)
+++ trunk/Source/WebKit/mac/ChangeLog 2016-11-11 06:16:08 UTC (rev 208580)
@@ -1,5 +1,17 @@
2016-11-10 Alex Christensen <achristen...@webkit.org>
+ Fix assertion after r208534.
+ https://bugs.webkit.org/show_bug.cgi?id=160497
+
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:]):
+ (WebInstallMemoryPressureHandler):
+ WebInstallMemoryPressureHandler can be called before [WebView initWithFrame:frameName:groupName:]
+ When this happens, we should use the same std::once_flag to make sure we install the MemoryPressureHandler::singleton
+ only once, otherwise we get an assertion !m_installed in MemoryPressureHandler::setLowMemoryHandler.
+
+2016-11-10 Alex Christensen <achristen...@webkit.org>
+
Move SecurityOrigin::databaseIdentifier() to SecurityOriginData
https://bugs.webkit.org/show_bug.cgi?id=164573
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (208579 => 208580)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2016-11-11 06:08:18 UTC (rev 208579)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2016-11-11 06:16:08 UTC (rev 208580)
@@ -1430,19 +1430,8 @@
_private->page->settings().setFontFallbackPrefersPictographs(true);
#endif
- if (![[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitSuppressMemoryPressureHandler"]) {
- WebCore::registerMemoryReleaseNotifyCallbacks();
+ WebInstallMemoryPressureHandler();
- static std::once_flag onceFlag;
- std::call_once(onceFlag, [] {
- auto& memoryPressureHandler = MemoryPressureHandler::singleton();
- memoryPressureHandler.setLowMemoryHandler([] (Critical critical, Synchronous synchronous) {
- WebCore::releaseMemory(critical, synchronous);
- });
- memoryPressureHandler.install();
- });
- }
-
if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_LOCAL_RESOURCE_SECURITY_RESTRICTION)) {
// Originally, we allowed all local loads.
SecurityPolicy::setLocalLoadPolicy(SecurityPolicy::AllowLocalLoadsForAll);
@@ -9800,6 +9789,16 @@
void WebInstallMemoryPressureHandler(void)
{
- if (![[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitSuppressMemoryPressureHandler"])
- MemoryPressureHandler::singleton().install();
+ if (![[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitSuppressMemoryPressureHandler"]) {
+ WebCore::registerMemoryReleaseNotifyCallbacks();
+
+ static std::once_flag onceFlag;
+ std::call_once(onceFlag, [] {
+ auto& memoryPressureHandler = MemoryPressureHandler::singleton();
+ memoryPressureHandler.setLowMemoryHandler([] (Critical critical, Synchronous synchronous) {
+ WebCore::releaseMemory(critical, synchronous);
+ });
+ memoryPressureHandler.install();
+ });
+ }
}
Modified: trunk/Tools/ChangeLog (208579 => 208580)
--- trunk/Tools/ChangeLog 2016-11-11 06:08:18 UTC (rev 208579)
+++ trunk/Tools/ChangeLog 2016-11-11 06:16:08 UTC (rev 208580)
@@ -1,3 +1,13 @@
+2016-11-10 Alex Christensen <achristen...@webkit.org>
+
+ Fix assertion after r208534.
+ https://bugs.webkit.org/show_bug.cgi?id=160497
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/mac/MemoryPressureHandler.mm: Added.
+ (TestWebKitAPI::TEST):
+ Add a regression test.
+
2016-11-10 Chris Dumez <cdu...@apple.com>
REGRESSION (r208522): LayoutTest fast/loader/reload-zero-byte-plugin.html is a flaky failure
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (208579 => 208580)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2016-11-11 06:08:18 UTC (rev 208579)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2016-11-11 06:16:08 UTC (rev 208580)
@@ -152,6 +152,7 @@
5769C50B1D9B0002000847FB /* SerializedCryptoKeyWrap.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5769C50A1D9B0001000847FB /* SerializedCryptoKeyWrap.mm */; };
57901FB11CAF142D00ED64F9 /* LoadInvalidURLRequest.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 57901FB01CAF141C00ED64F9 /* LoadInvalidURLRequest.html */; };
57F56A5C1C7F8CC100F31D7E /* IsNavigationActionTrusted.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 57F56A5B1C7F8A4000F31D7E /* IsNavigationActionTrusted.html */; };
+ 5C0BF88D1DD5964D00B00328 /* MemoryPressureHandler.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C0BF88C1DD5957400B00328 /* MemoryPressureHandler.mm */; };
5C2936931D5BF70D00DEAB1E /* CookieAcceptPolicy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C2936911D5BF63E00DEAB1E /* CookieAcceptPolicy.mm */; };
5C2936961D5C00ED00DEAB1E /* CookieMessage.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5C2936941D5BFD1900DEAB1E /* CookieMessage.html */; };
5C6E65441D5CEFD400F7862E /* URLParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C6E65411D5CEF8500F7862E /* URLParser.cpp */; };
@@ -949,6 +950,7 @@
5798E2AF1CAF5C2800C5CBA0 /* ProvisionalURLNotChange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ProvisionalURLNotChange.mm; sourceTree = "<group>"; };
57F10D921C7E7B3800ECDF30 /* IsNavigationActionTrusted.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IsNavigationActionTrusted.mm; sourceTree = "<group>"; };
57F56A5B1C7F8A4000F31D7E /* IsNavigationActionTrusted.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = IsNavigationActionTrusted.html; sourceTree = "<group>"; };
+ 5C0BF88C1DD5957400B00328 /* MemoryPressureHandler.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryPressureHandler.mm; sourceTree = "<group>"; };
5C2936911D5BF63E00DEAB1E /* CookieAcceptPolicy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CookieAcceptPolicy.mm; sourceTree = "<group>"; };
5C2936941D5BFD1900DEAB1E /* CookieMessage.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = CookieMessage.html; sourceTree = "<group>"; };
5C5E633D1D0B67940085A025 /* UniqueRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UniqueRef.cpp; sourceTree = "<group>"; };
@@ -1938,6 +1940,7 @@
C07E6CAD13FD67650038B22B /* mac */ = {
isa = PBXGroup;
children = (
+ 5C0BF88C1DD5957400B00328 /* MemoryPressureHandler.mm */,
C07E6CB013FD737C0038B22B /* Resources */,
379028B514FABD92007E6B43 /* AcceptsFirstMouse.mm */,
B55F119F1516834F00915916 /* AttributedString.mm */,
@@ -2541,6 +2544,7 @@
7CCE7EA91A411A1D00447C4C /* TestBrowsingContextLoadDelegate.mm in Sources */,
A14FC5901B8AE36F00D107EB /* TestProtocol.mm in Sources */,
7CCE7EAE1A411A3400447C4C /* TestsController.cpp in Sources */,
+ 5C0BF88D1DD5964D00B00328 /* MemoryPressureHandler.mm in Sources */,
CE3524F91B1441C40028A7C5 /* TextFieldDidBeginAndEndEditing.cpp in Sources */,
7CCE7EDD1A411A9200447C4C /* TimeRanges.cpp in Sources */,
7CCE7ED31A411A7E00447C4C /* TypingStyleCrash.mm in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/mac/MemoryPressureHandler.mm (0 => 208580)
--- trunk/Tools/TestWebKitAPI/Tests/mac/MemoryPressureHandler.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/MemoryPressureHandler.mm 2016-11-11 06:16:08 UTC (rev 208580)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#import "config.h"
+#import <WebKit/WebViewPrivate.h>
+
+namespace TestWebKitAPI {
+
+TEST(WebKit1, MemoryPressureHandler)
+{
+ WebInstallMemoryPressureHandler();
+ [[[WebView alloc] initWithFrame:NSZeroRect frameName:nil groupName:nil] autorelease];
+ // This test passes if it does not assert.
+}
+
+} // namespace TestWebKitAPI