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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 static void Run(CallbackHolder<void()>* holder) { | 71 static void Run(CallbackHolder<void()>* holder) { |
72 holder->task_runner()->PostTask(holder->from_here(), holder->callback()); | 72 holder->task_runner()->PostTask(holder->from_here(), holder->callback()); |
73 } | 73 } |
74 }; | 74 }; |
75 | 75 |
76 template <typename... Args> | 76 template <typename... Args> |
77 struct RelayToTaskRunnerHelper<void(Args...)> { | 77 struct RelayToTaskRunnerHelper<void(Args...)> { |
78 static void Run(CallbackHolder<void(Args...)>* holder, Args... args) { | 78 static void Run(CallbackHolder<void(Args...)>* holder, Args... args) { |
79 holder->task_runner()->PostTask( | 79 holder->task_runner()->PostTask( |
80 holder->from_here(), | 80 holder->from_here(), |
81 base::Bind(holder->callback(), RebindForward(args)...)); | 81 base::BindOnce(holder->callback(), RebindForward(args)...)); |
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) { |
(...skipping 13 matching lines...) Expand all Loading... |
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 |