Title: [215536] trunk
Revision
215536
Author
[email protected]
Date
2017-04-19 15:43:49 -0700 (Wed, 19 Apr 2017)

Log Message

REGRESSION (r213168): An extra Web Content process is spun up on launch and is never closed.
<rdar://problem/30774839> and https://bugs.webkit.org/show_bug.cgi?id=171002

Reviewed by Alex Christensen.

Source/WebKit2:

The original change unnecessarily avoided using the initial warmed process if an explicit
data store was set on the new WKWebView.

Fixing that fixes the regression.

* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _webProcessCount]):
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h:

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::createWebPage):

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/InitialWarmedProcessUsed.mm: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (215535 => 215536)


--- trunk/Source/WebKit2/ChangeLog	2017-04-19 22:27:04 UTC (rev 215535)
+++ trunk/Source/WebKit2/ChangeLog	2017-04-19 22:43:49 UTC (rev 215536)
@@ -1,3 +1,22 @@
+2017-04-19  Brady Eidson  <[email protected]>
+
+        REGRESSION (r213168): An extra Web Content process is spun up on launch and is never closed.
+        <rdar://problem/30774839> and https://bugs.webkit.org/show_bug.cgi?id=171002
+
+        Reviewed by Alex Christensen.
+
+        The original change unnecessarily avoided using the initial warmed process if an explicit
+        data store was set on the new WKWebView.
+        
+        Fixing that fixes the regression.
+        
+        * UIProcess/API/Cocoa/WKProcessPool.mm:
+        (-[WKProcessPool _webProcessCount]):
+        * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
+
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::createWebPage):
+
 2017-04-19  Anders Carlsson  <[email protected]>
 
         Rename cancelPayment to cancelPaymentSession

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm (215535 => 215536)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm	2017-04-19 22:27:04 UTC (rev 215535)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm	2017-04-19 22:43:49 UTC (rev 215536)
@@ -292,6 +292,11 @@
     _processPool->terminateDatabaseProcess();
 }
 
+- (size_t)_webProcessCount
+{
+    return _processPool->processes().size();
+}
+
 + (void)_forceGameControllerFramework
 {
 #if ENABLE(GAMEPAD)

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h (215535 => 215536)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h	2017-04-19 22:27:04 UTC (rev 215535)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h	2017-04-19 22:43:49 UTC (rev 215536)
@@ -69,6 +69,9 @@
 // Test only. Should be called only while no web content processes are running.
 - (void)_terminateDatabaseProcess;
 
+// Test only.
+- (size_t)_webProcessCount;
+
 // Test only. Should be called before any web content processes are launched.
 + (void)_forceGameControllerFramework;
 

Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp (215535 => 215536)


--- trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp	2017-04-19 22:27:04 UTC (rev 215535)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp	2017-04-19 22:43:49 UTC (rev 215536)
@@ -907,8 +907,7 @@
     if (!pageConfiguration->visitedLinkStore())
         pageConfiguration->setVisitedLinkStore(m_visitedLinkStore.ptr());
 
-    bool pageHasWebsiteDataStore = pageConfiguration->websiteDataStore();
-    if (!pageHasWebsiteDataStore) {
+    if (!pageConfiguration->websiteDataStore()) {
         ASSERT(!pageConfiguration->sessionID().isValid());
         pageConfiguration->setWebsiteDataStore(m_websiteDataStore.get());
         pageConfiguration->setSessionID(pageConfiguration->preferences()->privateBrowsingEnabled() ? SessionID::legacyPrivateSessionID() : SessionID::defaultSessionID());
@@ -915,7 +914,7 @@
     }
 
     RefPtr<WebProcessProxy> process;
-    if (m_haveInitialEmptyProcess && !pageHasWebsiteDataStore) {
+    if (m_haveInitialEmptyProcess) {
         process = m_processes.last();
         m_haveInitialEmptyProcess = false;
     } else if (pageConfiguration->relatedPage()) {

Modified: trunk/Tools/ChangeLog (215535 => 215536)


--- trunk/Tools/ChangeLog	2017-04-19 22:27:04 UTC (rev 215535)
+++ trunk/Tools/ChangeLog	2017-04-19 22:43:49 UTC (rev 215536)
@@ -1,3 +1,13 @@
+2017-04-19  Brady Eidson  <[email protected]>
+
+        REGRESSION (r213168): An extra Web Content process is spun up on launch and is never closed.
+        <rdar://problem/30774839> and https://bugs.webkit.org/show_bug.cgi?id=171002
+
+        Reviewed by Alex Christensen.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit2Cocoa/InitialWarmedProcessUsed.mm: Added.
+
 2017-04-19  Brent Fulgham  <[email protected]>
 
         [WK2] Run tests with ResourceLoadStatistics enabled

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (215535 => 215536)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2017-04-19 22:27:04 UTC (rev 215535)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2017-04-19 22:43:49 UTC (rev 215536)
@@ -150,6 +150,7 @@
 		51714EB51CF8C78C004723C4 /* WebProcessKillIDBCleanup-2.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51714EB31CF8C761004723C4 /* WebProcessKillIDBCleanup-2.html */; };
 		51714EB81CF8CA17004723C4 /* WebProcessKillIDBCleanup.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51714EB61CF8C7A4004723C4 /* WebProcessKillIDBCleanup.mm */; };
 		517E7E04151119C100D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 517E7E031511187500D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html */; };
+		5198A2401EA7E59F008910B7 /* InitialWarmedProcessUsed.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5198A23F1EA7E595008910B7 /* InitialWarmedProcessUsed.mm */; };
 		51A5877D1D1B49CD004BA9AF /* IndexedDBMultiProcess-3.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51A5877C1D1B3D8D004BA9AF /* IndexedDBMultiProcess-3.html */; };
 		51A587851D2739E3004BA9AF /* IndexedDBDatabaseProcessKill-1.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51A587821D272EB5004BA9AF /* IndexedDBDatabaseProcessKill-1.html */; };
 		51A587861D273AA9004BA9AF /* IndexedDBDatabaseProcessKill.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51A587841D272EF3004BA9AF /* IndexedDBDatabaseProcessKill.mm */; };
