Changeset 195785 in webkit


Ignore:
Timestamp:
Jan 28, 2016 3:04:03 PM (8 years ago)
Author:
dbates@webkit.org
Message:

Cleanup: Make DedicatedWorkerThread::create() an inline template method
https://bugs.webkit.org/show_bug.cgi?id=153612

Reviewed by Andy Estes.

Make use of variadic template arguments and std::forward() to forward the arguments passed
to DedicatedWorkerThread::create() to DedicatedWorkerThread::DedicatedWorkerThread(). This
removes the need to duplicate code whenever we modify the parameter types or number of
parameters taken by DedicatedWorkerThread::DedicatedWorkerThread().

  • workers/DedicatedWorkerThread.cpp:

(WebCore::DedicatedWorkerThread::create): Deleted.

  • workers/DedicatedWorkerThread.h: Reorganized listing of member functions such that we

group the creation/constructor and destructor functions.
(WebCore::DedicatedWorkerThread::create): Modified to be an inline template with variadic
parameters that std::forward()s its arguments to DedicatedWorkerThread::DedicatedWorkerThread().

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r195784 r195785  
     12016-01-28  Daniel Bates  <dabates@apple.com>
     2
     3        Cleanup: Make DedicatedWorkerThread::create() an inline template method
     4        https://bugs.webkit.org/show_bug.cgi?id=153612
     5
     6        Reviewed by Andy Estes.
     7
     8        Make use of variadic template arguments and std::forward() to forward the arguments passed
     9        to DedicatedWorkerThread::create() to DedicatedWorkerThread::DedicatedWorkerThread(). This
     10        removes the need to duplicate code whenever we modify the parameter types or number of
     11        parameters taken by DedicatedWorkerThread::DedicatedWorkerThread().
     12
     13        * workers/DedicatedWorkerThread.cpp:
     14        (WebCore::DedicatedWorkerThread::create): Deleted.
     15        * workers/DedicatedWorkerThread.h: Reorganized listing of member functions such that we
     16        group the creation/constructor and destructor functions.
     17        (WebCore::DedicatedWorkerThread::create): Modified to be an inline template with variadic
     18        parameters that std::forward()s its arguments to DedicatedWorkerThread::DedicatedWorkerThread().
     19
    1202016-01-28  Brady Eidson  <beidson@apple.com>
    221
  • trunk/Source/WebCore/workers/DedicatedWorkerThread.cpp

    r177857 r195785  
    3939namespace WebCore {
    4040
    41 Ref<DedicatedWorkerThread> DedicatedWorkerThread::create(const URL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerObjectProxy& workerObjectProxy, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, const SecurityOrigin* topOrigin)
    42 {
    43     return adoptRef(*new DedicatedWorkerThread(scriptURL, userAgent, sourceCode, workerLoaderProxy, workerObjectProxy, startMode, contentSecurityPolicy, contentSecurityPolicyType, topOrigin));
    44 }
    45 
    4641DedicatedWorkerThread::DedicatedWorkerThread(const URL& url, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerObjectProxy& workerObjectProxy, WorkerThreadStartMode startMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType, const SecurityOrigin* topOrigin)
    4742    : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy, workerObjectProxy, startMode, contentSecurityPolicy, contentSecurityPolicyType, topOrigin)
  • trunk/Source/WebCore/workers/DedicatedWorkerThread.h

    r177857 r195785  
    4040    class DedicatedWorkerThread : public WorkerThread {
    4141    public:
    42         static Ref<DedicatedWorkerThread> create(const URL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerObjectProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType, const SecurityOrigin* topOrigin);
     42        template<class... Args> static Ref<DedicatedWorkerThread> create(Args&&... args)
     43        {
     44            return adoptRef(*new DedicatedWorkerThread(std::forward<Args>(args)...));
     45        }
     46        virtual ~DedicatedWorkerThread();
     47
    4348        WorkerObjectProxy& workerObjectProxy() const { return m_workerObjectProxy; }
    44         virtual ~DedicatedWorkerThread();
    4549
    4650    protected:
Note: See TracChangeset for help on using the changeset viewer.