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

Unified Diff: mojo/public/cpp/system/tests/macros_unittest.cc

Issue 828373008: Allow constructing {Interface,Struct}Ptr from nullptr (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months 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
Index: mojo/public/cpp/system/tests/macros_unittest.cc
diff --git a/mojo/public/cpp/system/tests/macros_unittest.cc b/mojo/public/cpp/system/tests/macros_unittest.cc
index 89dd76435c94729808dab3485f62452c78cc039b..27a61bdcb5a584728515aa50743e4cb1502ad606 100644
--- a/mojo/public/cpp/system/tests/macros_unittest.cc
+++ b/mojo/public/cpp/system/tests/macros_unittest.cc
@@ -76,7 +76,7 @@ TEST(MacrosCppTest, ArraySize) {
// Note: MSVS is very strict (and arguably buggy) about warnings for classes
// defined in a local scope, so define these globally.
class MoveOnlyInt {
- MOJO_MOVE_ONLY_TYPE_FOR_CPP_03(MoveOnlyInt, RValue)
+ MOJO_MOVE_ONLY_TYPE(MoveOnlyInt)
public:
MoveOnlyInt() : is_set_(false), value_() {}
@@ -84,12 +84,12 @@ class MoveOnlyInt {
~MoveOnlyInt() {}
// Move-only constructor and operator=.
- MoveOnlyInt(RValue other) { *this = other; }
- MoveOnlyInt& operator=(RValue other) {
- if (other.object != this) {
- is_set_ = other.object->is_set_;
- value_ = other.object->value_;
- other.object->is_set_ = false;
+ MoveOnlyInt(MoveOnlyInt&& other) { *this = other.Pass(); }
+ MoveOnlyInt& operator=(MoveOnlyInt&& other) {
+ if (&other != this) {
+ is_set_ = other.is_set_;
+ value_ = other.value_;
+ other.is_set_ = false;
}
return *this;
}
« mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc ('K') | « mojo/public/cpp/system/macros.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698