CCThreadTask.h revision 2daae5fd11344eaa88a0d92b0f6d65f8d2255c00
12daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch/* 22daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * Copyright (C) 2011 Google Inc. All rights reserved. 32daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * 42daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * Redistribution and use in source and binary forms, with or without 52daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * modification, are permitted provided that the following conditions 62daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * are met: 72daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * 1. Redistributions of source code must retain the above copyright 82daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * notice, this list of conditions and the following disclaimer. 92daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * 2. Redistributions in binary form must reproduce the above copyright 102daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * notice, this list of conditions and the following disclaimer in the 112daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * documentation and/or other materials provided with the distribution. 122daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * 132daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY 142daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 152daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 162daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY 172daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 182daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 192daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 202daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 212daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 222daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 232daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch */ 242daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#ifndef CCThreadTask_h 252daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#define CCThreadTask_h 262daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 272daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#include "CCThread.h" 282daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#include "CrossThreadCopier.h" 292daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#include "CrossThreadTask.h" 302daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#include <wtf/PassOwnPtr.h> 312daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#include <wtf/PassRefPtr.h> 322daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 332daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochnamespace WebCore { 342daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 352daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochtemplate<typename T> 362daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochclass CCThreadTask0 : public CCThread::Task { 372daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochpublic: 382daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef void (T::*Method)(); 392daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef CCThreadTask0<T> CCThreadTaskImpl; 402daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 412daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method) 422daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch { 432daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch return adoptPtr(new CCThreadTaskImpl(instance, method)); 442daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch } 452daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 462daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochprivate: 472daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch CCThreadTask0(T* instance, Method method) 482daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch : CCThread::Task(instance) 492daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch , m_method(method) 502daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch { 512daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch } 522daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 532daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch virtual void performTask() 542daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch { 552daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch (*static_cast<T*>(instance()).*m_method)(); 562daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch } 572daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 582daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochprivate: 592daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch Method m_method; 602daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch}; 612daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 622daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochtemplate<typename T, typename P1, typename MP1> 632daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochclass CCThreadTask1 : public CCThread::Task { 642daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochpublic: 652daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef void (T::*Method)(MP1); 662daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef CCThreadTask1<T, P1, MP1> CCThreadTaskImpl; 672daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef typename CrossThreadTaskTraits<P1>::ParamType Param1; 682daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 692daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, Param1 parameter1) 702daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch { 712daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1)); 722daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch } 732daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 742daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochprivate: 752daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch CCThreadTask1(T* instance, Method method, Param1 parameter1) 762daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch : CCThread::Task(instance) 772daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch , m_method(method) 782daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch , m_parameter1(parameter1) 792daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch { 802daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch } 812daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 822daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch virtual void performTask() 832daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch { 842daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch (*static_cast<T*>(instance()).*m_method)(m_parameter1); 852daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch } 862daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 872daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochprivate: 882daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch Method m_method; 892daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch P1 m_parameter1; 902daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch}; 912daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 922daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochtemplate<typename T, typename P1, typename MP1, typename P2, typename MP2> 932daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochclass CCThreadTask2 : public CCThread::Task { 942daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochpublic: 952daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef void (T::*Method)(MP1, MP2); 962daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef CCThreadTask2<T, P1, MP1, P2, MP2> CCThreadTaskImpl; 972daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef typename CrossThreadTaskTraits<P1>::ParamType Param1; 982daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef typename CrossThreadTaskTraits<P2>::ParamType Param2; 992daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 1002daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, Param1 parameter1, Param2 parameter2) 1012daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch { 1022daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2)); 1032daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch } 1042daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 1052daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochprivate: 1062daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch CCThreadTask2(T* instance, Method method, Param1 parameter1, Param2 parameter2) 1072daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch : CCThread::Task(instance) 1082daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch , m_method(method) 1092daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch , m_parameter1(parameter1) 1102daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch , m_parameter2(parameter2) 1112daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch { 1122daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch } 1132daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 1142daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch virtual void performTask() 1152daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch { 1162daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2); 1172daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch } 1182daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 1192daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochprivate: 1202daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch Method m_method; 1212daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch P1 m_parameter1; 1222daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch P2 m_parameter2; 1232daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch}; 1242daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 1252daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochtemplate<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3> 1262daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochclass CCThreadTask3 : public CCThread::Task { 1272daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochpublic: 1282daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef void (T::*Method)(MP1, MP2, MP3); 1292daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef CCThreadTask3<T, P1, MP1, P2, MP2, P3, MP3> CCThreadTaskImpl; 1302daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef typename CrossThreadTaskTraits<P1>::ParamType Param1; 1312daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef typename CrossThreadTaskTraits<P2>::ParamType Param2; 1322daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef typename CrossThreadTaskTraits<P3>::ParamType Param3; 1332daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 1342daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3) 1352daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch { 1362daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2, parameter3)); 1372daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch } 1382daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 1392daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochprivate: 1402daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch CCThreadTask3(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3) 1412daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch : CCThread::Task(instance) 1422daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch , m_method(method) 1432daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch , m_parameter1(parameter1) 1442daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch , m_parameter2(parameter2) 1452daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch , m_parameter3(parameter3) 1462daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch { 1472daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch } 1482daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 1492daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch virtual void performTask() 1502daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch { 1512daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2, m_parameter3); 1522daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch } 1532daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 1542daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochprivate: 1552daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch Method m_method; 1562daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch P1 m_parameter1; 1572daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch P2 m_parameter2; 1582daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch P3 m_parameter3; 1592daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch}; 1602daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 1612daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 1622daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochtemplate<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4> 1632daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochclass CCThreadTask4 : public CCThread::Task { 1642daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochpublic: 1652daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef void (T::*Method)(MP1, MP2, MP3, MP4); 1662daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef CCThreadTask4<T, P1, MP1, P2, MP2, P3, MP3, P4, MP4> CCThreadTaskImpl; 1672daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef typename CrossThreadTaskTraits<P1>::ParamType Param1; 1682daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef typename CrossThreadTaskTraits<P2>::ParamType Param2; 1692daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef typename CrossThreadTaskTraits<P3>::ParamType Param3; 1702daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef typename CrossThreadTaskTraits<P4>::ParamType Param4; 1712daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 1722daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch static PassOwnPtr<CCThreadTaskImpl> create(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4) 1732daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch { 1742daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch return adoptPtr(new CCThreadTaskImpl(instance, method, parameter1, parameter2, parameter3, parameter4)); 1752daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch } 1762daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 1772daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochprivate: 1782daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch CCThreadTask4(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4) 1792daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch : CCThread::Task(instance) 1802daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch , m_method(method) 1812daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch , m_parameter1(parameter1) 1822daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch , m_parameter2(parameter2) 1832daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch , m_parameter3(parameter3) 1842daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch , m_parameter4(parameter4) 1852daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch { 1862daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch } 1872daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 1882daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch virtual void performTask() 1892daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch { 1902daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2, m_parameter3, m_parameter4); 1912daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch } 1922daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 1932daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochprivate: 1942daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch Method m_method; 1952daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch P1 m_parameter1; 1962daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch P2 m_parameter2; 1972daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch P3 m_parameter3; 1982daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch P4 m_parameter4; 1992daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch}; 2002daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 2012daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochtemplate<typename T> 2022daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben MurdochPassOwnPtr<CCThread::Task> createCCThreadTask( 2032daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch T* const callee, 2042daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch void (T::*method)()); 2052daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 2062daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochtemplate<typename T> 2072daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben MurdochPassOwnPtr<CCThread::Task> createCCThreadTask( 2082daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch T* const callee, 2092daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch void (T::*method)()) 2102daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch{ 2112daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch return CCThreadTask0<T>::create( 2122daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch callee, 2132daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch method); 2142daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch} 2152daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 2162daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochtemplate<typename T, typename P1, typename MP1> 2172daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben MurdochPassOwnPtr<CCThread::Task> createCCThreadTask( 2182daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch T* const callee, 2192daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch void (T::*method)(MP1), 2202daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch const P1& parameter1) 2212daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch{ 2222daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch return CCThreadTask1<T, typename CrossThreadCopier<P1>::Type, MP1>::create( 2232daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch callee, 2242daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch method, 2252daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch CrossThreadCopier<P1>::copy(parameter1)); 2262daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch} 2272daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 2282daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochtemplate<typename T, typename P1, typename MP1, typename P2, typename MP2> 2292daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben MurdochPassOwnPtr<CCThread::Task> createCCThreadTask( 2302daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch T* const callee, 2312daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch void (T::*method)(MP1, MP2), 2322daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch const P1& parameter1, 2332daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch const P2& parameter2) 2342daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch{ 2352daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch return CCThreadTask2<T, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2>::create( 2362daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch callee, 2372daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch method, 2382daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch CrossThreadCopier<P1>::copy(parameter1), 2392daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch CrossThreadCopier<P2>::copy(parameter2)); 2402daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch} 2412daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 2422daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochtemplate<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3> 2432daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben MurdochPassOwnPtr<CCThread::Task> createCCThreadTask( 2442daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch T* const callee, 2452daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch void (T::*method)(MP1, MP2, MP3), 2462daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch const P1& parameter1, 2472daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch const P2& parameter2, 2482daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch const P3& parameter3) 2492daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch{ 2502daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch return CCThreadTask3<T, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3>::create( 2512daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch callee, 2522daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch method, 2532daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch CrossThreadCopier<P1>::copy(parameter1), 2542daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch CrossThreadCopier<P2>::copy(parameter2), 2552daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch CrossThreadCopier<P3>::copy(parameter3)); 2562daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch} 2572daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 2582daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochtemplate<typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4> 2592daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben MurdochPassOwnPtr<CCThread::Task> createCCThreadTask( 2602daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch T* const callee, 2612daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch void (T::*method)(MP1, MP2, MP3, MP4), 2622daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch const P1& parameter1, 2632daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch const P2& parameter2, 2642daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch const P3& parameter3, 2652daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch const P4& parameter4) 2662daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch{ 2672daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch return CCThreadTask4<T, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3, typename CrossThreadCopier<P4>::Type, MP4>::create( 2682daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch callee, 2692daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch method, 2702daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch CrossThreadCopier<P1>::copy(parameter1), 2712daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch CrossThreadCopier<P2>::copy(parameter2), 2722daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch CrossThreadCopier<P3>::copy(parameter3), 2732daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch CrossThreadCopier<P4>::copy(parameter4)); 2742daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 2752daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch} 2762daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 2772daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch} // namespace WebCore 2782daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 2792daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#endif // CCThreadTask_h 280