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

Side by Side Diff: mojo/public/cpp/bindings/tests/container_test_util.h

Issue 2047633002: Revert of Remove base/move.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « mojo/public/cpp/bindings/struct_ptr.h ('k') | mojo/public/cpp/bindings/wtf_array.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 MOJO_PUBLIC_CPP_BINDINGS_TESTS_CONTAINER_TEST_UTIL_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_TESTS_CONTAINER_TEST_UTIL_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_TESTS_CONTAINER_TEST_UTIL_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_TESTS_CONTAINER_TEST_UTIL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/macros.h" 10 #include "base/move.h"
11 11
12 namespace mojo { 12 namespace mojo {
13 13
14 class CopyableType { 14 class CopyableType {
15 public: 15 public:
16 CopyableType(); 16 CopyableType();
17 CopyableType(const CopyableType& other); 17 CopyableType(const CopyableType& other);
18 CopyableType& operator=(const CopyableType& other); 18 CopyableType& operator=(const CopyableType& other);
19 ~CopyableType(); 19 ~CopyableType();
20 20
21 bool copied() const { return copied_; } 21 bool copied() const { return copied_; }
22 static size_t num_instances() { return num_instances_; } 22 static size_t num_instances() { return num_instances_; }
23 CopyableType* ptr() const { return ptr_; } 23 CopyableType* ptr() const { return ptr_; }
24 void ResetCopied() { copied_ = false; } 24 void ResetCopied() { copied_ = false; }
25 25
26 private: 26 private:
27 bool copied_; 27 bool copied_;
28 static size_t num_instances_; 28 static size_t num_instances_;
29 CopyableType* ptr_; 29 CopyableType* ptr_;
30 }; 30 };
31 31
32 class MoveOnlyType { 32 class MoveOnlyType {
33 MOVE_ONLY_TYPE_FOR_CPP_03(MoveOnlyType);
33 public: 34 public:
34 typedef MoveOnlyType Data_; 35 typedef MoveOnlyType Data_;
35 MoveOnlyType(); 36 MoveOnlyType();
36 MoveOnlyType(MoveOnlyType&& other); 37 MoveOnlyType(MoveOnlyType&& other);
37 MoveOnlyType& operator=(MoveOnlyType&& other); 38 MoveOnlyType& operator=(MoveOnlyType&& other);
38 ~MoveOnlyType(); 39 ~MoveOnlyType();
39 40
40 bool moved() const { return moved_; } 41 bool moved() const { return moved_; }
41 static size_t num_instances() { return num_instances_; } 42 static size_t num_instances() { return num_instances_; }
42 MoveOnlyType* ptr() const { return ptr_; } 43 MoveOnlyType* ptr() const { return ptr_; }
43 void ResetMoved() { moved_ = false; } 44 void ResetMoved() { moved_ = false; }
44 45
45 private: 46 private:
46 bool moved_; 47 bool moved_;
47 static size_t num_instances_; 48 static size_t num_instances_;
48 MoveOnlyType* ptr_; 49 MoveOnlyType* ptr_;
49
50 DISALLOW_COPY_AND_ASSIGN(MoveOnlyType);
51 }; 50 };
52 51
53 } // namespace mojo 52 } // namespace mojo
54 53
55 #endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_CONTAINER_TEST_UTIL_H_ 54 #endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_CONTAINER_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/struct_ptr.h ('k') | mojo/public/cpp/bindings/wtf_array.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698