Bug 96732 - Add *explicit* keyword to constructors to WebKit2/UIProcess
Summary: Add *explicit* keyword to constructors to WebKit2/UIProcess
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit EFL (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Gyuyoung Kim
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-13 23:40 PDT by Gyuyoung Kim
Modified: 2012-09-14 23:14 PDT (History)
6 users (show)

See Also:


Attachments
Patch (13.57 KB, patch)
2012-09-13 23:45 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (12.77 KB, patch)
2012-09-14 17:49 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gyuyoung Kim 2012-09-13 23:40:58 PDT
As a step of *explicit* cleanup for constructors which have only one parameter, *explicit* is added to WebKit2/UIProcess in order to avoid implicit type conversion.
Comment 1 Gyuyoung Kim 2012-09-13 23:45:50 PDT
Created attachment 164058 [details]
Patch
Comment 2 Gyuyoung Kim 2012-09-13 23:46:32 PDT
This patch should pass all ews except for chromium.
Comment 3 Chris Dumez 2012-09-13 23:49:02 PDT
Comment on attachment 164058 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=164058&action=review

> Source/WebKit2/UIProcess/WebPreferences.h:83
> +    explicit WebPreferences(const WebPreferences&);

This is a copy constructor. Please don't add explicit here.
Comment 4 Kentaro Hara 2012-09-14 01:32:39 PDT
Comment on attachment 164058 [details]
Patch

Marking r+ with nits:

- Please remove 'explicit' from the copy constructor that Christophe pointed out.
- Please rebase your patch.
- Please keep watching bots when landing.
Comment 5 Kentaro Hara 2012-09-14 01:33:09 PDT
Comment on attachment 164058 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=164058&action=review

> Source/WebKit2/UIProcess/WebPreferences.h:82
> +    explicit WebPreferences(const String& identifier);

Nit: 'identifier' is not needed.
Comment 6 Mikhail Pozdnyakov 2012-09-14 01:41:00 PDT
Comment on attachment 164058 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=164058&action=review

> Source/WebKit2/UIProcess/Authentication/AuthenticationDecisionListener.h:53
> +    explicit AuthenticationDecisionListener(AuthenticationChallengeProxy*);

Just wondering, does it make a lot of sense to make private constructors explicit?
Comment 7 Gyuyoung Kim 2012-09-14 17:49:42 PDT
Created attachment 164257 [details]
Patch
Comment 8 Gyuyoung Kim 2012-09-14 18:03:55 PDT
(In reply to comment #6)

> Just wondering, does it make a lot of sense to make private constructors explicit?

Compared to public constructor, private one seems unlikely to be used wrongly. However, in my humble opinion, to use explicit keyword is a little bit more safe than not to use it in open source case. For example, anyone can touch source code in factory functions of class inside with yoda style.
Comment 9 WebKit Review Bot 2012-09-14 23:14:17 PDT
Comment on attachment 164257 [details]
Patch

Clearing flags on attachment: 164257

Committed r128683: <http://trac.webkit.org/changeset/128683>
Comment 10 WebKit Review Bot 2012-09-14 23:14:22 PDT
All reviewed patches have been landed.  Closing bug.