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

Side by Side Diff: google_apis/drive/test_util.h

Issue 1547233002: Convert Pass()→std::move() in //google_apis (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 | « google_apis/drive/request_util.cc ('k') | google_apis/drive/test_util.cc » ('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 (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
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
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_
OLDNEW
« no previous file with comments | « google_apis/drive/request_util.cc ('k') | google_apis/drive/test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698