There's no reason not to use std::move instead now that we can use the
C++11 standard library.
BUG=webrtc:5373
Review URL: https://codereview.webrtc.org/1531013003
Cr-Commit-Position: refs/heads/master@{#11225}
We can now use std::move instead!
This CL leaves the Pass methods in place; a follow-up CL will add deprecation annotations to them.
Review URL: https://codereview.webrtc.org/1460043002
Cr-Commit-Position: refs/heads/master@{#11064}
We must remove dependency on Chromium, i.e. we can't use Chromium's base/logging.h. That means we need to define these macros in WebRTC also when doing Chromium builds. And this causes redefinition.
* DISALLOW_ASSIGN -> RTC_DISALLOW_ASSIGN
* DISALLOW_COPY_AND_ASSIGN -> RTC_DISALLOW_COPY_AND_ASSIGN
* DISALLOW_IMPLICIT_CONSTRUCTORS -> RTC_DISALLOW_IMPLICIT_CONSTRUCTORS
Related CL: https://codereview.webrtc.org/1335923002/
BUG=chromium:468375
NOTRY=true
Review URL: https://codereview.webrtc.org/1345433002
Cr-Commit-Position: refs/heads/master@{#9953}
In days of yore, move.h contained complicated macros for approximating
move-only behavior in C++03. But since we live in the future now, and
can rely on C++11 features---including real move semantics!---it makes
more sense to just write the handful of required lines by hand in each
move-only class.
(We only live in the near future, though, not in some sci-fi
intergalactic civilization singularity type future, so we have to
define Pass() methods for these classes since we're not allowed to use
std::move().)
R=tommi@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/45099004
Cr-Commit-Position: refs/heads/master@{#9060}
1. Constructors, SetData(), and AppendData() now accept uint8_t*,
int8_t*, and char*. Previously, they accepted void*, meaning that
any kind of pointer was accepted. I think requiring an explicit
cast in cases where the input array isn't already of a byte-sized
type is a better compromise between convenience and safety.
2. data() can now return a uint8_t* instead of a char*, which seems
more appropriate for a byte array, and is harder to mix up with
zero-terminated C strings. data<int8_t>() is also available so
that callers that want that type instead won't have to cast, as
is data<char>() (which remains the default until all existing
callers have been fixed).
3. Constructors, SetData(), and AppendData() now accept arrays
natively, not just decayed to pointers. The advantage of this is
that callers don't have to pass the size separately.
4. There are new constructors that allow setting size and capacity
without initializing the array. Previously, this had to be done
separately after construction.
5. Instead of TransferTo(), Buffer now supports swap(), and move
construction and assignment, and has a Pass() method that works
just like std::move(). (The Pass method is modeled after
scoped_ptr::Pass().)
R=jmarusic@webrtc.org, tommi@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/42989004
Cr-Commit-Position: refs/heads/master@{#9033}
The latter file was more up-to-date. The files are now identical
with the following exceptions:
* The namespace used (rtc vs. webrtc).
* The name of the include guard.
* base/scoped_ptr.h still has two extra methods, accept() and use().
* base/scoped_ptr.h still includes webrtc/base/common.h even though
it doesn't need it itself, since several .cc files expect to get
it for free by incuding base/scoped_ptr.h. This is of course bad
manners, and the "unused" include will be removed in a future CL.
A later CL will remove system_wrappers/interface/scoped_ptr.h.
R=andrew@webrtc.org
Committed: https://code.google.com/p/webrtc/source/detail?r=8147
And reverted again, because out-of-tree code using this file was defining nullptr to 0: https://code.google.com/p/webrtc/source/detail?r=8149
Review URL: https://webrtc-codereview.appspot.com/36919004
Cr-Commit-Position: refs/heads/master@{#8196}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8196 4adac7df-926f-26a2-2b94-8c16560cd09d
The latter file was more up-to-date. The files are now identical
with the following exceptions:
* The namespace used (rtc vs. webrtc).
* The name of the include guard.
* base/scoped_ptr.h still has two extra methods, accept() and use().
* base/scoped_ptr.h still includes webrtc/base/common.h even though
it doesn't need it itself, since several .cc files expect to get
it for free by incuding base/scoped_ptr.h. This is of course bad
manners, and the "unused" include will be removed in a future CL.
A later CL will remove system_wrappers/interface/scoped_ptr.h.
R=andrew@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/36919004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8147 4adac7df-926f-26a2-2b94-8c16560cd09d