summaryrefslogtreecommitdiffstats
path: root/base/move.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove Pass() helper from base/move.h.dcheng2016-03-041-18/+4
| | | | | | | | | | | Also fix some comments that refer to the old Pass() helper. BUG=557422 TBR=darin@chromium.org Review URL: https://codereview.chromium.org/1759223002 Cr-Commit-Position: refs/heads/master@{#379162}
* Convert Pass()→std::move() on Windowsdcheng2016-03-021-1/+2
| | | | | | | | | | | | | Also cleaned up a few stragglers from grepping the source: it's unclear if these are just building with weird defines, don't build at all, only build on obscure platforms, or something else… either way, Pass() itself will be removed shortly after this. BUG=557422 Review URL: https://codereview.chromium.org/1752233002 Cr-Commit-Position: refs/heads/master@{#378872}
* Reland of move Pass on OS X. (patchset #1 id:1 of ↵dcheng2016-01-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/1597543002/ ) Reason for revert: Relanding per discussion: dcheng will fix official builders, while this patch will remain in-tree to prevent regressions. Original issue's description: > Revert of Remove Pass on OS X. (patchset #1 id:1 of https://codereview.chromium.org/1586743002/ ) > > Reason for revert: > This has broken compiles on this Mac bot: https://build.chromium.org/p/chromium.chrome/builders/Google%20Chrome%20Mac/builds/6887 > > Original issue's description: > > Remove Pass on OS X. > > > > Pass() is a legacy of the original C++03 move emulation implementation. > > New code should use std::move from <utility>. > > > > BUG=557422 > > R=danakj@chromium.org > > > > Committed: https://crrev.com/04e90d5757b393018d1b608fd67608d460bb97f6 > > Cr-Commit-Position: refs/heads/master@{#369765} > > TBR=danakj@chromium.org,dcheng@chromium.org > # Skipping CQ checks because original CL landed less than 1 days ago. > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=557422 > > Committed: https://crrev.com/1c392f8d584a4ccae3264679483d26bdaddb146f > Cr-Commit-Position: refs/heads/master@{#369787} TBR=danakj@chromium.org,samuong@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=557422 Review URL: https://codereview.chromium.org/1583283005 Cr-Commit-Position: refs/heads/master@{#369788}
* Revert of Remove Pass on OS X. (patchset #1 id:1 of ↵samuong2016-01-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/1586743002/ ) Reason for revert: This has broken compiles on this Mac bot: https://build.chromium.org/p/chromium.chrome/builders/Google%20Chrome%20Mac/builds/6887 Original issue's description: > Remove Pass on OS X. > > Pass() is a legacy of the original C++03 move emulation implementation. > New code should use std::move from <utility>. > > BUG=557422 > R=danakj@chromium.org > > Committed: https://crrev.com/04e90d5757b393018d1b608fd67608d460bb97f6 > Cr-Commit-Position: refs/heads/master@{#369765} TBR=danakj@chromium.org,dcheng@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=557422 Review URL: https://codereview.chromium.org/1597543002 Cr-Commit-Position: refs/heads/master@{#369787}
* Remove Pass on OS X.dcheng2016-01-151-1/+1
| | | | | | | | | | | | Pass() is a legacy of the original C++03 move emulation implementation. New code should use std::move from <utility>. BUG=557422 R=danakj@chromium.org Review URL: https://codereview.chromium.org/1586743002 Cr-Commit-Position: refs/heads/master@{#369765}
* Remove Pass on CrOS.dcheng2016-01-071-1/+1
| | | | | | | | | | | | | Pass() is a legacy of the original C++03 move emulation implementation. New code should use std::move from <utility>. BUG=557422 R=danakj@chromium.org,sandersd@chromium.org,spang@chromium.org TBR=reveman@chromium.org,sky@chromium.org Review URL: https://codereview.chromium.org/1553263002 Cr-Commit-Position: refs/heads/master@{#368009}
* Reland of move Pass() on Android. (patchset #1 id:1 of ↵dcheng2016-01-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/1564763002/ ) Reason for revert: Relanding because the build config in question is not covered by any trybots or the default waterfall. Per the discussion: 1) Keeping this reverted makes things harder to reland, due to the possibility of mid-air collisions. 2) The remaining failures will be fixed shortly afterwards in a followup patch. Original issue's description: > Revert of Remove Pass() on Android. (patchset #1 id:1 of https://codereview.chromium.org/1559603002/ ) > > Reason for revert: > This breaks compilation, as there are still some callsites of Pass() left. > > See Android Cronet Data Reduction Proxy Builder build #961 and onwards: https://build.chromium.org/p/chromium.android/builders/Android%20Cronet%20Data%20Reduction%20Proxy%20Builder/builds/961/steps/compile/logs/stdio > > Original issue's description: > > Remove Pass() on Android. > > > > Pass() is a legacy of the original C++03 move emulation implementation. > > New code should use std::move from <utility>. > > > > ❆(੭ु ◜◡‾)੭ु⁾☃❆ > > > > BUG=557422 > > R=thestig@chromium.org > > > > Committed: https://crrev.com/92469c8c4b7da052273dee1a31308663d1dd1e3d > > Cr-Commit-Position: refs/heads/master@{#367251} > > TBR=thestig@chromium.org,dcheng@chromium.org > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=557422 > > Committed: https://crrev.com/f737edcf768bad1883164ac1c2270df670c7f6a9 > Cr-Commit-Position: refs/heads/master@{#367811} TBR=thestig@chromium.org,msramek@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=557422 Review URL: https://codereview.chromium.org/1562043002 Cr-Commit-Position: refs/heads/master@{#367820}
* Revert of Remove Pass() on Android. (patchset #1 id:1 of ↵msramek2016-01-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/1559603002/ ) Reason for revert: This breaks compilation, as there are still some callsites of Pass() left. See Android Cronet Data Reduction Proxy Builder build #961 and onwards: https://build.chromium.org/p/chromium.android/builders/Android%20Cronet%20Data%20Reduction%20Proxy%20Builder/builds/961/steps/compile/logs/stdio Original issue's description: > Remove Pass() on Android. > > Pass() is a legacy of the original C++03 move emulation implementation. > New code should use std::move from <utility>. > > ❆(੭ु ◜◡‾)੭ु⁾☃❆ > > BUG=557422 > R=thestig@chromium.org > > Committed: https://crrev.com/92469c8c4b7da052273dee1a31308663d1dd1e3d > Cr-Commit-Position: refs/heads/master@{#367251} TBR=thestig@chromium.org,dcheng@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=557422 Review URL: https://codereview.chromium.org/1564763002 Cr-Commit-Position: refs/heads/master@{#367811}
* Remove Pass() on Android.dcheng2015-12-311-1/+1
| | | | | | | | | | | | | | Pass() is a legacy of the original C++03 move emulation implementation. New code should use std::move from <utility>. ❆(੭ु ◜◡‾)੭ु⁾☃❆ BUG=557422 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1559603002 Cr-Commit-Position: refs/heads/master@{#367251}
* Remove Pass() on Linux.Daniel Cheng2015-12-301-0/+13
| | | | | | | | | | | | | | | Pass() is a legacy of the original C++03 move emulation implementation. New code should use std::move from <utility>. ChromeOS is exempt until the migration there is complete. ❆(੭ु ◜◡‾)੭ु⁾☃❆ BUG=557422 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1548273002 . Cr-Commit-Position: refs/heads/master@{#367177}
* Switch to standard integer types in base/.avi2015-12-261-0/+1
| | | | | | | | | | BUG=138542 TBR=mark@chromium.org NOPRESUBMIT=true Review URL: https://codereview.chromium.org/1538743002 Cr-Commit-Position: refs/heads/master@{#366910}
* Rename MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03danakj2015-12-081-40/+17
| | | | | | | | | | | | | | | | This renames the macro to be more standard and express its intent and relationship to DISALLOW_COPY_AND_ASSIGN. It renames the macro to DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND, as it does what the old DISALLOW_COPY_AND_ASSIGN does, but also whitelists the type for Bind/Callback to try move it. R=Nico TBR=sky BUG=561749 Review URL: https://codereview.chromium.org/1501793003 Cr-Commit-Position: refs/heads/master@{#363712}
* Remove the TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03 macro.danakj2015-12-041-5/+0
| | | | | | | | | | | | | This macro existed only to add a Pass() method on scoped_refptr and skia::RefPtr. We can just use std::move() now, so replace callsites to Pass() with std::move() and kill the macro. R=thakis@chromium.org BUG=557422 Review URL: https://codereview.chromium.org/1477643002 Cr-Commit-Position: refs/heads/master@{#363281}
* Remove old C++03 move emulation code.dcheng2015-12-011-184/+19
| | | | | | | | | | | Chrome allows the use of C++11 features now, so just use rvalue references directly. BUG=543901 Review URL: https://codereview.chromium.org/1407443002 Cr-Commit-Position: refs/heads/master@{#362394}
* styleguide: Allow std::move for move semantics.vmpstr2015-11-161-2/+4
| | | | | | | | R=danakj@chromium.org, thakis@chromium.org Review URL: https://codereview.chromium.org/1450013002 Cr-Commit-Position: refs/heads/master@{#359949}
* Move an include guard to guard all code in base/move.hbratell2015-04-141-2/+2
| | | | | | | | | | | | | | | | | | gcc -H warned about base/move.h missing an include guard and it was because the existing include guard didn't encompass all the code in the file. This fixes that warning and maybe makes compilations one nanosecond faster. The code outside the include guard was added Oct 2014 when fixing bug 418297. BUG=418297 Review URL: https://codereview.chromium.org/1082263002 Cr-Commit-Position: refs/heads/master@{#325132}
* Make deleted constructors take a const parameter in move-only type macro.mgraczyk2015-04-141-2/+2
| | | | | | Review URL: https://codereview.chromium.org/1061073004 Cr-Commit-Position: refs/heads/master@{#325107}
* Add move support for scoped_refptr.kkimlabs2015-04-131-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | scoped_ptr has - move constructor. - move assignment operator. - .Pass(). This CL adds the same support for scoped_refptr. The main benefit is reducing unnecessary reference counter updates. // Example 1 class Foo { // Without .Pass(), a copy constructor would be called, which // increments and decrements the reference counter unnecessarily. // With .Pass(), a move constructor is called which doesn't update // the reference counter Foo(scoped_refptr<T> t) : t_(t.Pass()) {} const scoped_refptr<T> t_; }; // Example 2 scoped_refptr<Foo> func() { return scoped_refptr<Foo>(new Foo()); } main() { scoped_refptr<Foo> foo; // The following would be done by a copy assignment operator before, // but now a move assignment operator will be used instead. foo = func(); } // Example 3 class Foo : public base::RefCountedThreadSafe<Foo> { ... } void func(scoped_refptr<Foo> foo) { ... } main() { scoped_refptr<Foo> foo(...); // Because it's moved, the reference counter won't be updated. massage_loop->PostTask(FROM_HERE, base::Bind(&func, base::Passed(foo))); } Review URL: https://codereview.chromium.org/1076953002 Cr-Commit-Position: refs/heads/master@{#324910}
* base: Make scoped_ptr::Pass() act like std::move().danakj2014-10-061-1/+12
| | | | | | | | | | | | | | | This brings scoped_ptr closer to unique_ptr without changing the API of scoped_ptr or exposing rvalue references outside of scoped_ptr yet. This also adds WARN_UNUSED_RESULT to scoped_ptr::Pass() as well as Pass() for other move-only-emulation types. R=jamesr BUG=418297 Review URL: https://codereview.chromium.org/617933004 Cr-Commit-Position: refs/heads/master@{#298292}
* Remove move-only-type whitelists in CallbackParamTraits and CallbackForward ↵kinuko@chromium.org2013-10-221-0/+11
| | | | | | | | | | | | | | by SFINAE So that all move-only types defined with MOVE_ONLY_TYPE_FOR_CPP03 automatically becomes Passable in bind and callbacks. BUG=none R=ajwong@chromium.org, awong Review URL: https://codereview.chromium.org/26848010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230080 0039d316-1c4b-4281-b951-d872f2087c98
* Small fixes around the codesergeygs@chromium.org2013-03-061-6/+6
| | | | | | | | | | | | | 1) Missing member initialization in constructor. 2) More explicit evaluation precedence in an expression. 3) Typos in comments. BUG= Review URL: https://chromiumcodereview.appspot.com/12316136 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186355 0039d316-1c4b-4281-b951-d872f2087c98
* Fix scoped_ptr<T[]> to disallow construction and reset from NULL.dcheng@chromium.org2013-02-021-1/+1
| | | | | | | | BUG=171118 Review URL: https://codereview.chromium.org/12041050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180253 0039d316-1c4b-4281-b951-d872f2087c98
* Fix move.h's to use a concrete RValue carrier object rather than hacking a ↵ajwong@chromium.org2012-10-151-34/+30
| | | | | | | | | | | | | | | | | | | | | | | | | RValue&. For move semantics, we need to create a private "RValue" type that is used to create move constructors and move operators. Previously, we emulated Boost's idea of making the RValue type a subclass of the move-only type that doesn't add any new member fields. We then just reinterpret_cast "this" into a RValue& depending on the fact that RValue is just a type pun for the move-only type. This ends up being undefined behavior though (C++98 5.2.10.7). This change makes use a concrete RValue class that contains a pointer to the move-only type. With -O2 on clang version 3.2 (trunk 163674), this yields identical assembly code to the previous implementation. With -O0, we generate 2 more instructions to allocate and initialize the temporary RValue struct's object field when calling Pass(). This should be acceptable. The snowman says so ☃. BUG=155436 Review URL: https://chromiumcodereview.appspot.com/11078014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161945 0039d316-1c4b-4281-b951-d872f2087c98
* Coverity: Fix a pass-by-value.jhawkins@chromium.org2012-03-061-2/+2
| | | | | | | | | | | | CID_COUNT=1 CID=103292 BUG=none TEST=none R=groby Review URL: https://chromiumcodereview.appspot.com/9380051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125070 0039d316-1c4b-4281-b951-d872f2087c98
* Transfer the C++03 move-only type emulation into base/move.h and also make ↵ajwong@chromium.org2012-01-201-0/+211
| | | | | | | | | | | | | | | | | ScopedVector move-only. Also: * Add a lot of documentation explaining what this macro does. * Change the implementation of RValue so it cannot be instantiated. The change to always use RValue& makes for more efficent code in debug builds. Looking at the disassembly for a simple use case (calling a function with one parameter), it removes the creation of one temporary. BUG=96118 TEST=new unittests. exist code still compiles. Review URL: https://chromiumcodereview.appspot.com/9207021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118388 0039d316-1c4b-4281-b951-d872f2087c98
* Erase base/move. The pattern we use is pass by const ref and this is ↵brettw@chromium.org2010-11-081-55/+0
| | | | | | | | | | confusing people. TEST=it compiles BUG=none Review URL: http://codereview.chromium.org/4682003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65444 0039d316-1c4b-4281-b951-d872f2087c98
* `#pragma once` for app, base, chrome, gfx, ipc, net, skia, viewsthakis@chromium.org2010-07-261-0/+1
| | | | | | | | | BUG=50273 TEST=everything still builds, build is 10% faster on windows, same speed on mac/linux TBR: erg git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53716 0039d316-1c4b-4281-b951-d872f2087c98
* Notification for battery with <= 15 minutes remaining.seanparent@google.com2010-03-191-0/+54
BUG=521 TEST=none Review URL: http://codereview.chromium.org/1079007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42153 0039d316-1c4b-4281-b951-d872f2087c98