Title: [169332] trunk/Source/WebKit2
Revision
169332
Author
[email protected]
Date
2014-05-26 02:22:39 -0700 (Mon, 26 May 2014)

Log Message

WebPage::setComposition(), WebPageProxy::didFindStringMatches() should take Vector parameters by const reference
https://bugs.webkit.org/show_bug.cgi?id=133264

Reviewed by Darin Adler.

Taking the Vector parameters in the two methods (invoked through the IPC message handling)
by value causes unnecessary copies. The methods don't modify the objects and don't want
or need fresh copies, hence they should take in const references to Vector objects.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didFindStringMatches):
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setComposition):
* WebProcess/WebPage/WebPage.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (169331 => 169332)


--- trunk/Source/WebKit2/ChangeLog	2014-05-26 07:44:26 UTC (rev 169331)
+++ trunk/Source/WebKit2/ChangeLog	2014-05-26 09:22:39 UTC (rev 169332)
@@ -1,3 +1,21 @@
+2014-05-26  Zan Dobersek  <[email protected]>
+
+        WebPage::setComposition(), WebPageProxy::didFindStringMatches() should take Vector parameters by const reference
+        https://bugs.webkit.org/show_bug.cgi?id=133264
+
+        Reviewed by Darin Adler.
+
+        Taking the Vector parameters in the two methods (invoked through the IPC message handling)
+        by value causes unnecessary copies. The methods don't modify the objects and don't want
+        or need fresh copies, hence they should take in const references to Vector objects.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didFindStringMatches):
+        * UIProcess/WebPageProxy.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setComposition):
+        * WebProcess/WebPage/WebPage.h:
+
 2014-05-25  Benjamin Poulain  <[email protected]>
 
         [iOS][WK2] Fix some state reset on crash on the WKWebView

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (169331 => 169332)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-05-26 07:44:26 UTC (rev 169331)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-05-26 09:22:39 UTC (rev 169332)
@@ -3379,7 +3379,7 @@
     m_findClient->didFindString(this, string, matchCount, matchIndex);
 }
 
-void WebPageProxy::didFindStringMatches(const String& string, Vector<Vector<WebCore::IntRect>> matchRects, int32_t firstIndexAfterSelection)
+void WebPageProxy::didFindStringMatches(const String& string, const Vector<Vector<WebCore::IntRect>>& matchRects, int32_t firstIndexAfterSelection)
 {
     Vector<RefPtr<API::Object>> matches;
     matches.reserveInitialCapacity(matchRects.size());

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (169331 => 169332)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2014-05-26 07:44:26 UTC (rev 169331)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2014-05-26 09:22:39 UTC (rev 169332)
@@ -853,7 +853,7 @@
     void setFindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut, bool animate);
     void didFindString(const String&, uint32_t matchCount, int32_t matchIndex);
     void didFailToFindString(const String&);
-    void didFindStringMatches(const String&, Vector<Vector<WebCore::IntRect>> matchRects, int32_t firstIndexAfterSelection);
+    void didFindStringMatches(const String&, const Vector<Vector<WebCore::IntRect>>& matchRects, int32_t firstIndexAfterSelection);
 
     void getContentsAsString(PassRefPtr<StringCallback>);
     void getBytecodeProfile(PassRefPtr<StringCallback>);

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (169331 => 169332)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2014-05-26 07:44:26 UTC (rev 169331)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2014-05-26 09:22:39 UTC (rev 169332)
@@ -4156,7 +4156,7 @@
     send(Messages::WebPageProxy::EditorStateChanged(editorState()));
 }
 
-void WebPage::setComposition(const String& text, Vector<CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionLength, uint64_t replacementStart, uint64_t replacementLength)
+void WebPage::setComposition(const String& text, const Vector<CompositionUnderline>& underlines, uint64_t selectionStart, uint64_t selectionLength, uint64_t replacementStart, uint64_t replacementLength)
 {
     Frame* targetFrame = targetFrameForEditing(this);
     if (!targetFrame || !targetFrame->selection().selection().isContentEditable()) {

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (169331 => 169332)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-05-26 07:44:26 UTC (rev 169331)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-05-26 09:22:39 UTC (rev 169332)
@@ -553,7 +553,7 @@
 #endif
 
 #if PLATFORM(GTK)
-    void setComposition(const String& text, Vector<WebCore::CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeLength);
+    void setComposition(const String& text, const Vector<WebCore::CompositionUnderline>& underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeLength);
     void confirmComposition(const String& text, int64_t selectionStart, int64_t selectionLength);
     void cancelComposition();
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to