| OLD | NEW | 
|---|
| 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 CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_HELPER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_HELPER_H_ | 
| 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_HELPER_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_HELPER_H_ | 
| 7 | 7 | 
| 8 #include <memory> | 8 #include <memory> | 
| 9 #include <type_traits> | 9 #include <type_traits> | 
| 10 | 10 | 
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 82   } | 82   } | 
| 83 }; | 83 }; | 
| 84 | 84 | 
| 85 }  // namespace internal | 85 }  // namespace internal | 
| 86 | 86 | 
| 87 template <typename T> | 87 template <typename T> | 
| 88 base::Callback<T> RelayCallbackToTaskRunner( | 88 base::Callback<T> RelayCallbackToTaskRunner( | 
| 89     const scoped_refptr<base::SequencedTaskRunner>& task_runner, | 89     const scoped_refptr<base::SequencedTaskRunner>& task_runner, | 
| 90     const tracked_objects::Location& from_here, | 90     const tracked_objects::Location& from_here, | 
| 91     const base::Callback<T>& callback) { | 91     const base::Callback<T>& callback) { | 
| 92   DCHECK(task_runner->RunsTasksOnCurrentThread()); | 92   DCHECK(task_runner->RunsTasksInCurrentSequence()); | 
| 93 | 93 | 
| 94   if (callback.is_null()) | 94   if (callback.is_null()) | 
| 95     return base::Callback<T>(); | 95     return base::Callback<T>(); | 
| 96 | 96 | 
| 97   return base::Bind(&internal::RelayToTaskRunnerHelper<T>::Run, | 97   return base::Bind(&internal::RelayToTaskRunnerHelper<T>::Run, | 
| 98                     base::Owned(new internal::CallbackHolder<T>( | 98                     base::Owned(new internal::CallbackHolder<T>( | 
| 99                         task_runner, from_here, callback))); | 99                         task_runner, from_here, callback))); | 
| 100 } | 100 } | 
| 101 | 101 | 
| 102 template <typename T> | 102 template <typename T> | 
| 103 base::Callback<T> RelayCallbackToCurrentThread( | 103 base::Callback<T> RelayCallbackToCurrentThread( | 
| 104     const tracked_objects::Location& from_here, | 104     const tracked_objects::Location& from_here, | 
| 105     const base::Callback<T>& callback) { | 105     const base::Callback<T>& callback) { | 
| 106   return RelayCallbackToTaskRunner( | 106   return RelayCallbackToTaskRunner( | 
| 107       base::ThreadTaskRunnerHandle::Get(), | 107       base::ThreadTaskRunnerHandle::Get(), | 
| 108       from_here, callback); | 108       from_here, callback); | 
| 109 } | 109 } | 
| 110 | 110 | 
| 111 }  // namespace drive_backend | 111 }  // namespace drive_backend | 
| 112 }  // namespace sync_file_system | 112 }  // namespace sync_file_system | 
| 113 | 113 | 
| 114 #endif  // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_HELPER_H_ | 114 #endif  // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_HELPER_H_ | 
| OLD | NEW | 
|---|