Bug 88805 - unneeded object creation with Vector::append
Summary: unneeded object creation with Vector::append
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-11 14:02 PDT by arno.
Modified: 2012-07-26 17:42 PDT (History)
1 user (show)

See Also:


Attachments
patch proposal (2.25 KB, patch)
2012-06-11 14:06 PDT, arno.
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description arno. 2012-06-11 14:02:34 PDT
Hi,
in contextMenuItemVector,

menuItemVector.append(ContextMenuItem(GTK_MENU_ITEM(widget)));

creates a ContextMenuItem, and pass it to Vector::append(const U& val)
which then creates a new object with 
new T(val)
which just copies the ContextMenuItem object

so, it's possible to just pass GTK_MENU_ITEM(widget), and only one ContextMenuItem object will be created.

The same pattern is also present in KeyBindingTranslator::addPendingEditorCommand
Comment 1 arno. 2012-06-11 14:06:50 PDT
Created attachment 146904 [details]
patch proposal
Comment 2 WebKit Review Bot 2012-07-26 17:42:17 PDT
Comment on attachment 146904 [details]
patch proposal

Clearing flags on attachment: 146904

Committed r123821: <http://trac.webkit.org/changeset/123821>
Comment 3 WebKit Review Bot 2012-07-26 17:42:20 PDT
All reviewed patches have been landed.  Closing bug.