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

Side by Side Diff: base/move.h

Issue 1548273002: Remove Pass() on Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert Android for now Created 4 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 unified diff | Download patch
« no previous file with comments | « base/memory/scoped_ptr_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "build/build_config.h"
12 13
13 // TODO(crbug.com/566182): DEPRECATED! 14 // TODO(crbug.com/566182): DEPRECATED!
14 // Use DISALLOW_COPY_AND_ASSIGN instead, or if your type will be used in 15 // Use DISALLOW_COPY_AND_ASSIGN instead, or if your type will be used in
15 // Callbacks, use DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND instead. 16 // Callbacks, use DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND instead.
16 #define MOVE_ONLY_TYPE_FOR_CPP_03(type) \ 17 #define MOVE_ONLY_TYPE_FOR_CPP_03(type) \
17 DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND(type) 18 DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND(type)
18 19
19 // A macro to disallow the copy constructor and copy assignment functions. 20 // A macro to disallow the copy constructor and copy assignment functions.
20 // This should be used in the private: declarations for a class. 21 // This should be used in the private: declarations for a class.
21 // 22 //
22 // Use this macro instead of DISALLOW_COPY_AND_ASSIGN if you want to pass 23 // Use this macro instead of DISALLOW_COPY_AND_ASSIGN if you want to pass
23 // 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
24 // 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
25 // assignment operator to make this work. 26 // assignment operator to make this work.
26 // 27 //
27 // 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
28 // MoveOnlyTypeForCPP03 typedef for the base::Callback implementation to use. 29 // MoveOnlyTypeForCPP03 typedef for the base::Callback implementation to use.
29 // See IsMoveOnlyType template and its usage in base/callback_internal.h 30 // See IsMoveOnlyType template and its usage in base/callback_internal.h
30 // for more details. 31 // for more details.
31 // 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
32 // everywhere instead. 33 // everywhere instead.
34 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
33 #define DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND(type) \ 35 #define DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND(type) \
34 private: \ 36 private: \
35 type(const type&) = delete; \ 37 type(const type&) = delete; \
38 void operator=(const type&) = delete; \
39 \
40 public: \
41 typedef void MoveOnlyTypeForCPP03; \
42 \
43 private:
44 #else
45 #define DISALLOW_COPY_AND_ASSIGN_WITH_MOVE_FOR_BIND(type) \
46 private: \
47 type(const type&) = delete; \
36 void operator=(const type&) = delete; \ 48 void operator=(const type&) = delete; \
37 \ 49 \
38 public: \ 50 public: \
39 type&& Pass() WARN_UNUSED_RESULT { return std::move(*this); } \ 51 type&& Pass() WARN_UNUSED_RESULT { return std::move(*this); } \
40 typedef void MoveOnlyTypeForCPP03; \ 52 typedef void MoveOnlyTypeForCPP03; \
41 \ 53 \
42 private: 54 private:
55 #endif
43 56
44 #endif // BASE_MOVE_H_ 57 #endif // BASE_MOVE_H_
OLDNEW
« no previous file with comments | « base/memory/scoped_ptr_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698