Skip to content

Commit

Permalink
REGRESSION (r241988): Switching tabs is slow
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=197037
<rdar://problem/49951473>

Reviewed by Simon Fraser.

Source/WebKit:

* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
(WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState):
r241988 changed to wait for a WebPageProxy message to a given DrawingArea ID,
but WebPageProxy messages are identified by their WebPageProxy ID.
Revert that one change. The rest of the patch looks OK.

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/ReparentWebViewTimeout.mm: Added.
(TEST):
* TestWebKitAPI/cocoa/TestWKWebView.h:
* TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[TestWKWebView addToTestWindow]):
Add a test that hangs without this fix.


Canonical link: https://commits.webkit.org/211296@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244410 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
hortont424 committed Apr 17, 2019
1 parent 3ef2458 commit e6a3924
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 1 deletion.
14 changes: 14 additions & 0 deletions Source/WebKit/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
2019-04-17 Tim Horton <timothy_horton@apple.com>

REGRESSION (r241988): Switching tabs is slow
https://bugs.webkit.org/show_bug.cgi?id=197037
<rdar://problem/49951473>

Reviewed by Simon Fraser.

* UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
(WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState):
r241988 changed to wait for a WebPageProxy message to a given DrawingArea ID,
but WebPageProxy messages are identified by their WebPageProxy ID.
Revert that one change. The rest of the patch looks OK.

2019-04-17 Rob Buis <rbuis@igalia.com>

Link prefetch not useful for top-level navigation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
void TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState(ActivityStateChangeID)
{
Seconds activityStateUpdateTimeout = Seconds::fromMilliseconds(250);
process().connection()->waitForAndDispatchImmediately<Messages::WebPageProxy::DidUpdateActivityState>(m_identifier.toUInt64(), activityStateUpdateTimeout, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives);
process().connection()->waitForAndDispatchImmediately<Messages::WebPageProxy::DidUpdateActivityState>(m_webPageProxy.pageID(), activityStateUpdateTimeout, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives);
}

void TiledCoreAnimationDrawingAreaProxy::intrinsicContentSizeDidChange(const IntSize& newIntrinsicContentSize)
Expand Down
16 changes: 16 additions & 0 deletions Tools/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
2019-04-17 Tim Horton <timothy_horton@apple.com>

REGRESSION (r241988): Switching tabs is slow
https://bugs.webkit.org/show_bug.cgi?id=197037
<rdar://problem/49951473>

Reviewed by Simon Fraser.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/ReparentWebViewTimeout.mm: Added.
(TEST):
* TestWebKitAPI/cocoa/TestWKWebView.h:
* TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[TestWKWebView addToTestWindow]):
Add a test that hangs without this fix.

2019-04-17 Truitt Savell <tsavell@apple.com>

