Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(560)

Issue 23531003: Type check when upcasting PassOwnPtr/PassOwnArrayPtr to avoid possible function call ambiguousness (Closed)

Created:
7 years, 3 months ago by Mikhail
Modified:
7 years, 3 months ago
Reviewers:
Nico, kouhei (in TOK)
CC:
blink-reviews, loislo+blink_chromium.org, eae+blinkwatch, yurys+blink_chromium.org, abarth-chromium, dglazkov+blink, adamk+blink_chromium.org, jeez, kouhei (in TOK), tkent, Hajime Morrita, Chris Evans
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Type check when upcasting PassOwnPtr/PassOwnArrayPtr to avoid possible function call ambiguousness This change is basically extends RefPtr EnsurePtrConvertibleArg pattern to OwnPtr and OwnArrayPtr smart pointers. Please look at the following example: class BaseClass {}; class DerivedClass: public BaseClass {}; void foo(PassOwnPtr<BaseClass>) {} void foo(PassOwnPtr<int /* or whatever type*/>) {} void fooClientFunction() { OwnPtr<DerivedClass> ptr = adoptPtr(new DerivedClass); foo(ptr.release()); } before this change such snippet would have lead to "error: call of overloaded 'foo(WTF::PassOwnPtr<DerivedClass>)' is ambiguous". This CL solves the problem. Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=157449

Patch Set 1 #

Total comments: 3

Patch Set 2 : Keeping macros in TypeTraits.h #

Total comments: 1

Patch Set 3 : No new macros introduced. Only ones from TypeTraits.h are used. #

Total comments: 1

Patch Set 4 : Attempt to remove unrelated snippet from the patch. #

Patch Set 5 : Rebased. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -6 lines) Patch
M Source/wtf/OwnArrayPtr.h View 1 2 chunks +2 lines, -2 lines 0 comments Download
M Source/wtf/OwnPtr.h View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download
M Source/wtf/PassOwnArrayPtr.h View 1 1 chunk +1 line, -1 line 0 comments Download
M Source/wtf/PassOwnPtr.h View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 16 (0 generated)
Mikhail
Could you please have a look?
7 years, 3 months ago (2013-08-29 11:55:56 UTC) #1
Nico
This looks like a fine CL. Maybe you can include an example of bad code ...
7 years, 3 months ago (2013-08-29 19:58:47 UTC) #2
Mikhail
On 2013/08/29 19:58:47, Nico wrote: > This looks like a fine CL. Maybe you can ...
7 years, 3 months ago (2013-08-30 10:06:19 UTC) #3
Nico
I see, thanks for explaining. Can you add that example to the CL description, please? ...
7 years, 3 months ago (2013-08-31 20:51:34 UTC) #4
Mikhail
On 2013/08/31 20:51:34, Nico wrote: > I see, thanks for explaining. Can you add that ...
7 years, 3 months ago (2013-09-02 10:59:28 UTC) #5
kouhei (in TOK)
https://codereview.chromium.org/23531003/diff/8001/Source/wtf/OwnPtrCommon.h File Source/wtf/OwnPtrCommon.h (right): https://codereview.chromium.org/23531003/diff/8001/Source/wtf/OwnPtrCommon.h#newcode34 Source/wtf/OwnPtrCommon.h:34: EnsurePtrConvertibleArgDefn(typename RemovePointer<From>::Type, typename RemovePointer<To>::Type) I think we should use ...
7 years, 3 months ago (2013-09-02 12:17:23 UTC) #6
Mikhail
On 2013/09/02 12:17:23, kouhei wrote: > https://codereview.chromium.org/23531003/diff/8001/Source/wtf/OwnPtrCommon.h > File Source/wtf/OwnPtrCommon.h (right): > > https://codereview.chromium.org/23531003/diff/8001/Source/wtf/OwnPtrCommon.h#newcode34 > ...
7 years, 3 months ago (2013-09-02 12:27:26 UTC) #7
Nico
On 2013/09/02 12:27:26, mikhail.pozdnyakov wrote: > On 2013/09/02 12:17:23, kouhei wrote: > > https://codereview.chromium.org/23531003/diff/8001/Source/wtf/OwnPtrCommon.h > ...
7 years, 3 months ago (2013-09-02 17:09:34 UTC) #8
Nico
7 years, 3 months ago (2013-09-02 17:09:39 UTC) #9
Mikhail
https://codereview.chromium.org/23531003/diff/18001/Source/wtf/OwnPtr.h File Source/wtf/OwnPtr.h (right): https://codereview.chromium.org/23531003/diff/18001/Source/wtf/OwnPtr.h#newcode63 Source/wtf/OwnPtr.h:63: ~OwnPtr() Weird I don't have this change locally.
7 years, 3 months ago (2013-09-02 18:35:12 UTC) #10
Mikhail
On 2013/09/02 17:09:34, Nico wrote: > On 2013/09/02 12:27:26, mikhail.pozdnyakov wrote: > > On 2013/09/02 ...
7 years, 3 months ago (2013-09-02 18:41:52 UTC) #11
Mikhail
On 2013/09/02 18:41:52, mikhail.pozdnyakov wrote: > On 2013/09/02 17:09:34, Nico wrote: > > On 2013/09/02 ...
7 years, 3 months ago (2013-09-05 15:35:34 UTC) #12
Nico
Sorry, was away for a while. This now needs to be rebased since https://codereview.chromium.org/23960005/ has ...
7 years, 3 months ago (2013-09-06 22:11:50 UTC) #13
Mikhail
On 2013/09/06 22:11:50, Nico wrote: > Sorry, was away for a while. No worries :) ...
7 years, 3 months ago (2013-09-09 07:42:20 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mikhail.pozdnyakov@intel.com/23531003/34001
7 years, 3 months ago (2013-09-09 10:06:39 UTC) #15
commit-bot: I haz the power
7 years, 3 months ago (2013-09-09 11:14:33 UTC) #16
Message was sent while issue was closed.
Change committed as 157449

Powered by Google App Engine
This is Rietveld 408576698