Remove DecodingTask::create and DatabaseOpenTask::create
authorgyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Feb 2015 01:12:44 +0000 (01:12 +0000)
committergyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Feb 2015 01:12:44 +0000 (01:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=141966

Reviewed by Anders Carlsson.

These create() factory functions are redundant. We can use std::make_unique<> directly.

No new tests, no behavior changes.

* Modules/webaudio/AsyncAudioDecoder.cpp:
(WebCore::AsyncAudioDecoder::decodeAsync):
(WebCore::AsyncAudioDecoder::DecodingTask::create): Deleted.
* Modules/webaudio/AsyncAudioDecoder.h:
* Modules/webdatabase/Database.cpp:
(WebCore::Database::openAndVerifyVersion):
* Modules/webdatabase/DatabaseTask.h:
(WebCore::DatabaseBackend::DatabaseOpenTask::create): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@180598 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Modules/webaudio/AsyncAudioDecoder.cpp
Source/WebCore/Modules/webaudio/AsyncAudioDecoder.h
Source/WebCore/Modules/webdatabase/Database.cpp
Source/WebCore/Modules/webdatabase/DatabaseTask.h

index 123cdb3..fd08586 100644 (file)
@@ -1,3 +1,23 @@
+2015-02-24  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Remove DecodingTask::create and DatabaseOpenTask::create
+        https://bugs.webkit.org/show_bug.cgi?id=141966
+
+        Reviewed by Anders Carlsson.
+
+        These create() factory functions are redundant. We can use std::make_unique<> directly.
+
+        No new tests, no behavior changes.
+
+        * Modules/webaudio/AsyncAudioDecoder.cpp:
+        (WebCore::AsyncAudioDecoder::decodeAsync):
+        (WebCore::AsyncAudioDecoder::DecodingTask::create): Deleted.
+        * Modules/webaudio/AsyncAudioDecoder.h:
+        * Modules/webdatabase/Database.cpp:
+        (WebCore::Database::openAndVerifyVersion):
+        * Modules/webdatabase/DatabaseTask.h:
+        (WebCore::DatabaseBackend::DatabaseOpenTask::create): Deleted.
+
 2015-02-24  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r180578.
index 449e338..b467d18 100644 (file)
@@ -58,7 +58,7 @@ void AsyncAudioDecoder::decodeAsync(ArrayBuffer* audioData, float sampleRate, Pa
     if (!audioData)
         return;
 
-    auto decodingTask = DecodingTask::create(audioData, sampleRate, successCallback, errorCallback);
+    auto decodingTask = std::make_unique<DecodingTask>(audioData, sampleRate, successCallback, errorCallback);
     m_queue.append(WTF::move(decodingTask)); // note that ownership of the task is effectively taken by the queue.
 }
 
@@ -87,11 +87,6 @@ void AsyncAudioDecoder::runLoop()
     }
 }
 
-std::unique_ptr<AsyncAudioDecoder::DecodingTask> AsyncAudioDecoder::DecodingTask::create(ArrayBuffer* audioData, float sampleRate, PassRefPtr<AudioBufferCallback> successCallback, PassRefPtr<AudioBufferCallback> errorCallback)
-{
-    return std::unique_ptr<DecodingTask>(new DecodingTask(audioData, sampleRate, successCallback, errorCallback));
-}
-
 AsyncAudioDecoder::DecodingTask::DecodingTask(ArrayBuffer* audioData, float sampleRate, PassRefPtr<AudioBufferCallback> successCallback, PassRefPtr<AudioBufferCallback> errorCallback)
     : m_audioData(audioData)
     , m_sampleRate(sampleRate)
index ff096ec..5e40cd2 100644 (file)
@@ -57,13 +57,10 @@ private:
     class DecodingTask {
         WTF_MAKE_NONCOPYABLE(DecodingTask);
     public:
-        static std::unique_ptr<DecodingTask> create(JSC::ArrayBuffer* audioData, float sampleRate, PassRefPtr<AudioBufferCallback> successCallback, PassRefPtr<AudioBufferCallback> errorCallback);
-
+        DecodingTask(JSC::ArrayBuffer* audioData, float sampleRate, PassRefPtr<AudioBufferCallback> successCallback, PassRefPtr<AudioBufferCallback> errorCallback);
         void decode();
         
     private:
-        DecodingTask(JSC::ArrayBuffer* audioData, float sampleRate, PassRefPtr<AudioBufferCallback> successCallback, PassRefPtr<AudioBufferCallback> errorCallback);
-
         JSC::ArrayBuffer* audioData() { return m_audioData.get(); }
         float sampleRate() const { return m_sampleRate; }
         AudioBufferCallback* successCallback() { return m_successCallback.get(); }
index 24dbb39..f721207 100644 (file)
@@ -102,7 +102,7 @@ bool Database::openAndVerifyVersion(bool setVersionInNewDatabase, DatabaseError&
         return false;
 
     bool success = false;
-    auto task = DatabaseOpenTask::create(this, setVersionInNewDatabase, &synchronizer, error, errorMessage, success);
+    auto task = std::make_unique<DatabaseOpenTask>(this, setVersionInNewDatabase, &synchronizer, error, errorMessage, success);
     databaseContext()->databaseThread()->scheduleImmediateTask(WTF::move(task));
     synchronizer.waitForTaskCompletion();
 
index 7d10850..516e32d 100644 (file)
@@ -100,18 +100,13 @@ private:
 
 class DatabaseBackend::DatabaseOpenTask : public DatabaseTask {
 public:
-    static std::unique_ptr<DatabaseOpenTask> create(DatabaseBackend* db, bool setVersionInNewDatabase, DatabaseTaskSynchronizer* synchronizer, DatabaseError& error, String& errorMessage, bool& success)
-    {
-        return std::unique_ptr<DatabaseOpenTask>(new DatabaseOpenTask(db, setVersionInNewDatabase, synchronizer, error, errorMessage, success));
-    }
-    
+    DatabaseOpenTask(DatabaseBackend*, bool setVersionInNewDatabase, DatabaseTaskSynchronizer*, DatabaseError&, String& errorMessage, bool& success);
+
 #if PLATFORM(IOS)
     virtual bool shouldPerformWhilePaused() const override { return true; }
 #endif
 
 private:
-    DatabaseOpenTask(DatabaseBackend*, bool setVersionInNewDatabase, DatabaseTaskSynchronizer*, DatabaseError&, String& errorMessage, bool& success);
-
     virtual void doPerformTask();
 #if !LOG_DISABLED
     virtual const char* debugTaskName() const;