Use the callOnMainThread version that takes an std::function in BlobResourceHandle::start()
https://bugs.webkit.org/show_bug.cgi?id=133886

Reviewed by Andreas Kling.

Also replace a couple of NSAutoreleasePools with @autoreleasepool and an OwnPtr with an std::unique_ptr.

* page/scrolling/mac/ScrollingThreadMac.mm:
(WebCore::ScrollingThread::threadRunLoopSourceCallback):
* platform/mac/SharedTimerMac.mm:
(WebCore::PowerObserver::PowerObserver):
(WebCore::timerFired):
(WebCore::setSharedTimerFireInterval):
(WebCore::PowerObserver::create): Deleted.
(WebCore::PowerObserver::didReceiveSystemPowerNotification): Deleted.
* platform/network/BlobResourceHandle.cpp:
(WebCore::BlobResourceHandle::start):
(WebCore::delayedStartBlobResourceHandle): Deleted.
* platform/network/BlobResourceHandle.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@169955 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/platform/network/BlobResourceHandle.cpp b/Source/WebCore/platform/network/BlobResourceHandle.cpp
index 3046cd1..491a9c3 100644
--- a/Source/WebCore/platform/network/BlobResourceHandle.cpp
+++ b/Source/WebCore/platform/network/BlobResourceHandle.cpp
@@ -205,24 +205,19 @@
     // BlobResourceHandle doesn't wait for didReceiveResponse, and it currently cannot be used for downloading.
 }
 
-void delayedStartBlobResourceHandle(void* context)
-{
-    RefPtr<BlobResourceHandle> handle = adoptRef(static_cast<BlobResourceHandle*>(context));
-    handle->doStart();
-}
-
 void BlobResourceHandle::start()
 {
-    if (m_async) {
-        // Keep BlobResourceHandle alive until delayedStartBlobResourceHandle runs.
-        ref();
-
-        // Finish this async call quickly and return.
-        callOnMainThread(delayedStartBlobResourceHandle, this);
+    if (!m_async) {
+        doStart();
         return;
     }
 
-    doStart();
+    RefPtr<BlobResourceHandle> handle(this);
+
+    // Finish this async call quickly and return.
+    callOnMainThread([handle] {
+        handle->doStart();
+    });
 }
 
 void BlobResourceHandle::doStart()