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

Unified Diff: remoting/base/typed_buffer.h

Issue 1407443002: Remove old C++03 move emulation code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: std::move and reflow Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/file_stream_context.cc ('k') | storage/browser/blob/scoped_file.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/base/typed_buffer.h
diff --git a/remoting/base/typed_buffer.h b/remoting/base/typed_buffer.h
index c80f7200fc3b7ff8a3d7e2df0e84b3e3f0ef40b5..fd46646bad110f4509224d8e04841385acd16314 100644
--- a/remoting/base/typed_buffer.h
+++ b/remoting/base/typed_buffer.h
@@ -10,6 +10,7 @@
#include <algorithm>
#include "base/basictypes.h"
+#include "base/logging.h"
#include "base/move.h"
namespace remoting {
@@ -20,11 +21,10 @@ namespace remoting {
// move-only semantics and typed buffer getters.
template <typename T>
class TypedBuffer {
- MOVE_ONLY_TYPE_FOR_CPP_03(TypedBuffer, RValue)
+ MOVE_ONLY_TYPE_FOR_CPP_03(TypedBuffer)
public:
- TypedBuffer() : buffer_(NULL), length_(0) {
- }
+ TypedBuffer() : TypedBuffer(0) {}
// Creates an instance of the object allocating a buffer of the given size.
explicit TypedBuffer(uint32 length) : buffer_(NULL), length_(length) {
@@ -32,12 +32,7 @@ class TypedBuffer {
buffer_ = reinterpret_cast<T*>(new uint8[length_]);
}
- // Move constructor for C++03 move emulation of this type.
- TypedBuffer(RValue rvalue) : buffer_(NULL), length_(0) {
- TypedBuffer temp;
- temp.Swap(*rvalue.object);
- Swap(temp);
- }
+ TypedBuffer(TypedBuffer&& rvalue) : TypedBuffer() { Swap(rvalue); }
~TypedBuffer() {
if (buffer_) {
@@ -46,11 +41,8 @@ class TypedBuffer {
}
}
- // Move operator= for C++03 move emulation of this type.
- TypedBuffer& operator=(RValue rvalue) {
- TypedBuffer temp;
- temp.Swap(*rvalue.object);
- Swap(temp);
+ TypedBuffer& operator=(TypedBuffer&& rvalue) {
+ Swap(rvalue);
return *this;
}
« no previous file with comments | « net/base/file_stream_context.cc ('k') | storage/browser/blob/scoped_file.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698