| 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 GOOGLE_APIS_DRIVE_TEST_UTIL_H_ | 5 #ifndef GOOGLE_APIS_DRIVE_TEST_UTIL_H_ |
| 6 #define GOOGLE_APIS_DRIVE_TEST_UTIL_H_ | 6 #define GOOGLE_APIS_DRIVE_TEST_UTIL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 template<typename T> struct InTypeHelper<false, T> { | 148 template<typename T> struct InTypeHelper<false, T> { |
| 149 typedef T InType; | 149 typedef T InType; |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 // Simulates the std::move function in C++11. We use pointer here for argument, | 152 // Simulates the std::move function in C++11. We use pointer here for argument, |
| 153 // instead of rvalue reference. | 153 // instead of rvalue reference. |
| 154 template<bool IsMovable, typename T> struct MoveHelper { | 154 template<bool IsMovable, typename T> struct MoveHelper { |
| 155 static const T& Move(const T* in) { return *in; } | 155 static const T& Move(const T* in) { return *in; } |
| 156 }; | 156 }; |
| 157 template<typename T> struct MoveHelper<true, T> { | 157 template<typename T> struct MoveHelper<true, T> { |
| 158 static T Move(T* in) { return in->Pass(); } | 158 static T Move(T* in) { return std::move(*in); } |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 // Helper to handle Chrome's move semantics correctly. | 161 // Helper to handle Chrome's move semantics correctly. |
| 162 template<typename T> | 162 template<typename T> |
| 163 struct CopyResultCallbackHelper | 163 struct CopyResultCallbackHelper |
| 164 // It is necessary to calculate the exact signature of callbacks we want | 164 // It is necessary to calculate the exact signature of callbacks we want |
| 165 // to create here. In our case, as we use value-parameters for primitive | 165 // to create here. In our case, as we use value-parameters for primitive |
| 166 // types and movable types in the callback declaration. | 166 // types and movable types in the callback declaration. |
| 167 // Thus the incoming type is as follows: | 167 // Thus the incoming type is as follows: |
| 168 // 1) If the argument type |T| is class type but doesn't movable, | 168 // 1) If the argument type |T| is class type but doesn't movable, |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 const GetContentCallback callback_; | 294 const GetContentCallback callback_; |
| 295 ScopedVector<std::string> data_; | 295 ScopedVector<std::string> data_; |
| 296 | 296 |
| 297 DISALLOW_COPY_AND_ASSIGN(TestGetContentCallback); | 297 DISALLOW_COPY_AND_ASSIGN(TestGetContentCallback); |
| 298 }; | 298 }; |
| 299 | 299 |
| 300 } // namespace test_util | 300 } // namespace test_util |
| 301 } // namespace google_apis | 301 } // namespace google_apis |
| 302 | 302 |
| 303 #endif // GOOGLE_APIS_DRIVE_TEST_UTIL_H_ | 303 #endif // GOOGLE_APIS_DRIVE_TEST_UTIL_H_ |
| OLD | NEW |