@@ -1077,6 +1078,7 @@
 		51714EB91D087416004723C4 /* CrossThreadTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CrossThreadTask.cpp; sourceTree = "<group>"; };
 		517E7DFB15110EA600D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryCachePruneWithinResourceLoadDelegate.mm; sourceTree = "<group>"; };
 		517E7E031511187500D0B008 /* MemoryCachePruneWithinResourceLoadDelegate.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = MemoryCachePruneWithinResourceLoadDelegate.html; sourceTree = "<group>"; };
+		5198A23F1EA7E595008910B7 /* InitialWarmedProcessUsed.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InitialWarmedProcessUsed.mm; sourceTree = "<group>"; };
 		51A5877C1D1B3D8D004BA9AF /* IndexedDBMultiProcess-3.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "IndexedDBMultiProcess-3.html"; sourceTree = "<group>"; };
 		51A587821D272EB5004BA9AF /* IndexedDBDatabaseProcessKill-1.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "IndexedDBDatabaseProcessKill-1.html"; sourceTree = "<group>"; };
 		51A587841D272EF3004BA9AF /* IndexedDBDatabaseProcessKill.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IndexedDBDatabaseProcessKill.mm; sourceTree = "<group>"; };
@@ -1679,6 +1681,7 @@
 				51A587841D272EF3004BA9AF /* IndexedDBDatabaseProcessKill.mm */,
 				51BCEE491C84F4AF0042C82E /* IndexedDBMultiProcess.mm */,
 				51B1EE8D1C80F5880064FB98 /* IndexedDBPersistence.mm */,
+				5198A23F1EA7E595008910B7 /* InitialWarmedProcessUsed.mm */,
 				2DB0232E1E4E871800707123 /* InteractionDeadlockAfterCrash.mm */,
 				C25CCA051E51380B0026CB8A /* LineBreaking.mm */,
 				37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */,
@@ -2799,6 +2802,7 @@
 				7CCE7EBB1A411A7E00447C4C /* DOMHTMLTableCellCellAbove.mm in Sources */,
 				2D51A0C71C8BF00C00765C45 /* DOMHTMLVideoElementWrapper.mm in Sources */,
 				46397B951DC2C850009A78AE /* DOMNode.mm in Sources */,
+				5198A2401EA7E59F008910B7 /* InitialWarmedProcessUsed.mm in Sources */,
 				7CCE7EBC1A411A7E00447C4C /* DOMNodeFromJSObject.mm in Sources */,
 				7CCE7EBD1A411A7E00447C4C /* DOMRangeOfString.mm in Sources */,
 				37E7DD641EA06FF2009B396D /* AdditionalReadAccessAllowedURLs.mm in Sources */,

Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/InitialWarmedProcessUsed.mm (0 => 215536)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/InitialWarmedProcessUsed.mm	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/InitialWarmedProcessUsed.mm	2017-04-19 22:43:49 UTC (rev 215536)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 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
+ * 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 "PlatformUtilities.h"
+#import "Test.h"
+#import "TestNavigationDelegate.h"
+
+#import <WebKit/WKProcessPoolPrivate.h>
+#import <wtf/RetainPtr.h>
+
+#if WK_API_ENABLED
+
+static NSString *loadableURL = @"data:text/html,no%20error%20A";
+
+TEST(WKProcessPool, InitialWarmedProcessUsed)
+{
+    auto *pool = [WKProcessPool _sharedProcessPool];
+    [pool _warmInitialProcess];
+
+    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    configuration.get().processPool = pool;
+    configuration.get().websiteDataStore = [WKWebsiteDataStore nonPersistentDataStore];
+
+    auto webView = adoptNS([[WKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:configuration.get()]);
+    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:loadableURL]]];
+    [webView _test_waitForDidFinishNavigation];
+
+    EXPECT_EQ([pool _webProcessCount], static_cast<size_t>(1));
+}
+
+#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to