| OLD | NEW |
| 1 // This file was GENERATED by command: | 1 // This file was GENERATED by command: |
| 2 // pump.py callback_helper.h.pump | 2 // pump.py callback_helper.h.pump |
| 3 // DO NOT EDIT BY HAND!!! | 3 // DO NOT EDIT BY HAND!!! |
| 4 | 4 |
| 5 | 5 |
| 6 // Copyright 2014 The Chromium Authors. All rights reserved. | 6 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 7 // Use of this source code is governed by a BSD-style license that can be | 7 // Use of this source code is governed by a BSD-style license that can be |
| 8 // found in the LICENSE file. | 8 // found in the LICENSE file. |
| 9 | 9 |
| 10 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_HELPER_H_ | 10 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_HELPER_H_ |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 typename base::enable_if< | 35 typename base::enable_if< |
| 36 !base::internal::IsMoveOnlyType<T>::value, | 36 !base::internal::IsMoveOnlyType<T>::value, |
| 37 T&>::type | 37 T&>::type |
| 38 RebindForward(T& t) { | 38 RebindForward(T& t) { |
| 39 return t; | 39 return t; |
| 40 } | 40 } |
| 41 | 41 |
| 42 template <typename T> | 42 template <typename T> |
| 43 class CallbackHolder { | 43 class CallbackHolder { |
| 44 public: | 44 public: |
| 45 CallbackHolder(base::SequencedTaskRunner* task_runner, | 45 CallbackHolder(const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
| 46 const tracked_objects::Location& from_here, | 46 const tracked_objects::Location& from_here, |
| 47 const base::Callback<T>& callback) | 47 const base::Callback<T>& callback) |
| 48 : task_runner_(task_runner), | 48 : task_runner_(task_runner), |
| 49 from_here_(from_here), | 49 from_here_(from_here), |
| 50 callback_(new base::Callback<T>(callback)) { | 50 callback_(new base::Callback<T>(callback)) { |
| 51 DCHECK(task_runner_.get()); | 51 DCHECK(task_runner_.get()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 ~CallbackHolder() { | 54 ~CallbackHolder() { |
| 55 base::Callback<T>* callback = callback_.release(); | 55 base::Callback<T>* callback = callback_.release(); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 holder->from_here(), base::Bind(holder->callback(), RebindForward(a1), | 149 holder->from_here(), base::Bind(holder->callback(), RebindForward(a1), |
| 150 RebindForward(a2), RebindForward(a3), RebindForward(a4), | 150 RebindForward(a2), RebindForward(a3), RebindForward(a4), |
| 151 RebindForward(a5), RebindForward(a6), RebindForward(a7))); | 151 RebindForward(a5), RebindForward(a6), RebindForward(a7))); |
| 152 } | 152 } |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 } // namespace internal | 155 } // namespace internal |
| 156 | 156 |
| 157 template <typename T> | 157 template <typename T> |
| 158 base::Callback<T> RelayCallbackToTaskRunner( | 158 base::Callback<T> RelayCallbackToTaskRunner( |
| 159 base::SequencedTaskRunner* task_runner, | 159 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
| 160 const tracked_objects::Location& from_here, | 160 const tracked_objects::Location& from_here, |
| 161 const base::Callback<T>& callback) { | 161 const base::Callback<T>& callback) { |
| 162 DCHECK(task_runner->RunsTasksOnCurrentThread()); | 162 DCHECK(task_runner->RunsTasksOnCurrentThread()); |
| 163 | 163 |
| 164 if (callback.is_null()) | 164 if (callback.is_null()) |
| 165 return base::Callback<T>(); | 165 return base::Callback<T>(); |
| 166 | 166 |
| 167 return base::Bind(&internal::RelayToTaskRunnerHelper<T>::Run, | 167 return base::Bind(&internal::RelayToTaskRunnerHelper<T>::Run, |
| 168 base::Owned(new internal::CallbackHolder<T>( | 168 base::Owned(new internal::CallbackHolder<T>( |
| 169 task_runner, from_here, callback))); | 169 task_runner, from_here, callback))); |
| 170 } | 170 } |
| 171 | 171 |
| 172 template <typename T> | 172 template <typename T> |
| 173 base::Callback<T> RelayCallbackToCurrentThread( | 173 base::Callback<T> RelayCallbackToCurrentThread( |
| 174 const tracked_objects::Location& from_here, | 174 const tracked_objects::Location& from_here, |
| 175 const base::Callback<T>& callback) { | 175 const base::Callback<T>& callback) { |
| 176 return RelayCallbackToTaskRunner( | 176 return RelayCallbackToTaskRunner( |
| 177 base::ThreadTaskRunnerHandle::Get(), | 177 base::ThreadTaskRunnerHandle::Get(), |
| 178 from_here, callback); | 178 from_here, callback); |
| 179 } | 179 } |
| 180 | 180 |
| 181 } // namespace drive_backend | 181 } // namespace drive_backend |
| 182 } // namespace sync_file_system | 182 } // namespace sync_file_system |
| 183 | 183 |
| 184 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_HELPER_H_ | 184 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_HELPER_H_ |
| OLD | NEW |