WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 131454
[GTK][WK2] Move Vector objects into WebEditorClient::executePendingEditorCommands() invocations
https://bugs.webkit.org/show_bug.cgi?id=131454
Summary
[GTK][WK2] Move Vector objects into WebEditorClient::executePendingEditorComm...
Zan Dobersek
Reported
2014-04-09 14:35:35 PDT
[GTK][WK2] Move Vector objects into WebEditorClient::executePendingEditorCommands() invocations
Attachments
Patch
(3.12 KB, patch)
2014-04-09 14:43 PDT
,
Zan Dobersek
no flags
Details
Formatted Diff
Diff
Patch
(2.37 KB, patch)
2014-04-10 22:43 PDT
,
Zan Dobersek
cgarcia
: review+
cgarcia
: commit-queue-
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Zan Dobersek
Comment 1
2014-04-09 14:43:58 PDT
Created
attachment 228984
[details]
Patch
Martin Robinson
Comment 2
2014-04-09 16:33:13 PDT
Comment on
attachment 228984
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=228984&action=review
> Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:50 > bool WebEditorClient::executePendingEditorCommands(Frame* frame, Vector<WTF::String> pendingEditorCommands, bool allowTextInsertion)
It seems like this should either copy the contents or take a reference to pendingEditorCommands. If we don't mind stomping the contents of pendingEditorCommands a reference more straight-forward. If we do mind, we cannot use std::move, right?
Zan Dobersek
Comment 3
2014-04-10 00:56:04 PDT
Comment on
attachment 228984
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=228984&action=review
>> Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:50 >> bool WebEditorClient::executePendingEditorCommands(Frame* frame, Vector<WTF::String> pendingEditorCommands, bool allowTextInsertion) > > It seems like this should either copy the contents or take a reference to pendingEditorCommands. If we don't mind stomping the contents of pendingEditorCommands a reference more straight-forward. If we do mind, we cannot use std::move, right?
We don't mind stomping the contents of that Vector, even if we don't stomp them in the end. But in WebEditorClient::handleKeyboardEvent() the Vector isn't used after the WebEditorClient::executePendingEditorCommands() call (whichever of the two is performed), so moving the object along into that invocation isn't harmful. Passing in the Vector by reference would make sense if we'd use that Vector later in handleKeyboardEvent(), but we don't. There's nothing wrong with passing the object by reference, but it's not necessary. Hence the proposal to use std::move() and pass it by value.
Martin Robinson
Comment 4
2014-04-10 07:41:56 PDT
(In reply to
comment #3
)
> Passing in the Vector by reference would make sense if we'd use that Vector later in handleKeyboardEvent(), but we don't. There's nothing wrong with passing the object by reference, but it's not necessary. Hence the proposal to use std::move() and pass it by value.
It's slightly more efficient because you don't have to construct a new object and matches what we usually do in that situation.
Zan Dobersek
Comment 5
2014-04-10 22:42:42 PDT
(In reply to
comment #4
)
> (In reply to
comment #3
) > > > Passing in the Vector by reference would make sense if we'd use that Vector later in handleKeyboardEvent(), but we don't. There's nothing wrong with passing the object by reference, but it's not necessary. Hence the proposal to use std::move() and pass it by value. > > It's slightly more efficient because you don't have to construct a new object and matches what we usually do in that situation.
I see, WebEditorClient::executePendingEditorCommands() only reads from the Vector but doesn't store it, so taking the const reference of the Vector is indeed more intuitive.
Zan Dobersek
Comment 6
2014-04-10 22:43:08 PDT
Created
attachment 229110
[details]
Patch
Carlos Garcia Campos
Comment 7
2014-04-10 23:40:13 PDT
Comment on
attachment 229110
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=229110&action=review
Please update also the header to fix the build.
> Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:50 > +bool WebEditorClient::executePendingEditorCommands(Frame* frame, const Vector<WTF::String>& pendingEditorCommands, bool allowTextInsertion)
You need to update the header too.
Zan Dobersek
Comment 8
2014-04-11 01:21:42 PDT
Comment on
attachment 229110
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=229110&action=review
>> Source/WebKit2/WebProcess/WebCoreSupport/gtk/WebEditorClientGtk.cpp:50 >> +bool WebEditorClient::executePendingEditorCommands(Frame* frame, const Vector<WTF::String>& pendingEditorCommands, bool allowTextInsertion) > > You need to update the header too.
Heh, of course :>
Zan Dobersek
Comment 9
2014-04-11 01:25:55 PDT
Committed
r167116
: <
http://trac.webkit.org/changeset/167116
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug