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

Issue 8968032: Allow construction and assignment of one scoped_ptr from another if the types are convertible. (Closed)

Created:
8 years, 12 months ago by awong
Modified:
8 years, 11 months ago
CC:
chromium-reviews, Paweł Hajdan Jr., brettw-cc_chromium.org, Ami GONE FROM CHROMIUM
Visibility:
Public.

Description

Allow construction and assignment of one scoped_ptr from another if the types are convertible. This allows for depth subtyping during a move operation on a scoped_ptr. With the additional constructor and operator=, we maintain move semantics but allow a scoped_ptr<A> to be constructed from a scoped_ptr<B> if B can be converted to A. =DEFICIENCY= This conversion sequence will _not_ implicitly work when calling an API. Specifically, if you have void Func(scoped_ptr<Parent> p); scoped_ptr<Child> c; Func(c.Pass()); // COMPILE ERROR This is a limitation of C++03 move emulation. The workaround is Func(scoped_ptr<Parent>(c.Pass()); BUG=109026 TEST=new unittests Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=117317

Patch Set 1 #

Patch Set 2 : style fixes. #

Patch Set 3 : rebased #

Patch Set 4 : fix copyright #

Unified diffs Side-by-side diffs Delta from patch set Stats (+95 lines, -6 lines) Patch
M base/memory/scoped_ptr.h View 1 2 3 3 chunks +15 lines, -1 line 0 comments Download
M base/memory/scoped_ptr_unittest.cc View 1 2 3 3 chunks +80 lines, -5 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
Ami GONE FROM CHROMIUM
FYI Patched in the CL but ran into difficulties trying to take advantage of it ...
8 years, 12 months ago (2011-12-30 01:02:22 UTC) #1
awong
Hey Darin, Would you be willing to review this? Both Fred and Will are out. ...
8 years, 11 months ago (2012-01-11 00:55:51 UTC) #2
darin (slow to review)
LGTM
8 years, 11 months ago (2012-01-11 01:17:54 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ajwong@chromium.org/8968032/11001
8 years, 11 months ago (2012-01-11 01:37:45 UTC) #4
commit-bot: I haz the power
8 years, 11 months ago (2012-01-11 02:30:40 UTC) #5
Try job failure for 8968032-11001 (retry) on linux_rel for step "browser_tests"
(clobber build).
It's a second try, previously, step "compile" failed.
http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_rel&...

Powered by Google App Engine
This is Rietveld 408576698