Title: [188772] trunk/Source
Revision
188772
Author
[email protected]
Date
2015-08-21 13:50:59 -0700 (Fri, 21 Aug 2015)

Log Message

Get rid of uses of the old callOnMainThread function that takes a function ptr + context
https://bugs.webkit.org/show_bug.cgi?id=148324

Reviewed by Tim Horton.

Source/WebCore:

* Modules/webaudio/AsyncAudioDecoder.cpp:
(WebCore::AsyncAudioDecoder::DecodingTask::decode):
(WebCore::AsyncAudioDecoder::DecodingTask::notifyCompleteDispatch): Deleted.
* Modules/webaudio/AsyncAudioDecoder.h:
* Modules/webaudio/OfflineAudioDestinationNode.cpp:
(WebCore::OfflineAudioDestinationNode::offlineRender):
(WebCore::OfflineAudioDestinationNode::notifyCompleteDispatch): Deleted.
* Modules/webaudio/OfflineAudioDestinationNode.h:
* Modules/webaudio/ScriptProcessorNode.cpp:
(WebCore::ScriptProcessorNode::process):
(WebCore::ScriptProcessorNode::fireProcessEventDispatch): Deleted.
* Modules/webaudio/ScriptProcessorNode.h:
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::scheduleForNotification):
(WebCore::DatabaseTracker::notifyDatabasesChanged):
* Modules/webdatabase/DatabaseTracker.h:
* platform/graphics/cg/ImageCG.cpp:
(WebCore::patternReleaseCallback):
(WebCore::patternReleaseOnMainThreadCallback): Deleted.
* platform/graphics/cg/PatternCG.cpp:
(WebCore::patternReleaseCallback):
(WebCore::patternReleaseOnMainThreadCallback): Deleted.
* platform/graphics/mac/FontCacheMac.mm:
(WebCore::invalidateFontCache):
(WebCore::fontCacheRegisteredFontsChangedNotificationCallback):
* platform/network/BlobResourceHandle.cpp:
(WebCore::doNotifyFinish):
(WebCore::BlobResourceHandle::notifyFinish):
* platform/network/cf/FormDataStreamCFNet.cpp:
(WebCore::formFinalize):
(WebCore::formFinishFinalizationOnMainThread): Deleted.

Source/WebKit/mac:

* Storage/WebDatabaseManagerClient.mm:
(DidModifyOriginData::dispatchToMainThread):
(DidModifyOriginData::dispatchDidModifyOriginOnMainThread): Deleted.
* Storage/WebStorageTrackerClient.h:
* Storage/WebStorageTrackerClient.mm:
(WebStorageTrackerClient::dispatchDidModifyOrigin):
(WebStorageTrackerClient::dispatchDidModifyOriginOnMainThread): Deleted.

Source/WebKit2:

* UIProcess/mac/WKPrintingView.mm:
(prepareDataForPrintingOnSecondaryThread):
(-[WKPrintingView knowsPageRange:]):

Source/WTF:

* wtf/text/cf/StringImplCF.cpp:
(WTF::StringWrapperCFAllocator::deallocate):
(WTF::StringWrapperCFAllocator::deallocateOnMainThread): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (188771 => 188772)


--- trunk/Source/WTF/ChangeLog	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WTF/ChangeLog	2015-08-21 20:50:59 UTC (rev 188772)
@@ -1,3 +1,14 @@
+2015-08-21  Anders Carlsson  <[email protected]>
+
+        Get rid of uses of the old callOnMainThread function that takes a function ptr + context
+        https://bugs.webkit.org/show_bug.cgi?id=148324
+
+        Reviewed by Tim Horton.
+
+        * wtf/text/cf/StringImplCF.cpp:
+        (WTF::StringWrapperCFAllocator::deallocate):
+        (WTF::StringWrapperCFAllocator::deallocateOnMainThread): Deleted.
+
 2015-08-20  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r188717 and r188719.

Modified: trunk/Source/WTF/wtf/text/cf/StringImplCF.cpp (188771 => 188772)


--- trunk/Source/WTF/wtf/text/cf/StringImplCF.cpp	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WTF/wtf/text/cf/StringImplCF.cpp	2015-08-21 20:50:59 UTC (rev 188772)
@@ -88,15 +88,6 @@
         return header + 1;
     }
 
