diff options
author | dcheng <dcheng@chromium.org> | 2015-12-01 04:09:52 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-01 12:10:42 +0000 |
commit | e1b0277c20198c31b8782f567634552243182d08 (patch) | |
tree | 75fde33e5410051ddff4de64bbdd9766d294ef25 /base/files | |
parent | 7f54a6c611e793e47712cd4a988a46b5fbbdfd07 (diff) | |
download | chromium_src-e1b0277c20198c31b8782f567634552243182d08.zip chromium_src-e1b0277c20198c31b8782f567634552243182d08.tar.gz chromium_src-e1b0277c20198c31b8782f567634552243182d08.tar.bz2 |
Remove old C++03 move emulation code.
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}
Diffstat (limited to 'base/files')
-rw-r--r-- | base/files/file.cc | 30 | ||||
-rw-r--r-- | base/files/file.h | 8 |
2 files changed, 17 insertions, 21 deletions
diff --git a/base/files/file.cc b/base/files/file.cc index 47b9f88..036d43b 100644 --- a/base/files/file.cc +++ b/base/files/file.cc @@ -50,13 +50,12 @@ File::File(Error error_details) async_(false) { } -File::File(RValue other) - : file_(other.object->TakePlatformFile()), - tracing_path_(other.object->tracing_path_), - error_details_(other.object->error_details()), - created_(other.object->created()), - async_(other.object->async_) { -} +File::File(File&& other) + : file_(other.TakePlatformFile()), + tracing_path_(other.tracing_path_), + error_details_(other.error_details()), + created_(other.created()), + async_(other.async_) {} File::~File() { // Go through the AssertIOAllowed logic. @@ -72,15 +71,14 @@ File File::CreateForAsyncHandle(PlatformFile platform_file) { return file.Pass(); } -File& File::operator=(RValue other) { - if (this != other.object) { - Close(); - SetPlatformFile(other.object->TakePlatformFile()); - tracing_path_ = other.object->tracing_path_; - error_details_ = other.object->error_details(); - created_ = other.object->created(); - async_ = other.object->async_; - } +File& File::operator=(File&& other) { + DCHECK_NE(this, &other); + Close(); + SetPlatformFile(other.TakePlatformFile()); + tracing_path_ = other.tracing_path_; + error_details_ = other.error_details(); + created_ = other.created(); + async_ = other.async_; return *this; } diff --git a/base/files/file.h b/base/files/file.h index 66b78fa..ba4dd34 100644 --- a/base/files/file.h +++ b/base/files/file.h @@ -53,7 +53,7 @@ typedef struct stat64 stat_wrapper_t; // to the OS is not considered const, even if there is no apparent change to // member variables. class BASE_EXPORT File { - MOVE_ONLY_TYPE_FOR_CPP_03(File, RValue) + MOVE_ONLY_TYPE_FOR_CPP_03(File) public: // FLAG_(OPEN|CREATE).* are mutually exclusive. You should specify exactly one @@ -169,16 +169,14 @@ class BASE_EXPORT File { // Creates an object with a specific error_details code. explicit File(Error error_details); - // Move constructor for C++03 move emulation of this type. - File(RValue other); + File(File&& other); ~File(); // Takes ownership of |platform_file|. static File CreateForAsyncHandle(PlatformFile platform_file); - // Move operator= for C++03 move emulation of this type. - File& operator=(RValue other); + File& operator=(File&& other); // Creates or opens the given file. void Initialize(const FilePath& path, uint32 flags); |