Title: [231371] trunk/Source/WebKit
- Revision
- 231371
- Author
- [email protected]
- Date
- 2018-05-04 12:42:40 -0700 (Fri, 04 May 2018)
Log Message
Wasted time dlopening Lookup when tearing down a WKWebView
https://bugs.webkit.org/show_bug.cgi?id=185310
<rdar://problem/39934085>
Reviewed by Wenson Hsieh.
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(-[WKWindowVisibilityObserver dealloc]):
(-[WKWindowVisibilityObserver startObservingLookupDismissalIfNeeded]):
(WebKit::WebViewImpl::prepareForDictionaryLookup):
(-[WKWindowVisibilityObserver startObservingLookupDismissal]): Deleted.
Avoid un-registering as a Lookup dismissal observer if we never
registered in the first place, because that involves dlopening Lookup.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (231370 => 231371)
--- trunk/Source/WebKit/ChangeLog 2018-05-04 19:16:40 UTC (rev 231370)
+++ trunk/Source/WebKit/ChangeLog 2018-05-04 19:42:40 UTC (rev 231371)
@@ -1,3 +1,20 @@
+2018-05-04 Tim Horton <[email protected]>
+
+ Wasted time dlopening Lookup when tearing down a WKWebView
+ https://bugs.webkit.org/show_bug.cgi?id=185310
+ <rdar://problem/39934085>
+
+ Reviewed by Wenson Hsieh.
+
+ * UIProcess/Cocoa/WebViewImpl.h:
+ * UIProcess/Cocoa/WebViewImpl.mm:
+ (-[WKWindowVisibilityObserver dealloc]):
+ (-[WKWindowVisibilityObserver startObservingLookupDismissalIfNeeded]):
+ (WebKit::WebViewImpl::prepareForDictionaryLookup):
+ (-[WKWindowVisibilityObserver startObservingLookupDismissal]): Deleted.
+ Avoid un-registering as a Lookup dismissal observer if we never
+ registered in the first place, because that involves dlopening Lookup.
+
2018-05-04 Megan Gardner <[email protected]>
Allow Web Touch events to timeout
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h (231370 => 231371)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h 2018-05-04 19:16:40 UTC (rev 231370)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h 2018-05-04 19:42:40 UTC (rev 231371)
@@ -680,7 +680,6 @@
RetainPtr<NSImmediateActionGestureRecognizer> m_immediateActionGestureRecognizer;
bool m_allowsLinkPreview { true };
- bool m_didRegisterForLookupPopoverCloseNotifications { false };
RetainPtr<NSTrackingArea> m_primaryTrackingArea;
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (231370 => 231371)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2018-05-04 19:16:40 UTC (rev 231370)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2018-05-04 19:42:40 UTC (rev 231371)
@@ -186,6 +186,8 @@
@interface WKWindowVisibilityObserver : NSObject {
NSView *_view;
WebKit::WebViewImpl *_impl;
+
+ BOOL _didRegisterForLookupPopoverCloseNotifications;
}
- (instancetype)initWithView:(NSView *)view impl:(WebKit::WebViewImpl&)impl;
@@ -192,7 +194,7 @@
- (void)startObserving:(NSWindow *)window;
- (void)stopObserving:(NSWindow *)window;
- (void)startObservingFontPanel;
-- (void)startObservingLookupDismissal;
+- (void)startObservingLookupDismissalIfNeeded;
@end
@implementation WKWindowVisibilityObserver
@@ -214,7 +216,7 @@
- (void)dealloc
{
- if (canLoadLUNotificationPopoverWillClose())
+ if (_didRegisterForLookupPopoverCloseNotifications && canLoadLUNotificationPopoverWillClose())
[[NSNotificationCenter defaultCenter] removeObserver:self name:getLUNotificationPopoverWillClose() object:nil];
NSNotificationCenter *workspaceNotificationCenter = [[NSWorkspace sharedWorkspace] notificationCenter];
@@ -283,8 +285,13 @@
[[NSFontPanel sharedFontPanel] addObserver:self forKeyPath:@"visible" options:0 context:keyValueObservingContext];
}
-- (void)startObservingLookupDismissal
+- (void)startObservingLookupDismissalIfNeeded
{
+ if (_didRegisterForLookupPopoverCloseNotifications)
+ return;
+
+ _didRegisterForLookupPopoverCloseNotifications = YES;
+
if (canLoadLUNotificationPopoverWillClose())
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_dictionaryLookupPopoverWillClose:) name:getLUNotificationPopoverWillClose() object:nil];
}
@@ -3216,12 +3223,7 @@
void WebViewImpl::prepareForDictionaryLookup()
{
- if (m_didRegisterForLookupPopoverCloseNotifications)
- return;
-
- m_didRegisterForLookupPopoverCloseNotifications = true;
-
- [m_windowVisibilityObserver startObservingLookupDismissal];
+ [m_windowVisibilityObserver startObservingLookupDismissalIfNeeded];
}
void WebViewImpl::setAllowsLinkPreview(bool allowsLinkPreview)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes