summaryrefslogtreecommitdiffstats
path: root/mojo/system/core_test_base.cc
diff options
context:
space:
mode:
authordcheng <dcheng@chromium.org>2014-09-27 00:35:18 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-27 07:35:36 +0000
commit3e0ecf447b35e5bc984d9f00e192de335d5657a1 (patch)
treed09654d6428e3a2af6cb1043054420479dcd1a81 /mojo/system/core_test_base.cc
parent78d5331bcd375f8c8f0285d648dc30cc4f206367 (diff)
downloadchromium_src-3e0ecf447b35e5bc984d9f00e192de335d5657a1.zip
chromium_src-3e0ecf447b35e5bc984d9f00e192de335d5657a1.tar.gz
chromium_src-3e0ecf447b35e5bc984d9f00e192de335d5657a1.tar.bz2
Revert of Add nullptr support to scoped_ptr. (patchset #7 id:180001 of https://codereview.chromium.org/599313003/)
Reason for revert: This CL broke several scoped_ptr tests. Original issue's description: > Add nullptr support to scoped_ptr. > > This adds support to use nullptr to construct, assign, or return a > scoped_ptr<T> and scoped_ptr<T[]>. Support for this requires the use > of a move-only constructor. > > The changes are: > > - Add a constructor that takes decltype(nullptr) as a parameter. This > allows behaviour such as scoped_ptr<T>(nullptr), but also allows a > function with return type scoped_ptr<T> to "return nullptr;" instead > of "return scoped_ptr<T>();". > > - Add an operator=(decltype(nullptr)) that resets the scoped_ptr to > empty and deletes anything it held. > > - Add/Modify a constructor to take a scoped_ptr<U,E>&& parameter for > constructing a scoped_ptr from another using move-only semantics. This > piece is critical for allowing the function returning nullptr to be > assigned to some other scoped_ptr at the callsite. In particular, take > the following code: > scoped_ptr<T> Function() { return nullptr; } > scoped_ptr<T> var = Function(); > In this case the constructor which takes a nullptr allows Function() to > be written, but not to be used. The move-only constructor allows the > assignment from Function() to var. See "C++11 feature proposal: > Move-only constructors" on chromium-dev for more explanation why. > > The scoped_ptr<T> class already had a constructor which took > scoped_ptr<U,E> as an argument, so this was changed to be > scoped_ptr<U,E>&& instead. The scoped_ptr<T[]> class had no such > constructor, so a scoped_ptr&& constructor was added. These match > the constructors found on the unique_ptr class. > > - Remove the RValue type and the contructor that constructs a > scoped_ptr from an RValue. Change Pass() to return a scoped_ptr&& > instead of a scoped_ptr::RValue, to avoid the type conversion and > remove some complexity. This is done with a new emulation macro that > still provides Pass() and makes the type go down the MoveOnlyType > path in base::Callback code. > > This adds base_unittests to demonstrate and use these changes. > > The use of Pass() remains unchanged until std::move() is written > or allowed. At that time std::move() could be used instead of Pass. > > R=brettw@chromium.org, jamesr@chromium.org > > Committed: https://crrev.com/2299e91d3508f8d5d18ef990cf6024ea4371250a > Cr-Commit-Position: refs/heads/master@{#297072} TBR=brettw@chromium.org,jamesr@chromium.org,thakis@chromium.org,danakj@chromium.org NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/603353005 Cr-Commit-Position: refs/heads/master@{#297107}
Diffstat (limited to 'mojo/system/core_test_base.cc')
0 files changed, 0 insertions, 0 deletions