Title: [192786] trunk/Source/WebKit2
Revision
192786
Author
[email protected]
Date
2015-11-28 13:30:06 -0800 (Sat, 28 Nov 2015)

Log Message

Stop unnecessarily copying WKWebViewConfiguration in a few places
https://bugs.webkit.org/show_bug.cgi?id=151639

Reviewed by Dan Bernstein.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithFrame:configuration:]):
(-[WKWebView dealloc]):
(-[WKWebView _contentProviderRegistry]):
(-[WKWebView _selectionGranularity]):
(-[WKWebView _setHasCustomContentView:loadedMIMEType:]):
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::mimeTypesWithCustomContentProviders):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setupInteraction]):
(-[WKContentView _stopAssistingKeyboard]):
Looking at allocation traces I noticed that we were making way more
WKWebViewConfigurations than made sense; looking at backtraces I found
a few internal callers of -[WKWebView configuration], which copies the
configuration. There's no reason for these internal callers to make
such a copy, though.

I'm not exactly sure what the usual approach is here, but I added
getters so WKContentViewInteraction and PageClientImplIOS can get to
the values they're looking for without using the configuration property.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (192785 => 192786)


--- trunk/Source/WebKit2/ChangeLog	2015-11-28 08:53:43 UTC (rev 192785)
+++ trunk/Source/WebKit2/ChangeLog	2015-11-28 21:30:06 UTC (rev 192786)
@@ -1,3 +1,32 @@
+2015-11-28  Tim Horton  <[email protected]>
+
+        Stop unnecessarily copying WKWebViewConfiguration in a few places
+        https://bugs.webkit.org/show_bug.cgi?id=151639
+
+        Reviewed by Dan Bernstein.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView initWithFrame:configuration:]):
+        (-[WKWebView dealloc]):
+        (-[WKWebView _contentProviderRegistry]):
+        (-[WKWebView _selectionGranularity]):
+        (-[WKWebView _setHasCustomContentView:loadedMIMEType:]):
+        * UIProcess/API/Cocoa/WKWebViewInternal.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::mimeTypesWithCustomContentProviders):
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView setupInteraction]):
+        (-[WKContentView _stopAssistingKeyboard]):
+        Looking at allocation traces I noticed that we were making way more
+        WKWebViewConfigurations than made sense; looking at backtraces I found
+        a few internal callers of -[WKWebView configuration], which copies the
+        configuration. There's no reason for these internal callers to make 
+        such a copy, though.
+
+        I'm not exactly sure what the usual approach is here, but I added
+        getters so WKContentViewInteraction and PageClientImplIOS can get to
+        the values they're looking for without using the configuration property.
+
 2015-11-27  Brady Eidson  <[email protected]>
 
         Modern IDB: Class-ify IDBGetResult making it impossible to get the data members wrong.

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (192785 => 192786)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-11-28 08:53:43 UTC (rev 192785)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-11-28 21:30:06 UTC (rev 192786)
@@ -805,6 +805,16 @@
     return _customContentView ? _customContentView.get() : _contentView.get();
 }
 
+- (WKWebViewContentProviderRegistry *)_contentProviderRegistry
+{
+    return [_configuration _contentProviderRegistry];
+}
+
+- (WKSelectionGranularity)_selectionGranularity
+{
+    return [_configuration selectionGranularity];
+}
+
 - (void)_setHasCustomContentView:(BOOL)pageHasCustomContentView loadedMIMEType:(const WTF::String&)mimeType
 {
     if (pageHasCustomContentView) {

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (192785 => 192786)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h	2015-11-28 08:53:43 UTC (rev 192785)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h	2015-11-28 21:30:06 UTC (rev 192786)
@@ -28,6 +28,7 @@
 #if WK_API_ENABLED
 
 #import "SameDocumentNavigationType.h"
+#import "WKWebViewConfiguration.h"
 #import <wtf/RefPtr.h>
 #import <wtf/RetainPtr.h>
 
@@ -54,6 +55,7 @@
 struct PrintInfo;
 }
 
+@class WKWebViewContentProviderRegistry;
 @class _WKFrameHandle;
 
 @interface WKWebView () WK_WEB_VIEW_PROTOCOLS {
@@ -109,6 +111,10 @@
 - (void)_navigationGestureDidBegin;
 - (void)_navigationGestureDidEnd;
 
+@property (nonatomic, readonly) WKWebViewContentProviderRegistry *_contentProviderRegistry;
+
+@property (nonatomic, readonly) WKSelectionGranularity _selectionGranularity;
+
 @property (nonatomic, readonly) BOOL _allowsDoubleTapGestures;
 @property (nonatomic, readonly) UIEdgeInsets _computedContentInset;
 #endif

Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (192785 => 192786)


--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm	2015-11-28 08:53:43 UTC (rev 192785)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm	2015-11-28 21:30:06 UTC (rev 192786)
@@ -681,7 +681,7 @@
 
 Vector<String> PageClientImpl::mimeTypesWithCustomContentProviders()
 {
-    return m_webView.configuration._contentProviderRegistry._mimeTypesWithCustomContentProviders;
+    return m_webView._contentProviderRegistry._mimeTypesWithCustomContentProviders;
 }
 
 void PageClientImpl::navigationGestureDidBegin()

Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (192785 => 192786)


--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2015-11-28 08:53:43 UTC (rev 192785)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm	2015-11-28 21:30:06 UTC (rev 192786)
@@ -484,7 +484,7 @@
     _showingTextStyleOptions = NO;
 
     // FIXME: This should be called when we get notified that loading has completed.
-    [self useSelectionAssistantWithMode:toUIWebSelectionMode([[_webView configuration] selectionGranularity])];
+    [self useSelectionAssistantWithMode:toUIWebSelectionMode([_webView _selectionGranularity])];
     
     _actionSheetAssistant = adoptNS([[WKActionSheetAssistant alloc] initWithView:self]);
     [_actionSheetAssistant setDelegate:self];
@@ -3179,7 +3179,7 @@
 
 - (void)_stopAssistingKeyboard
 {
-    [self useSelectionAssistantWithMode:toUIWebSelectionMode([[_webView configuration] selectionGranularity])];
+    [self useSelectionAssistantWithMode:toUIWebSelectionMode([_webView _selectionGranularity])];
 }
 
 - (const AssistedNodeInformation&)assistedNodeInformation
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to