-    static void deallocateOnMainThread(void* headerPointer)
-    {
-        StringImpl** header = static_cast<StringImpl**>(headerPointer);
-        StringImpl* underlyingString = *header;
-        ASSERT(underlyingString);
-        underlyingString->deref(); // Balanced by call to ref in allocate above.
-        fastFree(header);
-    }
-
     static void deallocate(void* pointer, void*)
     {
         StringImpl** header = static_cast<StringImpl**>(pointer) - 1;
@@ -104,12 +95,18 @@
         if (!underlyingString)
             fastFree(header);
         else {
-            if (!isMainThread())
-                callOnMainThread(deallocateOnMainThread, header);
-            else {
+            if (isMainThread()) {
                 underlyingString->deref(); // Balanced by call to ref in allocate above.
                 fastFree(header);
+                return;
             }
+
+            callOnMainThread([header] {
+                StringImpl* underlyingString = *header;
+                ASSERT(underlyingString);
+                underlyingString->deref(); // Balanced by call to ref in allocate above.
+                fastFree(header);
+            });
         }
     }
 

Modified: trunk/Source/WebCore/ChangeLog (188771 => 188772)


--- trunk/Source/WebCore/ChangeLog	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WebCore/ChangeLog	2015-08-21 20:50:59 UTC (rev 188772)
@@ -1,3 +1,42 @@
+2015-08-21  Anders Carlsson  <[email protected]>
+
+        Get rid of uses of the old callOnMainThread function that takes a function ptr + context
+        https://bugs.webkit.org/show_bug.cgi?id=148324
+
+        Reviewed by Tim Horton.
+
+        * Modules/webaudio/AsyncAudioDecoder.cpp:
+        (WebCore::AsyncAudioDecoder::DecodingTask::decode):
+        (WebCore::AsyncAudioDecoder::DecodingTask::notifyCompleteDispatch): Deleted.
+        * Modules/webaudio/AsyncAudioDecoder.h:
+        * Modules/webaudio/OfflineAudioDestinationNode.cpp:
+        (WebCore::OfflineAudioDestinationNode::offlineRender):
+        (WebCore::OfflineAudioDestinationNode::notifyCompleteDispatch): Deleted.
+        * Modules/webaudio/OfflineAudioDestinationNode.h:
+        * Modules/webaudio/ScriptProcessorNode.cpp:
+        (WebCore::ScriptProcessorNode::process):
+        (WebCore::ScriptProcessorNode::fireProcessEventDispatch): Deleted.
+        * Modules/webaudio/ScriptProcessorNode.h:
+        * Modules/webdatabase/DatabaseTracker.cpp:
+        (WebCore::DatabaseTracker::scheduleForNotification):
+        (WebCore::DatabaseTracker::notifyDatabasesChanged):
+        * Modules/webdatabase/DatabaseTracker.h:
+        * platform/graphics/cg/ImageCG.cpp:
+        (WebCore::patternReleaseCallback):
+        (WebCore::patternReleaseOnMainThreadCallback): Deleted.
+        * platform/graphics/cg/PatternCG.cpp:
+        (WebCore::patternReleaseCallback):
+        (WebCore::patternReleaseOnMainThreadCallback): Deleted.
+        * platform/graphics/mac/FontCacheMac.mm:
+        (WebCore::invalidateFontCache):
+        (WebCore::fontCacheRegisteredFontsChangedNotificationCallback):
+        * platform/network/BlobResourceHandle.cpp:
+        (WebCore::doNotifyFinish):
+        (WebCore::BlobResourceHandle::notifyFinish):
+        * platform/network/cf/FormDataStreamCFNet.cpp:
+        (WebCore::formFinalize):
+        (WebCore::formFinishFinalizationOnMainThread): Deleted.
+
 2015-08-21  Doug Russell  <[email protected]>
 
         AX: Table with CSS that makes a row anonymous can return NULL from cellForColumnAndRow

Modified: trunk/Source/WebCore/Modules/webaudio/AsyncAudioDecoder.cpp (188771 => 188772)


--- trunk/Source/WebCore/Modules/webaudio/AsyncAudioDecoder.cpp	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WebCore/Modules/webaudio/AsyncAudioDecoder.cpp	2015-08-21 20:50:59 UTC (rev 188772)
@@ -105,19 +105,11 @@
     m_audioBuffer = AudioBuffer::createFromAudioFileData(m_audioData->data(), m_audioData->byteLength(), false, sampleRate());
     
     // Decoding is finished, but we need to do the callbacks on the main thread.
-    callOnMainThread(notifyCompleteDispatch, this);
+    callOnMainThread([this] {
+        notifyComplete();
+    });
 }
 
