• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2009-2010 Google Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  *     * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *     * Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following disclaimer
12  * in the documentation and/or other materials provided with the
13  * distribution.
14  *     * Neither the name of Google Inc. nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef CrossThreadTask_h
32 #define CrossThreadTask_h
33 
34 #include "core/dom/ExecutionContext.h"
35 #include "core/dom/ExecutionContextTask.h"
36 #include "platform/CrossThreadCopier.h"
37 #include "wtf/PassOwnPtr.h"
38 #include "wtf/PassRefPtr.h"
39 #include "wtf/TypeTraits.h"
40 
41 namespace WebCore {
42 
43 // Traits for the CrossThreadTask.
44 template<typename T> struct CrossThreadTaskTraits {
45     typedef const T& ParamType;
46 };
47 
48 template<typename T> struct CrossThreadTaskTraits<T*> {
49     typedef T* ParamType;
50 };
51 
52 template<typename T> struct CrossThreadTaskTraits<PassRefPtr<T> > {
53     typedef PassRefPtr<T> ParamType;
54 };
55 
56 template<typename T> struct CrossThreadTaskTraits<PassOwnPtr<T> > {
57     typedef PassOwnPtr<T> ParamType;
58 };
59 
60 // FIXME: Oilpan: Using a RawPtr is not safe.
61 // We need to move ExecutionContextTask to the heap and make this a Member.
62 template<typename T> struct CrossThreadTaskTraits<RawPtr<T> > {
63     typedef RawPtr<T> ParamType;
64 };
65 
66 template<typename P1, typename MP1>
67 class GC_PLUGIN_IGNORE("crbug.com/378192") CrossThreadTask1 : public ExecutionContextTask {
68 public:
69     typedef void (*Method)(ExecutionContext*, MP1);
70     typedef CrossThreadTask1<P1, MP1> CrossThreadTask;
71     typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
72 
73     static PassOwnPtr<CrossThreadTask> create(Method method, Param1 parameter1)
74     {
75         return adoptPtr(new CrossThreadTask(method, parameter1));
76     }
77 
78 private:
79     CrossThreadTask1(Method method, Param1 parameter1)
80         : m_method(method)
81         , m_parameter1(parameter1)
82     {
83     }
84 
85     virtual void performTask(ExecutionContext* context)
86     {
87         (*m_method)(context, m_parameter1);
88     }
89 
90 private:
91     Method m_method;
92     P1 m_parameter1;
93 };
94 
95 template<typename P1, typename MP1, typename P2, typename MP2>
96 class GC_PLUGIN_IGNORE("crbug.com/378192") CrossThreadTask2 : public ExecutionContextTask {
97 public:
98     typedef void (*Method)(ExecutionContext*, MP1, MP2);
99     typedef CrossThreadTask2<P1, MP1, P2, MP2> CrossThreadTask;
100     typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
101     typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
102 
103     static PassOwnPtr<CrossThreadTask> create(Method method, Param1 parameter1, Param2 parameter2)
104     {
105         return adoptPtr(new CrossThreadTask(method, parameter1, parameter2));
106     }
107 
108 private:
109     CrossThreadTask2(Method method, Param1 parameter1, Param2 parameter2)
110         : m_method(method)
111         , m_parameter1(parameter1)
112         , m_parameter2(parameter2)
113     {
114     }
115 
116     virtual void performTask(ExecutionContext* context)
117     {
118         (*m_method)(context, m_parameter1, m_parameter2);
119     }
120 
121 private:
122     Method m_method;
123     P1 m_parameter1;
124     P2 m_parameter2;
125 };
126 
127 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
128 class GC_PLUGIN_IGNORE("crbug.com/378192") CrossThreadTask3 : public ExecutionContextTask {
129 public:
130     typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3);
131     typedef CrossThreadTask3<P1, MP1, P2, MP2, P3, MP3> CrossThreadTask;
132     typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
133     typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
134     typedef typename CrossThreadTaskTraits<P3>::ParamType Param3;
135 
136     static PassOwnPtr<CrossThreadTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3)
137     {
138         return adoptPtr(new CrossThreadTask(method, parameter1, parameter2, parameter3));
139     }
140 
141 private:
142     CrossThreadTask3(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3)
143         : m_method(method)
144         , m_parameter1(parameter1)
145         , m_parameter2(parameter2)
146         , m_parameter3(parameter3)
147     {
148     }
149 
150     virtual void performTask(ExecutionContext* context)
151     {
152         (*m_method)(context, m_parameter1, m_parameter2, m_parameter3);
153     }
154 
155 private:
156     Method m_method;
157     P1 m_parameter1;
158     P2 m_parameter2;
159     P3 m_parameter3;
160 };
161 
162 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4>
163 class GC_PLUGIN_IGNORE("crbug.com/378192") CrossThreadTask4 : public ExecutionContextTask {
164 public:
165     typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3, MP4);
166     typedef CrossThreadTask4<P1, MP1, P2, MP2, P3, MP3, P4, MP4> CrossThreadTask;
167     typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
168     typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
169     typedef typename CrossThreadTaskTraits<P3>::ParamType Param3;
170     typedef typename CrossThreadTaskTraits<P4>::ParamType Param4;
171 
172     static PassOwnPtr<CrossThreadTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4)
173     {
174         return adoptPtr(new CrossThreadTask(method, parameter1, parameter2, parameter3, parameter4));
175     }
176 
177 private:
178     CrossThreadTask4(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4)
179         : m_method(method)
180         , m_parameter1(parameter1)
181         , m_parameter2(parameter2)
182         , m_parameter3(parameter3)
183         , m_parameter4(parameter4)
184     {
185     }
186 
187     virtual void performTask(ExecutionContext* context)
188     {
189         (*m_method)(context, m_parameter1, m_parameter2, m_parameter3, m_parameter4);
190     }
191 
192 private:
193     Method m_method;
194     P1 m_parameter1;
195     P2 m_parameter2;
196     P3 m_parameter3;
197     P4 m_parameter4;
198 };
199 
200 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5>
201 class GC_PLUGIN_IGNORE("crbug.com/378192") CrossThreadTask5 : public ExecutionContextTask {
202 public:
203     typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5);
204     typedef CrossThreadTask5<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5> CrossThreadTask;
205     typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
206     typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
207     typedef typename CrossThreadTaskTraits<P3>::ParamType Param3;
208     typedef typename CrossThreadTaskTraits<P4>::ParamType Param4;
209     typedef typename CrossThreadTaskTraits<P5>::ParamType Param5;
210 
211     static PassOwnPtr<CrossThreadTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5)
212     {
213         return adoptPtr(new CrossThreadTask(method, parameter1, parameter2, parameter3, parameter4, parameter5));
214     }
215 
216 private:
217     CrossThreadTask5(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5)
218         : m_method(method)
219         , m_parameter1(parameter1)
220         , m_parameter2(parameter2)
221         , m_parameter3(parameter3)
222         , m_parameter4(parameter4)
223         , m_parameter5(parameter5)
224     {
225     }
226 
227     virtual void performTask(ExecutionContext* context)
228     {
229         (*m_method)(context, m_parameter1, m_parameter2, m_parameter3, m_parameter4, m_parameter5);
230     }
231 
232 private:
233     Method m_method;
234     P1 m_parameter1;
235     P2 m_parameter2;
236     P3 m_parameter3;
237     P4 m_parameter4;
238     P5 m_parameter5;
239 };
240 
241 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6>
242 class GC_PLUGIN_IGNORE("crbug.com/378192") CrossThreadTask6 : public ExecutionContextTask {
243 public:
244     typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6);
245     typedef CrossThreadTask6<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6> CrossThreadTask;
246     typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
247     typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
248     typedef typename CrossThreadTaskTraits<P3>::ParamType Param3;
249     typedef typename CrossThreadTaskTraits<P4>::ParamType Param4;
250     typedef typename CrossThreadTaskTraits<P5>::ParamType Param5;
251     typedef typename CrossThreadTaskTraits<P6>::ParamType Param6;
252 
253     static PassOwnPtr<CrossThreadTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6)
254     {
255         return adoptPtr(new CrossThreadTask(method, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6));
256     }
257 
258 private:
259     CrossThreadTask6(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6)
260         : m_method(method)
261         , m_parameter1(parameter1)
262         , m_parameter2(parameter2)
263         , m_parameter3(parameter3)
264         , m_parameter4(parameter4)
265         , m_parameter5(parameter5)
266         , m_parameter6(parameter6)
267     {
268     }
269 
270     virtual void performTask(ExecutionContext* context)
271     {
272         (*m_method)(context, m_parameter1, m_parameter2, m_parameter3, m_parameter4, m_parameter5, m_parameter6);
273     }
274 
275 private:
276     Method m_method;
277     P1 m_parameter1;
278     P2 m_parameter2;
279     P3 m_parameter3;
280     P4 m_parameter4;
281     P5 m_parameter5;
282     P6 m_parameter6;
283 };
284 
285 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7>
286 class GC_PLUGIN_IGNORE("crbug.com/378192") CrossThreadTask7 : public ExecutionContextTask {
287 public:
288     typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7);
289     typedef CrossThreadTask7<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6, P7, MP7> CrossThreadTask;
290     typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
291     typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
292     typedef typename CrossThreadTaskTraits<P3>::ParamType Param3;
293     typedef typename CrossThreadTaskTraits<P4>::ParamType Param4;
294     typedef typename CrossThreadTaskTraits<P5>::ParamType Param5;
295     typedef typename CrossThreadTaskTraits<P6>::ParamType Param6;
296     typedef typename CrossThreadTaskTraits<P7>::ParamType Param7;
297 
298     static PassOwnPtr<CrossThreadTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7)
299     {
300         return adoptPtr(new CrossThreadTask(method, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7));
301     }
302 
303 private:
304     CrossThreadTask7(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7)
305         : m_method(method)
306         , m_parameter1(parameter1)
307         , m_parameter2(parameter2)
308         , m_parameter3(parameter3)
309         , m_parameter4(parameter4)
310         , m_parameter5(parameter5)
311         , m_parameter6(parameter6)
312         , m_parameter7(parameter7)
313     {
314     }
315 
316     virtual void performTask(ExecutionContext* context)
317     {
318         (*m_method)(context, m_parameter1, m_parameter2, m_parameter3, m_parameter4, m_parameter5, m_parameter6, m_parameter7);
319     }
320 
321 private:
322     Method m_method;
323     P1 m_parameter1;
324     P2 m_parameter2;
325     P3 m_parameter3;
326     P4 m_parameter4;
327     P5 m_parameter5;
328     P6 m_parameter6;
329     P7 m_parameter7;
330 };
331 
332 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7, typename P8, typename MP8>
333 class GC_PLUGIN_IGNORE("crbug.com/378192") CrossThreadTask8 : public ExecutionContextTask {
334 public:
335     typedef void (*Method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7, MP8);
336     typedef CrossThreadTask8<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6, P7, MP7, P8, MP8> CrossThreadTask;
337     typedef typename CrossThreadTaskTraits<P1>::ParamType Param1;
338     typedef typename CrossThreadTaskTraits<P2>::ParamType Param2;
339     typedef typename CrossThreadTaskTraits<P3>::ParamType Param3;
340     typedef typename CrossThreadTaskTraits<P4>::ParamType Param4;
341     typedef typename CrossThreadTaskTraits<P5>::ParamType Param5;
342     typedef typename CrossThreadTaskTraits<P6>::ParamType Param6;
343     typedef typename CrossThreadTaskTraits<P7>::ParamType Param7;
344     typedef typename CrossThreadTaskTraits<P8>::ParamType Param8;
345 
346     static PassOwnPtr<CrossThreadTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7, Param8 parameter8)
347     {
348         return adoptPtr(new CrossThreadTask(method, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8));
349     }
350 
351 private:
352     CrossThreadTask8(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7, Param8 parameter8)
353     : m_method(method)
354     , m_parameter1(parameter1)
355     , m_parameter2(parameter2)
356     , m_parameter3(parameter3)
357     , m_parameter4(parameter4)
358     , m_parameter5(parameter5)
359     , m_parameter6(parameter6)
360     , m_parameter7(parameter7)
361     , m_parameter8(parameter8)
362     {
363     }
364 
365     virtual void performTask(ExecutionContext* context)
366     {
367         (*m_method)(context, m_parameter1, m_parameter2, m_parameter3, m_parameter4, m_parameter5, m_parameter6, m_parameter7, m_parameter8);
368     }
369 
370 private:
371     Method m_method;
372     P1 m_parameter1;
373     P2 m_parameter2;
374     P3 m_parameter3;
375     P4 m_parameter4;
376     P5 m_parameter5;
377     P6 m_parameter6;
378     P7 m_parameter7;
379     P8 m_parameter8;
380 };
381 
382 template<typename P1, typename MP1>
383 PassOwnPtr<ExecutionContextTask> createCallbackTask(
384     void (*method)(ExecutionContext*, MP1),
385     const P1& parameter1)
386 {
387     return CrossThreadTask1<typename CrossThreadCopier<P1>::Type, MP1>::create(
388         method,
389         CrossThreadCopier<P1>::copy(parameter1));
390 }
391 
392 template<typename P1, typename MP1, typename P2, typename MP2>
393 PassOwnPtr<ExecutionContextTask> createCallbackTask(
394     void (*method)(ExecutionContext*, MP1, MP2),
395     const P1& parameter1, const P2& parameter2)
396 {
397     return CrossThreadTask2<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2>::create(
398         method,
399         CrossThreadCopier<P1>::copy(parameter1), CrossThreadCopier<P2>::copy(parameter2));
400 }
401 
402 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3>
403 PassOwnPtr<ExecutionContextTask> createCallbackTask(
404     void (*method)(ExecutionContext*, MP1, MP2, MP3),
405     const P1& parameter1, const P2& parameter2, const P3& parameter3)
406 {
407     return CrossThreadTask3<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3>::create(
408         method,
409         CrossThreadCopier<P1>::copy(parameter1), CrossThreadCopier<P2>::copy(parameter2),
410         CrossThreadCopier<P3>::copy(parameter3));
411 }
412 
413 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4>
414 PassOwnPtr<ExecutionContextTask> createCallbackTask(
415     void (*method)(ExecutionContext*, MP1, MP2, MP3, MP4),
416     const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4)
417 {
418     return CrossThreadTask4<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
419         typename CrossThreadCopier<P4>::Type, MP4>::create(
420             method,
421             CrossThreadCopier<P1>::copy(parameter1), CrossThreadCopier<P2>::copy(parameter2),
422             CrossThreadCopier<P3>::copy(parameter3), CrossThreadCopier<P4>::copy(parameter4));
423 }
424 
425 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5>
426 PassOwnPtr<ExecutionContextTask> createCallbackTask(
427     void (*method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5),
428     const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4, const P5& parameter5)
429 {
430     return CrossThreadTask5<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
431         typename CrossThreadCopier<P4>::Type, MP4, typename CrossThreadCopier<P5>::Type, MP5>::create(
432             method,
433             CrossThreadCopier<P1>::copy(parameter1), CrossThreadCopier<P2>::copy(parameter2),
434             CrossThreadCopier<P3>::copy(parameter3), CrossThreadCopier<P4>::copy(parameter4),
435             CrossThreadCopier<P5>::copy(parameter5));
436 }
437 
438 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6>
439 PassOwnPtr<ExecutionContextTask> createCallbackTask(
440     void (*method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6),
441     const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4, const P5& parameter5, const P6& parameter6)
442 {
443     return CrossThreadTask6<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
444         typename CrossThreadCopier<P4>::Type, MP4, typename CrossThreadCopier<P5>::Type, MP5, typename CrossThreadCopier<P6>::Type, MP6>::create(
445             method,
446             CrossThreadCopier<P1>::copy(parameter1), CrossThreadCopier<P2>::copy(parameter2),
447             CrossThreadCopier<P3>::copy(parameter3), CrossThreadCopier<P4>::copy(parameter4),
448             CrossThreadCopier<P5>::copy(parameter5), CrossThreadCopier<P6>::copy(parameter6));
449 }
450 
451 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7>
452 PassOwnPtr<ExecutionContextTask> createCallbackTask(
453     void (*method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7),
454     const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4, const P5& parameter5, const P6& parameter6, const P7& parameter7)
455 {
456     return CrossThreadTask7<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
457         typename CrossThreadCopier<P4>::Type, MP4, typename CrossThreadCopier<P5>::Type, MP5, typename CrossThreadCopier<P6>::Type, MP6,
458         typename CrossThreadCopier<P7>::Type, MP7>::create(
459             method,
460             CrossThreadCopier<P1>::copy(parameter1), CrossThreadCopier<P2>::copy(parameter2),
461             CrossThreadCopier<P3>::copy(parameter3), CrossThreadCopier<P4>::copy(parameter4),
462             CrossThreadCopier<P5>::copy(parameter5), CrossThreadCopier<P6>::copy(parameter6),
463             CrossThreadCopier<P7>::copy(parameter7));
464 }
465 
466 template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7, typename P8, typename MP8>
467 PassOwnPtr<ExecutionContextTask> createCallbackTask(
468     void (*method)(ExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7, MP8),
469     const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4, const P5& parameter5, const P6& parameter6, const P7& parameter7, const P8& parameter8)
470 {
471     return CrossThreadTask8<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
472     typename CrossThreadCopier<P4>::Type, MP4, typename CrossThreadCopier<P5>::Type, MP5, typename CrossThreadCopier<P6>::Type, MP6,
473     typename CrossThreadCopier<P7>::Type, MP7, typename CrossThreadCopier<P8>::Type, MP8>::create(
474                                                        method,
475                                                        CrossThreadCopier<P1>::copy(parameter1), CrossThreadCopier<P2>::copy(parameter2),
476                                                        CrossThreadCopier<P3>::copy(parameter3), CrossThreadCopier<P4>::copy(parameter4),
477                                                        CrossThreadCopier<P5>::copy(parameter5), CrossThreadCopier<P6>::copy(parameter6),
478                                                        CrossThreadCopier<P7>::copy(parameter7), CrossThreadCopier<P8>::copy(parameter8));
479 }
480 
481 } // namespace WebCore
482 
483 #endif // CrossThreadTask_h
484