Unreviewed, rolling out r244400.
Expand Down
4 changes: 4 additions & 0 deletions Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
290F4275172A221C00939FF0 /* custom-protocol-sync-xhr.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 290F4274172A1FDE00939FF0 /* custom-protocol-sync-xhr.html */; };
297234B7173AFAC700983601 /* CustomProtocolsInvalidScheme_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 297234B5173AFAC700983601 /* CustomProtocolsInvalidScheme_Bundle.cpp */; };
2D00065F1C1F589A0088E6A7 /* WKPDFViewResizeCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D00065D1C1F58940088E6A7 /* WKPDFViewResizeCrash.mm */; };
2D08E9372267D0F4002518DA /* ReparentWebViewTimeout.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D08E9362267D0F3002518DA /* ReparentWebViewTimeout.mm */; };
2D1646E21D1862CD00015A1A /* DeferredViewInWindowStateChange.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D1646E11D1862CD00015A1A /* DeferredViewInWindowStateChange.mm */; };
2D1C04A71D76298B000A6816 /* TestNavigationDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D1C04A61D76298B000A6816 /* TestNavigationDelegate.mm */; };
2D21FE591F04642900B58E7D /* WKPDFViewStablePresentationUpdateCallback.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D21FE581F04642800B58E7D /* WKPDFViewStablePresentationUpdateCallback.mm */; };
Expand Down Expand Up @@ -1444,6 +1445,7 @@
29AB8AA2164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestBrowsingContextLoadDelegate.mm; sourceTree = "<group>"; };
29AB8AA3164C7A9300D49BEC /* TestBrowsingContextLoadDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestBrowsingContextLoadDelegate.h; sourceTree = "<group>"; };
2D00065D1C1F58940088E6A7 /* WKPDFViewResizeCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPDFViewResizeCrash.mm; sourceTree = "<group>"; };
2D08E9362267D0F3002518DA /* ReparentWebViewTimeout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ReparentWebViewTimeout.mm; sourceTree = "<group>"; };
2D1646E11D1862CD00015A1A /* DeferredViewInWindowStateChange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DeferredViewInWindowStateChange.mm; path = WebKit/DeferredViewInWindowStateChange.mm; sourceTree = "<group>"; };
2D1C04A51D76298B000A6816 /* TestNavigationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestNavigationDelegate.h; path = cocoa/TestNavigationDelegate.h; sourceTree = "<group>"; };
2D1C04A61D76298B000A6816 /* TestNavigationDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TestNavigationDelegate.mm; path = cocoa/TestNavigationDelegate.mm; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2645,6 +2647,7 @@
52D5D6BD21B9F1B20046ABA6 /* RenderingProgress.mm */,
52D5D6BE21B9F1B20046ABA6 /* RenderingProgressPlugIn.mm */,
52D5D6BF21B9F1B20046ABA6 /* RenderingProgressProtocol.h */,
2D08E9362267D0F3002518DA /* ReparentWebViewTimeout.mm */,
2D2BEB2C22324E5F005544CA /* RequestTextInputContext.mm */,
CD9E292B1C90A71F000BB800 /* RequiresUserActionForPlayback.mm */,
51C8E1A41F26AC5400BF731B /* ResourceLoadStatistics.mm */,
Expand Down Expand Up @@ -4286,6 +4289,7 @@
A12DDBFB1E836F0700CF6CAE /* RenderedImageWithOptions.mm in Sources */,
52D5D6C021B9F1B30046ABA6 /* RenderingProgress.mm in Sources */,
F464AF9220BB66EA007F9B18 /* RenderingProgressTests.mm in Sources */,
2D08E9372267D0F4002518DA /* ReparentWebViewTimeout.mm in Sources */,
2D2BEB2D22324E5F005544CA /* RequestTextInputContext.mm in Sources */,
7C83E0C41D0A654200FEBCF3 /* RequiresUserActionForPlayback.mm in Sources */,
7CCE7F0E1A411AE600447C4C /* ResizeReversePaginatedWebView.cpp in Sources */,
Expand Down
68 changes: 68 additions & 0 deletions Tools/TestWebKitAPI/Tests/WebKitCocoa/ReparentWebViewTimeout.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright (C) 2019 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.
*/

#include "config.h"

#import "PlatformUtilities.h"
#import "TestWKWebView.h"
#import <WebKit/WKProcessPoolPrivate.h>
#import <WebKit/WKWebViewPrivate.h>
#import <WebKit/_WKProcessPoolConfiguration.h>
#import <wtf/RetainPtr.h>

TEST(WebKit, ReparentWebViewTimeout)
{
RetainPtr<_WKProcessPoolConfiguration> processPoolConfiguration = [[_WKProcessPoolConfiguration alloc] init];
[processPoolConfiguration setIgnoreSynchronousMessagingTimeoutsForTesting:YES];

RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
[configuration setProcessPool:[[[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()] autorelease]];

RetainPtr<TestWKWebView> webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 100, 100) configuration:configuration.get() addToWindow:YES]);
[webView synchronouslyLoadHTMLString:@"hello"];
[webView waitForNextPresentationUpdate];

void (^runTest)(void) = ^{
__block bool done = false;

dispatch_async(dispatch_get_main_queue(), ^{
dispatch_async(dispatch_get_main_queue(), ^{
[webView removeFromSuperview];

dispatch_async(dispatch_get_main_queue(), ^{
[webView addToTestWindow];
[webView waitForNextPresentationUpdate];
done = true;
});
});
});

TestWebKitAPI::Util::run(&done);
done = false;
};

runTest();
runTest();
}
1 change: 1 addition & 0 deletions Tools/TestWebKitAPI/cocoa/TestWKWebView.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
- (NSString *)stylePropertyAtSelectionEnd:(NSString *)propertyName;
- (void)collapseToStart;
- (void)collapseToEnd;
- (void)addToTestWindow;
@end

#if PLATFORM(IOS_FAMILY)
Expand Down
9 changes: 9 additions & 0 deletions Tools/TestWebKitAPI/cocoa/TestWKWebView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,15 @@ - (void)_setUpTestWindow:(NSRect)frame
#endif
}

- (void)addToTestWindow
{
#if PLATFORM(MAC)
[[_hostWindow contentView] addSubview:self];
#else
[_hostWindow addSubview:self];
#endif
}

- (void)clearMessageHandlers:(NSArray *)messageNames
{
for (NSString *messageName in messageNames)
Expand Down

0 comments on commit e6a3924

Please sign in to comment.