-void AsyncAudioDecoder::DecodingTask::notifyCompleteDispatch(void* userData)
-{
-    AsyncAudioDecoder::DecodingTask* task = reinterpret_cast<AsyncAudioDecoder::DecodingTask*>(userData);
-    ASSERT(task);
-    if (!task)
-        return;
-
-    task->notifyComplete();
-}
-
 void AsyncAudioDecoder::DecodingTask::notifyComplete()
 {
     if (audioBuffer() && successCallback())

Modified: trunk/Source/WebCore/Modules/webaudio/AsyncAudioDecoder.h (188771 => 188772)


--- trunk/Source/WebCore/Modules/webaudio/AsyncAudioDecoder.h	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WebCore/Modules/webaudio/AsyncAudioDecoder.h	2015-08-21 20:50:59 UTC (rev 188772)
@@ -67,7 +67,6 @@
         AudioBufferCallback* errorCallback() { return m_errorCallback.get(); }
         AudioBuffer* audioBuffer() { return m_audioBuffer.get(); }
 
-        static void notifyCompleteDispatch(void* userData);
         void notifyComplete();
 
         RefPtr<JSC::ArrayBuffer> m_audioData;

Modified: trunk/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.cpp (188771 => 188772)


--- trunk/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.cpp	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.cpp	2015-08-21 20:50:59 UTC (rev 188772)
@@ -140,20 +140,12 @@
     }
     
     // Our work is done. Let the AudioContext know.
-    callOnMainThread(notifyCompleteDispatch, this);
+    callOnMainThread([this] {
+        notifyComplete();
+        deref();
+    });
 }
 
-void OfflineAudioDestinationNode::notifyCompleteDispatch(void* userData)
-{
-    OfflineAudioDestinationNode* destinationNode = static_cast<OfflineAudioDestinationNode*>(userData);
-    ASSERT(destinationNode);
-    if (!destinationNode)
-        return;
-
-    destinationNode->notifyComplete();
-    destinationNode->deref();
-}
-
 void OfflineAudioDestinationNode::notifyComplete()
 {
     context()->fireCompletionEvent();

Modified: trunk/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.h (188771 => 188772)


--- trunk/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.h	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.h	2015-08-21 20:50:59 UTC (rev 188772)
@@ -71,7 +71,6 @@
     void offlineRender();
     
     // For completion callback on main thread.
-    static void notifyCompleteDispatch(void* userData);
     void notifyComplete();
 };
 

Modified: trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp (188771 => 188772)


--- trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.cpp	2015-08-21 20:50:59 UTC (rev 188772)
@@ -210,26 +210,19 @@
             // Fire the event on the main thread, not this one (which is the realtime audio thread).
             m_doubleBufferIndexForEvent = m_doubleBufferIndex;
             m_isRequestOutstanding = true;
-            callOnMainThread(fireProcessEventDispatch, this);
+
+            callOnMainThread([this] {
+                fireProcessEvent();
+
+                // De-reference to match the ref() call in process().
+                deref();
+            });
         }
 
         swapBuffers();
     }
 }
 
-void ScriptProcessorNode::fireProcessEventDispatch(void* userData)
-{
-    ScriptProcessorNode* jsAudioNode = static_cast<ScriptProcessorNode*>(userData);
-    ASSERT(jsAudioNode);
-    if (!jsAudioNode)
-        return;
-
-    jsAudioNode->fireProcessEvent();
-
-    // De-reference to match the ref() call in process().
-    jsAudioNode->deref();
-}
-
 void ScriptProcessorNode::fireProcessEvent()
 {
     ASSERT(isMainThread() && m_isRequestOutstanding);

Modified: trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.h (188771 => 188772)


--- trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.h	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WebCore/Modules/webaudio/ScriptProcessorNode.h	2015-08-21 20:50:59 UTC (rev 188772)
@@ -71,7 +71,6 @@
 
     ScriptProcessorNode(AudioContext*, float sampleRate, size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputChannels);
 
-    static void fireProcessEventDispatch(void* userData);
     void fireProcessEvent();
 
     bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture) override;

Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp (188771 => 188772)


--- trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp	2015-08-21 20:50:59 UTC (rev 188772)
@@ -1359,12 +1359,14 @@
     ASSERT(!notificationMutex().tryLock());
 
     if (!notificationScheduled) {
-        callOnMainThread(DatabaseTracker::notifyDatabasesChanged, 0);
+        callOnMainThread([] {
+            notifyDatabasesChanged();
+        });
         notificationScheduled = true;
     }
 }
 
