Title: [138464] trunk/Source/WebKit2
Revision
138464
Author
[email protected]
Date
2012-12-25 13:06:59 -0800 (Tue, 25 Dec 2012)

Log Message

[WK2][Mac] Call Carbon resource APIs on main thread only.
<rdar://problem/11760262>
<http://webkit.org/b/105746>

Reviewed by Anders Carlsson.

The Carbon resource APIs are not thread-safe, so use a little libdispatch sugar to make
sure that plugin enumeration never calls them on a secondary thread.

* Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
(WebKit::getPluginInfoFromCarbonResourcesOnMainThread):
(WebKit::getPluginInfoFromCarbonResources):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (138463 => 138464)


--- trunk/Source/WebKit2/ChangeLog	2012-12-25 17:08:17 UTC (rev 138463)
+++ trunk/Source/WebKit2/ChangeLog	2012-12-25 21:06:59 UTC (rev 138464)
@@ -1,3 +1,18 @@
+2012-12-25  Andreas Kling  <[email protected]>
+
+        [WK2][Mac] Call Carbon resource APIs on main thread only.
+        <rdar://problem/11760262>
+        <http://webkit.org/b/105746>
+
+        Reviewed by Anders Carlsson.
+
+        The Carbon resource APIs are not thread-safe, so use a little libdispatch sugar to make
+        sure that plugin enumeration never calls them on a secondary thread.
+
+        * Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm:
+        (WebKit::getPluginInfoFromCarbonResourcesOnMainThread):
+        (WebKit::getPluginInfoFromCarbonResources):
+
 2012-12-25  Seokju Kwon  <[email protected]>
 
         [EFL][WK2] Build breaks with --no-input-type-color

Modified: trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm (138463 => 138464)


--- trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm	2012-12-25 17:08:17 UTC (rev 138463)
+++ trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm	2012-12-25 21:06:59 UTC (rev 138464)
@@ -31,8 +31,8 @@
 #import "PluginProcessProxy.h"
 #import <WebCore/WebCoreNSStringExtras.h>
 #import <wtf/HashSet.h>
+#import <wtf/MainThread.h>
 
-
 using namespace WebCore;
 
 namespace WebKit {
@@ -296,8 +296,10 @@
 static const ResID MIMEDescriptionStringNumber = 127;
 static const ResID MIMEListStringStringNumber = 128;
 
-static bool getPluginInfoFromCarbonResources(CFBundleRef bundle, PluginModuleInfo& plugin)
+static bool getPluginInfoFromCarbonResourcesOnMainThread(CFBundleRef bundle, PluginModuleInfo& plugin)
 {
+    ASSERT(isMainThread());
+
     ResourceMap resourceMap(bundle);
     if (!resourceMap.isValid())
         return false;
@@ -350,6 +352,15 @@
     return true;
 }
 
+static bool getPluginInfoFromCarbonResources(CFBundleRef bundle, PluginModuleInfo& plugin)
+{
+    __block bool gotPluginInfo = false;
+    dispatch_sync(dispatch_get_main_queue(), ^{
+        gotPluginInfo = getPluginInfoFromCarbonResourcesOnMainThread(bundle, const_cast<PluginModuleInfo&>(plugin));
+    });
+    return gotPluginInfo;
+}
+
 bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginModuleInfo& plugin)
 {
     RetainPtr<CFURLRef> bundleURL = adoptCF(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, pluginPath.createCFString().get(), kCFURLPOSIXPathStyle, false));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to