Title: [97020] branches/chromium/874

Diff

Copied: branches/chromium/874/LayoutTests/fast/workers/worker-multi-startup-expected.txt (from rev 96999, trunk/LayoutTests/fast/workers/worker-multi-startup-expected.txt) (0 => 97020)


--- branches/chromium/874/LayoutTests/fast/workers/worker-multi-startup-expected.txt	                        (rev 0)
+++ branches/chromium/874/LayoutTests/fast/workers/worker-multi-startup-expected.txt	2011-10-09 04:23:57 UTC (rev 97020)
@@ -0,0 +1,34 @@
+Test that multipe workers can be spawned simultaneously. Should print "DONE" when done.
+
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+SUCCESS: Worker context initialized
+DONE
+

Copied: branches/chromium/874/LayoutTests/fast/workers/worker-multi-startup.html (from rev 96999, trunk/LayoutTests/fast/workers/worker-multi-startup.html) (0 => 97020)


--- branches/chromium/874/LayoutTests/fast/workers/worker-multi-startup.html	                        (rev 0)
+++ branches/chromium/874/LayoutTests/fast/workers/worker-multi-startup.html	2011-10-09 04:23:57 UTC (rev 97020)
@@ -0,0 +1,31 @@
+<head>
+<p>Test that multipe workers can be spawned simultaneously.
+Should print "DONE" when done.</p>
+<div id=result></div>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+function log(message)
+{
+    document.getElementById("result").innerHTML += message + "<br>";
+}
+
+totalWorkers = 30;
+replies = 0;
+
+for (var i = 0; i < totalWorkers; i++) {
+    var worker = new Worker('resources/worker-init.js');
+    worker._onmessage_ = function(evt) {
+        log(evt.data);
+        if (++replies < totalWorkers)
+            return;
+        log("DONE");
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    }
+}
+</script>
+</body>

Modified: branches/chromium/874/Source/WebCore/dom/DOMImplementation.cpp (97019 => 97020)


--- branches/chromium/874/Source/WebCore/dom/DOMImplementation.cpp	2011-10-09 04:19:01 UTC (rev 97019)
+++ branches/chromium/874/Source/WebCore/dom/DOMImplementation.cpp	2011-10-09 04:23:57 UTC (rev 97020)
@@ -48,6 +48,7 @@
 #include "RegularExpression.h"
 #include "Settings.h"
 #include "TextDocument.h"
+#include "ThreadGlobalData.h"
 #include "XMLNames.h"
 #include <wtf/StdLibExtras.h>
 
@@ -272,13 +273,27 @@
     return sheet.release();
 }
 
+static const char* const validXMLMIMETypeChars = "[0-9a-zA-Z_\\-+~!$\\^{}|.%'`#&*]"; // per RFCs: 3023, 2045
+
+XMLMIMETypeRegExp::XMLMIMETypeRegExp() :
+    m_regex(adoptPtr(new RegularExpression(WTF::makeString("^", validXMLMIMETypeChars, "+/", validXMLMIMETypeChars, "+\\+xml$"), TextCaseSensitive)))
+{
+}
+
+XMLMIMETypeRegExp::~XMLMIMETypeRegExp()
+{
+}
+
+bool XMLMIMETypeRegExp::isXMLMIMEType(const String& mimeType)
+{
+    return m_regex->match(mimeType) > -1;
+}
+
 bool DOMImplementation::isXMLMIMEType(const String& mimeType)
 {
     if (mimeType == "text/xml" || mimeType == "application/xml" || mimeType == "text/xsl")
         return true;
-    static const char* const validChars = "[0-9a-zA-Z_\\-+~!$\\^{}|.%'`#&*]"; // per RFCs: 3023, 2045
-    DEFINE_STATIC_LOCAL(RegularExpression, xmlTypeRegExp, (String("^") + validChars + "+/" + validChars + "+\\+xml$", TextCaseSensitive));
-    return xmlTypeRegExp.match(mimeType) > -1;
+    return threadGlobalData().xmlTypeRegExp().isXMLMIMEType(mimeType);
 }
 
 bool DOMImplementation::isTextMIMEType(const String& mimeType)

Modified: branches/chromium/874/Source/WebCore/dom/DOMImplementation.h (97019 => 97020)


--- branches/chromium/874/Source/WebCore/dom/DOMImplementation.h	2011-10-09 04:19:01 UTC (rev 97019)
+++ branches/chromium/874/Source/WebCore/dom/DOMImplementation.h	2011-10-09 04:23:57 UTC (rev 97020)
@@ -37,6 +37,7 @@
 class Frame;
 class HTMLDocument;
 class KURL;
+class RegularExpression;
 
 typedef int ExceptionCode;
 
@@ -73,6 +74,18 @@
     Document* m_document;
 };
 
+class XMLMIMETypeRegExp {
+public:
+    XMLMIMETypeRegExp();
+    ~XMLMIMETypeRegExp();
+    bool isXMLMIMEType(const String& mimeType);
+
+    WTF_MAKE_NONCOPYABLE(XMLMIMETypeRegExp);
+private:
+    OwnPtr<RegularExpression> m_regex;
+};
+
+
 } // namespace WebCore
 
 #endif

Modified: branches/chromium/874/Source/WebCore/platform/ThreadGlobalData.cpp (97019 => 97020)


--- branches/chromium/874/Source/WebCore/platform/ThreadGlobalData.cpp	2011-10-09 04:19:01 UTC (rev 97019)
+++ branches/chromium/874/Source/WebCore/platform/ThreadGlobalData.cpp	2011-10-09 04:23:57 UTC (rev 97020)
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "ThreadGlobalData.h"
 
+#include "DOMImplementation.h"
 #include "EventNames.h"
 #include "ThreadTimers.h"
 #include <wtf/MainThread.h>
@@ -59,6 +60,7 @@
 ThreadGlobalData::ThreadGlobalData()
     : m_eventNames(new EventNames)
     , m_threadTimers(new ThreadTimers)
+    , m_xmlTypeRegExp(new XMLMIMETypeRegExp)
 #ifndef NDEBUG
     , m_isMainThread(isMainThread())
 #endif
@@ -98,6 +100,8 @@
     m_eventNames = 0;
     delete m_threadTimers;
     m_threadTimers = 0;
+    delete m_xmlTypeRegExp;
+    m_xmlTypeRegExp = 0;
 }
 
 } // namespace WebCore

Modified: branches/chromium/874/Source/WebCore/platform/ThreadGlobalData.h (97019 => 97020)


--- branches/chromium/874/Source/WebCore/platform/ThreadGlobalData.h	2011-10-09 04:19:01 UTC (rev 97019)
+++ branches/chromium/874/Source/WebCore/platform/ThreadGlobalData.h	2011-10-09 04:23:57 UTC (rev 97020)
@@ -43,6 +43,7 @@
 
     class EventNames;
     class ThreadTimers;
+    class XMLMIMETypeRegExp;
 
     struct ICUConverterWrapper;
     struct TECConverterWrapper;
@@ -56,6 +57,7 @@
 
         EventNames& eventNames() { return *m_eventNames; }
         ThreadTimers& threadTimers() { return *m_threadTimers; }
+        XMLMIMETypeRegExp& xmlTypeRegExp() { return *m_xmlTypeRegExp; }
 
 #if USE(ICU_UNICODE)
         ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; }
@@ -68,6 +70,7 @@
     private:
         EventNames* m_eventNames;
         ThreadTimers* m_threadTimers;
+        XMLMIMETypeRegExp* m_xmlTypeRegExp;
 
 #ifndef NDEBUG
         bool m_isMainThread;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to