-void DatabaseTracker::notifyDatabasesChanged(void*)
+void DatabaseTracker::notifyDatabasesChanged()
 {
     // Note that if DatabaseTracker ever becomes non-singleton, we'll have to amend this notification
     // mechanism to include which tracker the notification goes out on as well.

Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h (188771 => 188772)


--- trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h	2015-08-21 20:50:59 UTC (rev 188772)
@@ -184,7 +184,7 @@
     void doneDeletingOrigin(SecurityOrigin*);
 
     static void scheduleForNotification();
-    static void notifyDatabasesChanged(void*);
+    static void notifyDatabasesChanged();
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/cg/ImageCG.cpp (188771 => 188772)


--- trunk/Source/WebCore/platform/graphics/cg/ImageCG.cpp	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageCG.cpp	2015-08-21 20:50:59 UTC (rev 188772)
@@ -78,14 +78,12 @@
     CGContextDrawImage(context, GraphicsContext(context).roundToDevicePixels(FloatRect(0, 0, CGImageGetWidth(image), height)), image);
 }
 
-static void patternReleaseOnMainThreadCallback(void* info)
-{
-    CGImageRelease((CGImageRef)info);
-}
-
 static void patternReleaseCallback(void* info)
 {
-    callOnMainThread(patternReleaseOnMainThreadCallback, info);
+    auto image = static_cast<CGImageRef>(info);
+    callOnMainThread([image] {
+        CGImageRelease(image);
+    });
 }
 
 void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const AffineTransform& patternTransform,

Modified: trunk/Source/WebCore/platform/graphics/cg/PatternCG.cpp (188771 => 188772)


--- trunk/Source/WebCore/platform/graphics/cg/PatternCG.cpp	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WebCore/platform/graphics/cg/PatternCG.cpp	2015-08-21 20:50:59 UTC (rev 188772)
@@ -54,14 +54,13 @@
     CGContextDrawImage(context, rect, platformImage);
 }
 
-static void patternReleaseOnMainThreadCallback(void* info)
-{
-    CGImageRelease(static_cast<CGImageRef>(info));
-}
-
 static void patternReleaseCallback(void* info)
 {
-    callOnMainThread(patternReleaseOnMainThreadCallback, info);
+    auto image = static_cast<CGImageRef>(info);
+
+    callOnMainThread([image] {
+        CGImageRelease(image);
+    });
 }
 
 CGPatternRef Pattern::createPlatformPattern(const AffineTransform& userSpaceTransformation) const

Modified: trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm (188771 => 188772)


--- trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm	2015-08-21 20:50:59 UTC (rev 188772)
@@ -416,13 +416,15 @@
     return font;
 }
 
-// The "void*" parameter makes the function match the prototype for callbacks from callOnMainThread.
-static void invalidateFontCache(void*)
+static void invalidateFontCache()
 {
     if (!isMainThread()) {
-        callOnMainThread(&invalidateFontCache, nullptr);
+        callOnMainThread([] {
+            invalidateFontCache();
+        });
         return;
     }
+
     FontCache::singleton().invalidate();
 
 #if !ENABLE(PLATFORM_FONT_LOOKUP)
@@ -434,7 +436,8 @@
 {
     ASSERT_UNUSED(observer, observer == &FontCache::singleton());
     ASSERT_UNUSED(name, CFEqual(name, kCTFontManagerRegisteredFontsChangedNotification));
-    invalidateFontCache(0);
+
+    invalidateFontCache();
 }
 
 void FontCache::platformInit()

Modified: trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp (188771 => 188772)


--- trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp	2015-08-21 20:50:59 UTC (rev 188772)
@@ -644,29 +644,31 @@
         client()->didFail(this, ResourceError(webKitBlobResourceDomain, errorCode, firstRequest().url(), String()));
 }
 
