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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/callback_helper.h

Issue 609153002: [SyncFS] Use variadic template in callback_helper.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scoped_ptr
Patch Set: Created 6 years, 2 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 | « no previous file | chrome/browser/sync_file_system/drive_backend/callback_helper.h.pump » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // This file was GENERATED by command:
2 // pump.py callback_helper.h.pump
3 // DO NOT EDIT BY HAND!!!
4
5
6 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
7 // 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
8 // found in the LICENSE file. 3 // found in the LICENSE file.
9 4
10 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_HELPER_H_ 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_HELPER_H_
11 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_HELPER_H_ 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_HELPER_H_
12 7
13 #include "base/bind.h" 8 #include "base/bind.h"
14 #include "base/location.h" 9 #include "base/location.h"
15 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 scoped_refptr<base::SequencedTaskRunner> task_runner_; 60 scoped_refptr<base::SequencedTaskRunner> task_runner_;
66 const tracked_objects::Location from_here_; 61 const tracked_objects::Location from_here_;
67 scoped_ptr<base::Callback<T> > callback_; 62 scoped_ptr<base::Callback<T> > callback_;
68 63
69 DISALLOW_COPY_AND_ASSIGN(CallbackHolder); 64 DISALLOW_COPY_AND_ASSIGN(CallbackHolder);
70 }; 65 };
71 66
72 template <typename> 67 template <typename>
73 struct RelayToTaskRunnerHelper; 68 struct RelayToTaskRunnerHelper;
74 69
75 template <> 70 template <typename... Args>
76 struct RelayToTaskRunnerHelper<void()> { 71 struct RelayToTaskRunnerHelper<void(Args...)> {
77 static void Run(CallbackHolder<void()>* holder) { 72 static void Run(CallbackHolder<void(Args...)>* holder, Args... args) {
78 holder->task_runner()->PostTask( 73 holder->task_runner()->PostTask(
79 holder->from_here(), base::Bind(holder->callback())); 74 holder->from_here(),
75 base::Bind(holder->callback(),
76 RebindForward(args)...));
80 } 77 }
81 }; 78 };
82 79
83 template <typename A1>
84 struct RelayToTaskRunnerHelper<void(A1)> {
85 static void Run(CallbackHolder<void(A1)>* holder, A1 a1) {
86 holder->task_runner()->PostTask(
87 holder->from_here(), base::Bind(holder->callback(), RebindForward(a1)));
88 }
89 };
90
91 template <typename A1, typename A2>
92 struct RelayToTaskRunnerHelper<void(A1, A2)> {
93 static void Run(CallbackHolder<void(A1, A2)>* holder, A1 a1, A2 a2) {
94 holder->task_runner()->PostTask(
95 holder->from_here(), base::Bind(holder->callback(), RebindForward(a1),
96 RebindForward(a2)));
97 }
98 };
99
100 template <typename A1, typename A2, typename A3>
101 struct RelayToTaskRunnerHelper<void(A1, A2, A3)> {
102 static void Run(CallbackHolder<void(A1, A2, A3)>* holder, A1 a1, A2 a2,
103 A3 a3) {
104 holder->task_runner()->PostTask(
105 holder->from_here(), base::Bind(holder->callback(), RebindForward(a1),
106 RebindForward(a2), RebindForward(a3)));
107 }
108 };
109
110 template <typename A1, typename A2, typename A3, typename A4>
111 struct RelayToTaskRunnerHelper<void(A1, A2, A3, A4)> {
112 static void Run(CallbackHolder<void(A1, A2, A3, A4)>* holder, A1 a1, A2 a2,
113 A3 a3, A4 a4) {
114 holder->task_runner()->PostTask(
115 holder->from_here(), base::Bind(holder->callback(), RebindForward(a1),
116 RebindForward(a2), RebindForward(a3), RebindForward(a4)));
117 }
118 };
119
120 template <typename A1, typename A2, typename A3, typename A4, typename A5>
121 struct RelayToTaskRunnerHelper<void(A1, A2, A3, A4, A5)> {
122 static void Run(CallbackHolder<void(A1, A2, A3, A4, A5)>* holder, A1 a1,
123 A2 a2, A3 a3, A4 a4, A5 a5) {
124 holder->task_runner()->PostTask(
125 holder->from_here(), base::Bind(holder->callback(), RebindForward(a1),
126 RebindForward(a2), RebindForward(a3), RebindForward(a4),
127 RebindForward(a5)));
128 }
129 };
130
131 template <typename A1, typename A2, typename A3, typename A4, typename A5,
132 typename A6>
133 struct RelayToTaskRunnerHelper<void(A1, A2, A3, A4, A5, A6)> {
134 static void Run(CallbackHolder<void(A1, A2, A3, A4, A5, A6)>* holder, A1 a1,
135 A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) {
136 holder->task_runner()->PostTask(
137 holder->from_here(), base::Bind(holder->callback(), RebindForward(a1),
138 RebindForward(a2), RebindForward(a3), RebindForward(a4),
139 RebindForward(a5), RebindForward(a6)));
140 }
141 };
142
143 template <typename A1, typename A2, typename A3, typename A4, typename A5,
144 typename A6, typename A7>
145 struct RelayToTaskRunnerHelper<void(A1, A2, A3, A4, A5, A6, A7)> {
146 static void Run(CallbackHolder<void(A1, A2, A3, A4, A5, A6, A7)>* holder,
147 A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) {
148 holder->task_runner()->PostTask(
149 holder->from_here(), base::Bind(holder->callback(), RebindForward(a1),
150 RebindForward(a2), RebindForward(a3), RebindForward(a4),
151 RebindForward(a5), RebindForward(a6), RebindForward(a7)));
152 }
153 };
154
155 } // namespace internal 80 } // namespace internal
156 81
157 template <typename T> 82 template <typename T>
158 base::Callback<T> RelayCallbackToTaskRunner( 83 base::Callback<T> RelayCallbackToTaskRunner(
159 const scoped_refptr<base::SequencedTaskRunner>& task_runner, 84 const scoped_refptr<base::SequencedTaskRunner>& task_runner,
160 const tracked_objects::Location& from_here, 85 const tracked_objects::Location& from_here,
161 const base::Callback<T>& callback) { 86 const base::Callback<T>& callback) {
162 DCHECK(task_runner->RunsTasksOnCurrentThread()); 87 DCHECK(task_runner->RunsTasksOnCurrentThread());
163 88
164 if (callback.is_null()) 89 if (callback.is_null())
(...skipping 10 matching lines...) Expand all
175 const base::Callback<T>& callback) { 100 const base::Callback<T>& callback) {
176 return RelayCallbackToTaskRunner( 101 return RelayCallbackToTaskRunner(
177 base::ThreadTaskRunnerHandle::Get(), 102 base::ThreadTaskRunnerHandle::Get(),
178 from_here, callback); 103 from_here, callback);
179 } 104 }
180 105
181 } // namespace drive_backend 106 } // namespace drive_backend
182 } // namespace sync_file_system 107 } // namespace sync_file_system
183 108
184 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_HELPER_H_ 109 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_CALLBACK_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/drive_backend/callback_helper.h.pump » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698