[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

commit-queue at webkit.org commit-queue at webkit.org
Mon Feb 21 00:37:12 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 8a4d97fed0303a1e33cf86de5fddb117a1d56eef
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Feb 2 08:24:08 2011 +0000

    2011-02-02  Dai Mikurube  <dmikurube at google.com>
    
            Reviewed by David Levin.
    
            Make mime type lookup in File::create(path) thread-safe
            https://bugs.webkit.org/show_bug.cgi?id=47700
    
            This patch introduces a new function MIMETypeRegistry::getMIMETypeForExtensionThreadSafe().
            The function is to be called as a thread-safe version of getMIMETypeForExtension() when
            both FILE_SYSTEM and WORKERS are enabled.
    
            No tests for this patch. This patch itself doesn't change the behaviors.
            For Chromium, it runs in the same way with getMIMETypeForExtensionThreadSafe().
            For the other platforms, it causes compilation error in case of enabled FILE_SYSTEM and WORKERS.
            The compilation error would be a signal to implement getMIMETypeForExtensionThreadSafe() in these
            platforms. Currently it doesn't happen since FILE_SYSTEM is not available in the other platforms.
    
            * platform/MIMETypeRegistry.cpp: Defined generic getMIMETypeForExtension() calling getMIMETypeForExtensionThreadSafe() for enabled FILE_SYSTEM and WORKERS.
            (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
            * platform/MIMETypeRegistry.h: Declared getMIMETypeForExtensionThreadSafe() which should be implemented for each platform.
            * platform/android/TemporaryLinkStubs.cpp:
            (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
            * platform/brew/MIMETypeRegistryBrew.cpp:
            (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
            * platform/chromium/MIMETypeRegistryChromium.cpp: Defined getMIMETypeForExtensionThreadSafe() for the case when FILE_SYSTEM and WORKERS are enabled.
            (WebCore::MIMETypeRegistry::getMIMETypeForExtensionThreadSafe):
            * platform/efl/MIMETypeRegistryEfl.cpp:
            (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
            * platform/gtk/MIMETypeRegistryGtk.cpp:
            (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
            * platform/haiku/MIMETypeRegistryHaiku.cpp:
            (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
            * platform/mac/MIMETypeRegistryMac.mm:
            (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
            * platform/qt/MIMETypeRegistryQt.cpp:
            (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
            * platform/win/MIMETypeRegistryWin.cpp:
            (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
            * platform/wince/MIMETypeRegistryWinCE.cpp:
            (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
            * platform/wx/MimeTypeRegistryWx.cpp:
            (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77368 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index b4ab02f..a8194a2 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,46 @@
+2011-02-02  Dai Mikurube  <dmikurube at google.com>
+
+        Reviewed by David Levin.
+
+        Make mime type lookup in File::create(path) thread-safe
+        https://bugs.webkit.org/show_bug.cgi?id=47700
+
+        This patch introduces a new function MIMETypeRegistry::getMIMETypeForExtensionThreadSafe().
+        The function is to be called as a thread-safe version of getMIMETypeForExtension() when
+        both FILE_SYSTEM and WORKERS are enabled.
+
+        No tests for this patch. This patch itself doesn't change the behaviors.
+        For Chromium, it runs in the same way with getMIMETypeForExtensionThreadSafe().
+        For the other platforms, it causes compilation error in case of enabled FILE_SYSTEM and WORKERS.
+        The compilation error would be a signal to implement getMIMETypeForExtensionThreadSafe() in these
+        platforms. Currently it doesn't happen since FILE_SYSTEM is not available in the other platforms.
+
+        * platform/MIMETypeRegistry.cpp: Defined generic getMIMETypeForExtension() calling getMIMETypeForExtensionThreadSafe() for enabled FILE_SYSTEM and WORKERS.
+        (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
+        * platform/MIMETypeRegistry.h: Declared getMIMETypeForExtensionThreadSafe() which should be implemented for each platform.
+        * platform/android/TemporaryLinkStubs.cpp:
+        (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
+        * platform/brew/MIMETypeRegistryBrew.cpp:
+        (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
+        * platform/chromium/MIMETypeRegistryChromium.cpp: Defined getMIMETypeForExtensionThreadSafe() for the case when FILE_SYSTEM and WORKERS are enabled.
+        (WebCore::MIMETypeRegistry::getMIMETypeForExtensionThreadSafe):
+        * platform/efl/MIMETypeRegistryEfl.cpp:
+        (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
+        * platform/gtk/MIMETypeRegistryGtk.cpp:
+        (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
+        * platform/haiku/MIMETypeRegistryHaiku.cpp:
+        (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
+        * platform/mac/MIMETypeRegistryMac.mm:
+        (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
+        * platform/qt/MIMETypeRegistryQt.cpp:
+        (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
+        * platform/win/MIMETypeRegistryWin.cpp:
+        (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
+        * platform/wince/MIMETypeRegistryWinCE.cpp:
+        (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
+        * platform/wx/MimeTypeRegistryWx.cpp:
+        (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
+
 2011-02-01  Adam Barth  <abarth at webkit.org>
 
         Reviewed by Alexey Proskuryakov.
diff --git a/Source/WebCore/platform/MIMETypeRegistry.cpp b/Source/WebCore/platform/MIMETypeRegistry.cpp
index f3cccc0..713395b 100644
--- a/Source/WebCore/platform/MIMETypeRegistry.cpp
+++ b/Source/WebCore/platform/MIMETypeRegistry.cpp
@@ -343,6 +343,13 @@ static MediaMIMETypeMap& mediaMIMETypeMap()
     return mediaMIMETypeForExtensionMap;
 }
 
+#if ENABLE(FILE_SYSTEM) && ENABLE(WORKERS)
+String MIMETypeRegistry::getMIMETypeForExtension(const String& extension)
+{
+    return getMIMETypeForExtensionThreadSafe(extension);
+}
+#endif
+
 String MIMETypeRegistry::getMediaMIMETypeForExtension(const String& ext)
 {
     // Look in the system-specific registry first.
diff --git a/Source/WebCore/platform/MIMETypeRegistry.h b/Source/WebCore/platform/MIMETypeRegistry.h
index 64abea8..d069035 100644
--- a/Source/WebCore/platform/MIMETypeRegistry.h
+++ b/Source/WebCore/platform/MIMETypeRegistry.h
@@ -36,6 +36,9 @@ namespace WebCore {
 class MIMETypeRegistry {
 public:
     static String getMIMETypeForExtension(const String& extension);
+#if ENABLE(FILE_SYSTEM) && ENABLE(WORKERS)
+    static String getMIMETypeForExtensionThreadSafe(const String& extension);
+#endif
     static Vector<String> getExtensionsForMIMEType(const String& type);
     static String getPreferredExtensionForMIMEType(const String& type);
     static String getMediaMIMETypeForExtension(const String& extension);
diff --git a/Source/WebCore/platform/android/TemporaryLinkStubs.cpp b/Source/WebCore/platform/android/TemporaryLinkStubs.cpp
index 1c4233a..4ede7e5 100644
--- a/Source/WebCore/platform/android/TemporaryLinkStubs.cpp
+++ b/Source/WebCore/platform/android/TemporaryLinkStubs.cpp
@@ -77,6 +77,8 @@
 #include "Widget.h"
 #include <stdio.h>
 #include <stdlib.h>
+#include <wtf/Assertions.h>
+#include <wtf/MainThread.h>
 #include <wtf/text/CString.h>
 
 #if USE(JSC)
@@ -306,6 +308,7 @@ void* WebCore::Frame::dragImageForSelection()
 
 WTF::String WebCore::MIMETypeRegistry::getMIMETypeForExtension(WTF::String const&)
 {
+    ASSERT(isMainThread());
     return WTF::String();
 }
 
diff --git a/Source/WebCore/platform/brew/MIMETypeRegistryBrew.cpp b/Source/WebCore/platform/brew/MIMETypeRegistryBrew.cpp
index 0a538c2..eae4e3b 100644
--- a/Source/WebCore/platform/brew/MIMETypeRegistryBrew.cpp
+++ b/Source/WebCore/platform/brew/MIMETypeRegistryBrew.cpp
@@ -30,6 +30,8 @@
 #include "MIMETypeRegistry.h"
 
 #include "PlatformString.h"
+#include <wtf/Assertions.h>
+#include <wtf/MainThread.h>
 
 namespace WebCore {
 
@@ -63,6 +65,8 @@ static const ExtensionMap extensionMap[] = {
 
 String MIMETypeRegistry::getMIMETypeForExtension(const String &ext)
 {
+    ASSERT(isMainThread());
+
     String str = ext.lower();
 
     const ExtensionMap* e = extensionMap;
diff --git a/Source/WebCore/platform/chromium/MIMETypeRegistryChromium.cpp b/Source/WebCore/platform/chromium/MIMETypeRegistryChromium.cpp
index fec0e9b..91bfccb 100644
--- a/Source/WebCore/platform/chromium/MIMETypeRegistryChromium.cpp
+++ b/Source/WebCore/platform/chromium/MIMETypeRegistryChromium.cpp
@@ -42,6 +42,17 @@
 
 namespace WebCore {
 
+#if ENABLE(FILE_SYSTEM) && ENABLE(WORKERS)
+String MIMETypeRegistry::getMIMETypeForExtensionThreadSafe(const String &ext)
+{
+    return PlatformBridge::mimeTypeForExtension(ext);
+}
+#endif
+
+// NOTE: We have to define getMIMETypeForExtension() here though the shared
+// implementation has getMIMETypeForExtension() since we don't use the shared
+// implementation bits in MIMETypeRegistry.cpp.
+
 String MIMETypeRegistry::getMIMETypeForExtension(const String &ext)
 {
     return PlatformBridge::mimeTypeForExtension(ext);
diff --git a/Source/WebCore/platform/efl/MIMETypeRegistryEfl.cpp b/Source/WebCore/platform/efl/MIMETypeRegistryEfl.cpp
index d0c95bf..d883e5d 100644
--- a/Source/WebCore/platform/efl/MIMETypeRegistryEfl.cpp
+++ b/Source/WebCore/platform/efl/MIMETypeRegistryEfl.cpp
@@ -31,6 +31,9 @@
 #include "config.h"
 #include "MIMETypeRegistry.h"
 
+#include <wtf/Assertions.h>
+#include <wtf/MainThread.h>
+
 namespace WebCore {
 
 struct ExtensionMap {
@@ -72,6 +75,8 @@ static const ExtensionMap extensionMap[] = {
 
 String MIMETypeRegistry::getMIMETypeForExtension(const String &ext)
 {
+    ASSERT(isMainThread());
+
     String s = ext.lower();
     const ExtensionMap *e = extensionMap;
     while (e->extension) {
diff --git a/Source/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp b/Source/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp
index 8fc3020..9f7f14c 100644
--- a/Source/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp
+++ b/Source/WebCore/platform/gtk/MIMETypeRegistryGtk.cpp
@@ -28,6 +28,9 @@
 #include "config.h"
 #include "MIMETypeRegistry.h"
 
+#include <wtf/Assertions.h>
+#include <wtf/MainThread.h>
+
 namespace WebCore {
 
 struct ExtensionMap {
@@ -62,6 +65,8 @@ static const ExtensionMap extensionMap [] = {
 
 String MIMETypeRegistry::getMIMETypeForExtension(const String &ext)
 {
+    ASSERT(isMainThread());
+
     String s = ext.lower();
     const ExtensionMap *e = extensionMap;
     while (e->extension) {
diff --git a/Source/WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp b/Source/WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp
index 685827e..3cfddf9 100644
--- a/Source/WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp
+++ b/Source/WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp
@@ -31,6 +31,8 @@
 
 #include "PlatformString.h"
 #include <MimeType.h>
+#include <wtf/Assertions.h>
+#include <wtf/MainThread.h>
 #include <wtf/text/CString.h>
 
 namespace WebCore {
@@ -62,6 +64,8 @@ static const ExtensionMap extensionMap[] = {
 
 String MIMETypeRegistry::getMIMETypeForExtension(const String& ext)
 {
+    ASSERT(isMainThread());
+
     String str = ext.lower();
 
     // Try WebCore built-in types.
diff --git a/Source/WebCore/platform/mac/MIMETypeRegistryMac.mm b/Source/WebCore/platform/mac/MIMETypeRegistryMac.mm
index 82348e0..3792b5a 100644
--- a/Source/WebCore/platform/mac/MIMETypeRegistryMac.mm
+++ b/Source/WebCore/platform/mac/MIMETypeRegistryMac.mm
@@ -28,12 +28,15 @@
 #include "MIMETypeRegistry.h"
 
 #include "WebCoreSystemInterface.h"
+#include <wtf/Assertions.h>
+#include <wtf/MainThread.h>
 
 namespace WebCore 
 {
 
 String MIMETypeRegistry::getMIMETypeForExtension(const String &ext)
 {
+    ASSERT(isMainThread());
     return wkGetMIMETypeForExtension(ext);
 }
 
diff --git a/Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp b/Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp
index 12db891..01cef12 100644
--- a/Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp
+++ b/Source/WebCore/platform/qt/MIMETypeRegistryQt.cpp
@@ -29,6 +29,9 @@
 #include "config.h"
 #include "MIMETypeRegistry.h"
 
+#include <wtf/Assertions.h>
+#include <wtf/MainThread.h>
+
 namespace WebCore {
 
 struct ExtensionMap {
@@ -70,6 +73,8 @@ static const ExtensionMap extensionMap[] = {
 
 String MIMETypeRegistry::getMIMETypeForExtension(const String &ext)
 {
+    ASSERT(isMainThread());
+
     String s = ext.lower();
 
     const ExtensionMap *e = extensionMap;
diff --git a/Source/WebCore/platform/win/MIMETypeRegistryWin.cpp b/Source/WebCore/platform/win/MIMETypeRegistryWin.cpp
index 980742a..56ddab1 100644
--- a/Source/WebCore/platform/win/MIMETypeRegistryWin.cpp
+++ b/Source/WebCore/platform/win/MIMETypeRegistryWin.cpp
@@ -27,7 +27,9 @@
 #include "MIMETypeRegistry.h"
 
 #include <shlwapi.h>
+#include <wtf/Assertions.h>
 #include <wtf/HashMap.h>
+#include <wtf/MainThread.h>
 
 namespace WebCore 
 {
@@ -64,6 +66,8 @@ String MIMETypeRegistry::getPreferredExtensionForMIMEType(const String& type)
 
 String MIMETypeRegistry::getMIMETypeForExtension(const String &ext)
 {
+    ASSERT(isMainThread());
+
     if (ext.isEmpty())
         return String();
 
diff --git a/Source/WebCore/platform/wince/MIMETypeRegistryWinCE.cpp b/Source/WebCore/platform/wince/MIMETypeRegistryWinCE.cpp
index 7534b91..8a7ac8f 100644
--- a/Source/WebCore/platform/wince/MIMETypeRegistryWinCE.cpp
+++ b/Source/WebCore/platform/wince/MIMETypeRegistryWinCE.cpp
@@ -27,7 +27,9 @@
 #include "config.h"
 #include "MIMETypeRegistry.h"
 
+#include <wtf/Assertions.h>
 #include <wtf/HashMap.h>
+#include <wtf/MainThread.h>
 #include <windows.h>
 #include <winreg.h>
 
@@ -119,6 +121,8 @@ String MIMETypeRegistry::getPreferredExtensionForMIMEType(const String& type)
 
 String MIMETypeRegistry::getMIMETypeForExtension(const String &ext)
 {
+    ASSERT(isMainThread());
+
     if (ext.isEmpty())
         return String();
 
diff --git a/Source/WebCore/platform/wx/MimeTypeRegistryWx.cpp b/Source/WebCore/platform/wx/MimeTypeRegistryWx.cpp
index e7cc0e2..94a815e 100644
--- a/Source/WebCore/platform/wx/MimeTypeRegistryWx.cpp
+++ b/Source/WebCore/platform/wx/MimeTypeRegistryWx.cpp
@@ -28,6 +28,9 @@
 #include "config.h"
 #include "MIMETypeRegistry.h"
 
+#include <wtf/Assertions.h>
+#include <wtf/MainThread.h>
+
 namespace WebCore {
 
 struct ExtensionMap {
@@ -59,6 +62,8 @@ static const ExtensionMap extensionMap [] = {
     
 String MIMETypeRegistry::getMIMETypeForExtension(const String &ext)
 {
+    ASSERT(isMainThread());
+
     String s = ext.lower();
     const ExtensionMap *e = extensionMap;
     while (e->extension) {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list