-static void doNotifyFinish(void* context)
+static void doNotifyFinish(BlobResourceHandle& handle)
 {
-    BlobResourceHandle* handle = static_cast<BlobResourceHandle*>(context);
-    if (!handle->aborted() && handle->client())
-        handle->client()->didFinishLoading(handle, 0);
+    if (handle.aborted())
+        return;
 
-    // Balance the ref() in BlobResourceHandle::notfyFinish().
-    handle->deref();
+    if (!handle.client())
+        return;
+
+    handle.client()->didFinishLoading(&handle, 0);
 }
 
 void BlobResourceHandle::notifyFinish()
 {
-    // Balanced in doNotifyFinish().
-    ref();
-
-    if (m_async) {
-        // Schedule to notify the client from a standalone function because the client might dispose the handle immediately from the callback function
-        // while we still have BlobResourceHandle calls in the stack.
-        callOnMainThread(doNotifyFinish, this);
+    if (!m_async) {
+        doNotifyFinish(*this);
         return;
     }
 
-    doNotifyFinish(this);
+    // Schedule to notify the client from a standalone function because the client might dispose the handle immediately from the callback function
+    // while we still have BlobResourceHandle calls in the stack.
+    RefPtr<BlobResourceHandle> handle(this);
+    callOnMainThread([handle] {
+        doNotifyFinish(*handle);
+    });
+
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp (188771 => 188772)


--- trunk/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp	2015-08-21 20:50:59 UTC (rev 188772)
@@ -207,20 +207,15 @@
     return newInfo;
 }
 
-static void formFinishFinalizationOnMainThread(void* context)
-{
-    auto* form = static_cast<FormStreamFields*>(context);
-
-    closeCurrentStream(form);
-    delete form;
-}
-
 static void formFinalize(CFReadStreamRef stream, void* context)
 {
     FormStreamFields* form = static_cast<FormStreamFields*>(context);
     ASSERT_UNUSED(stream, form->formStream == stream);
 
-    callOnMainThread(formFinishFinalizationOnMainThread, form);
+    callOnMainThread([form] {
+        closeCurrentStream(form);
+        delete form;
+    });
 }
 
 static Boolean formOpen(CFReadStreamRef, CFStreamError* error, Boolean* openComplete, void* context)

Modified: trunk/Source/WebKit/mac/ChangeLog (188771 => 188772)


--- trunk/Source/WebKit/mac/ChangeLog	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WebKit/mac/ChangeLog	2015-08-21 20:50:59 UTC (rev 188772)
@@ -1,3 +1,18 @@
+2015-08-21  Anders Carlsson  <[email protected]>
+
+        Get rid of uses of the old callOnMainThread function that takes a function ptr + context
+        https://bugs.webkit.org/show_bug.cgi?id=148324
+
+        Reviewed by Tim Horton.
+
+        * Storage/WebDatabaseManagerClient.mm:
+        (DidModifyOriginData::dispatchToMainThread):
+        (DidModifyOriginData::dispatchDidModifyOriginOnMainThread): Deleted.
+        * Storage/WebStorageTrackerClient.h:
+        * Storage/WebStorageTrackerClient.mm:
+        (WebStorageTrackerClient::dispatchDidModifyOrigin):
+        (WebStorageTrackerClient::dispatchDidModifyOriginOnMainThread): Deleted.
+
 2015-08-19  Eric Carlson  <[email protected]>
 
         Remove ENABLE_WEBVTT_REGIONS

Modified: trunk/Source/WebKit/mac/Storage/WebDatabaseManagerClient.mm (188771 => 188772)


--- trunk/Source/WebKit/mac/Storage/WebDatabaseManagerClient.mm	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WebKit/mac/Storage/WebDatabaseManagerClient.mm	2015-08-21 20:50:59 UTC (rev 188772)
@@ -104,7 +104,10 @@
     static void dispatchToMainThread(WebDatabaseManagerClient* client, SecurityOrigin* origin)
     {
         DidModifyOriginData* context = new DidModifyOriginData(client, origin->isolatedCopy());
-        callOnMainThread(&DidModifyOriginData::dispatchDidModifyOriginOnMainThread, context);
+        callOnMainThread([context] {
+            context->client->dispatchDidModifyOrigin(context->origin.get());
+            delete context;
+        });
     }
 
 private:
@@ -114,14 +117,6 @@
     {
     }
 
-    static void dispatchDidModifyOriginOnMainThread(void* context)
-    {
-        ASSERT(isMainThread());
-        DidModifyOriginData* info = static_cast<DidModifyOriginData*>(context);
-        info->client->dispatchDidModifyOrigin(info->origin.get());
-        delete info;
-    }
-
     WebDatabaseManagerClient* client;
     RefPtr<SecurityOrigin> origin;
 };

Modified: trunk/Source/WebKit/mac/Storage/WebStorageTrackerClient.h (188771 => 188772)


