| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_MOVE_H_ | 5 #ifndef BASE_MOVE_H_ |
| 6 #define BASE_MOVE_H_ | 6 #define BASE_MOVE_H_ |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // ownership of the type through a base::Callback without heap-allocating it | 24 // ownership of the type through a base::Callback without heap-allocating it |
| 25 // into a scoped_ptr. The class must define a move constructor and move | 25 // into a scoped_ptr. The class must define a move constructor and move |
| 26 // assignment operator to make this work. | 26 // assignment operator to make this work. |
| 27 // | 27 // |
| 28 // This version of the macro adds a Pass() function and a cryptic | 28 // This version of the macro adds a Pass() function and a cryptic |
| 29 // MoveOnlyTypeForCPP03 typedef for the base::Callback implementation to use. | 29 // MoveOnlyTypeForCPP03 typedef for the base::Callback implementation to use. |
| 30 // See IsMoveOnlyType template and its usage in base/callback_internal.h | 30 // See IsMoveOnlyType template and its usage in base/callback_internal.h |
| 31 // for more details. | 31 // for more details. |
| 32 // TODO(crbug.com/566182): Remove this macro and use DISALLOW_COPY_AND_ASSIGN | 32 // TODO(crbug.com/566182): Remove this macro and use DISALLOW_COPY_AND_ASSIGN |
| 33 // everywhere instead. | 33 // everywhere instead. |
| 34 #if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_MACOSX) | 34 #if defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_MACOSX) || \ |
| 35 defined(OS_WIN) |
| 35 #define DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND(type) \ | 36 #define DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND(type) \ |
| 36 private: \ | 37 private: \ |
| 37 type(const type&) = delete; \ | 38 type(const type&) = delete; \ |
| 38 void operator=(const type&) = delete; \ | 39 void operator=(const type&) = delete; \ |
| 39 \ | 40 \ |
| 40 public: \ | 41 public: \ |
| 41 typedef void MoveOnlyTypeForCPP03; \ | 42 typedef void MoveOnlyTypeForCPP03; \ |
| 42 \ | 43 \ |
| 43 private: | 44 private: |
| 44 #else | 45 #else |
| 45 #define DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND(type) \ | 46 #define DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND(type) \ |
| 46 private: \ | 47 private: \ |
| 47 type(const type&) = delete; \ | 48 type(const type&) = delete; \ |
| 48 void operator=(const type&) = delete; \ | 49 void operator=(const type&) = delete; \ |
| 49 \ | 50 \ |
| 50 public: \ | 51 public: \ |
| 51 type&& Pass() WARN_UNUSED_RESULT { return std::move(*this); } \ | 52 type&& Pass() WARN_UNUSED_RESULT { return std::move(*this); } \ |
| 52 typedef void MoveOnlyTypeForCPP03; \ | 53 typedef void MoveOnlyTypeForCPP03; \ |
| 53 \ | 54 \ |
| 54 private: | 55 private: |
| 55 #endif | 56 #endif |
| 56 | 57 |
| 57 #endif // BASE_MOVE_H_ | 58 #endif // BASE_MOVE_H_ |
| OLD | NEW |