--- trunk/Source/WebKit/mac/Storage/WebStorageTrackerClient.h	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WebKit/mac/Storage/WebStorageTrackerClient.h	2015-08-21 20:50:59 UTC (rev 188772)
@@ -31,7 +31,6 @@
 class WebStorageTrackerClient : public WebCore::StorageTrackerClient {
 public:
     static WebStorageTrackerClient* sharedWebStorageTrackerClient();
-    static void dispatchDidModifyOriginOnMainThread(void* context);
     
     virtual ~WebStorageTrackerClient();
     virtual void dispatchDidModifyOrigin(const String& originIdentifier) override;

Modified: trunk/Source/WebKit/mac/Storage/WebStorageTrackerClient.mm (188771 => 188772)


--- trunk/Source/WebKit/mac/Storage/WebStorageTrackerClient.mm	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WebKit/mac/Storage/WebStorageTrackerClient.mm	2015-08-21 20:50:59 UTC (rev 188772)
@@ -48,14 +48,6 @@
 {
 }
 
-void WebStorageTrackerClient::dispatchDidModifyOriginOnMainThread(void* context)
-{
-    ASSERT(isMainThread());
-    // adoptRef is balanced by leakRef in dispatchDidModifyOrigin.
-    RefPtr<SecurityOrigin> origin = adoptRef(static_cast<SecurityOrigin*>(context));
-    WebStorageTrackerClient::sharedWebStorageTrackerClient()->dispatchDidModifyOrigin(origin.get());
-}
-
 void WebStorageTrackerClient::dispatchDidModifyOrigin(PassRefPtr<SecurityOrigin> origin)
 {
     RetainPtr<WebSecurityOrigin> webSecurityOrigin = adoptNS([[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin.get()]);
@@ -68,13 +60,14 @@
 {
     RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromDatabaseIdentifier(originIdentifier);
 
-    if (!isMainThread()) {
-        // leakRef is balanced by adoptRef in dispatchDidModifyOriginOnMainThread.
-        callOnMainThread(dispatchDidModifyOriginOnMainThread, origin.leakRef());
+    if (isMainThread()) {
+        dispatchDidModifyOrigin(origin);
         return;
     }
 
-    dispatchDidModifyOrigin(origin);
+    callOnMainThread([origin] {
+        WebStorageTrackerClient::sharedWebStorageTrackerClient()->dispatchDidModifyOrigin(origin.get());
+    });
 }
 
 void WebStorageTrackerClient::didFinishLoadingOrigins()

Modified: trunk/Source/WebKit2/ChangeLog (188771 => 188772)


--- trunk/Source/WebKit2/ChangeLog	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WebKit2/ChangeLog	2015-08-21 20:50:59 UTC (rev 188772)
@@ -1,3 +1,14 @@
+2015-08-21  Anders Carlsson  <[email protected]>
+
+        Get rid of uses of the old callOnMainThread function that takes a function ptr + context
+        https://bugs.webkit.org/show_bug.cgi?id=148324
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/mac/WKPrintingView.mm:
+        (prepareDataForPrintingOnSecondaryThread):
+        (-[WKPrintingView knowsPageRange:]):
+
 2015-08-21  Chris Dumez  <[email protected]>
 
         Regression(r188698): http/tests/cache/disk-cache/disk-cache-revalidation-new-expire-header.html is very flaky

Modified: trunk/Source/WebKit2/UIProcess/mac/WKPrintingView.mm (188771 => 188772)


--- trunk/Source/WebKit2/UIProcess/mac/WKPrintingView.mm	2015-08-21 20:48:59 UTC (rev 188771)
+++ trunk/Source/WebKit2/UIProcess/mac/WKPrintingView.mm	2015-08-21 20:50:59 UTC (rev 188772)
@@ -352,11 +352,10 @@
     return YES;
 }
 
-static void prepareDataForPrintingOnSecondaryThread(void* untypedContext)
+static void prepareDataForPrintingOnSecondaryThread(WKPrintingView *view)
 {
     ASSERT(RunLoop::isMain());
 
-    WKPrintingView *view = static_cast<WKPrintingView *>(untypedContext);
     std::lock_guard<Lock> lock(view->_printingCallbackMutex);
 
     // We may have received page rects while a message to call this function traveled from secondary thread to main one.
@@ -396,7 +395,11 @@
     else if (!RunLoop::isMain()) {
         ASSERT(![self _isPrintingPreview]);
         std::unique_lock<Lock> lock(_printingCallbackMutex);
-        callOnMainThread(prepareDataForPrintingOnSecondaryThread, self);
+
+        RunLoop::main().dispatch([self] {
+            prepareDataForPrintingOnSecondaryThread(self);
+        });
+
         _printingCallbackCondition.wait(lock);
         *range = NSMakeRange(1, _printingPageRects.size());
     } else {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to