Title: [211360] trunk/Source/WebCore
Revision
211360
Author
[email protected]
Date
2017-01-30 02:14:36 -0800 (Mon, 30 Jan 2017)

Log Message

Several web timing tests crash in GTK+ and AppleWin bots
https://bugs.webkit.org/show_bug.cgi?id=167577

Reviewed by Ryosuke Niwa.

The problem is that entry is used in both the key, to get name, and in the value with WTFMove. So, the name is
invalidated by the move. It could be fixed by simply copying the name, instead of using entry->name, but I think
that code could be simplified using HashMap::ensure and then we don't need any string copy, nor even the static
insertPerformanceEntry().

Fix crashes in several imported/w3c/web-platform-tests/user-timing/ tests.

* page/PerformanceUserTiming.cpp:
(WebCore::UserTiming::mark):
(WebCore::UserTiming::measure):
(WebCore::insertPerformanceEntry): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (211359 => 211360)


--- trunk/Source/WebCore/ChangeLog	2017-01-30 10:10:40 UTC (rev 211359)
+++ trunk/Source/WebCore/ChangeLog	2017-01-30 10:14:36 UTC (rev 211360)
@@ -1,5 +1,24 @@
 2017-01-30  Carlos Garcia Campos  <[email protected]>
 
+        Several web timing tests crash in GTK+ and AppleWin bots
+        https://bugs.webkit.org/show_bug.cgi?id=167577
+
+        Reviewed by Ryosuke Niwa.
+
+        The problem is that entry is used in both the key, to get name, and in the value with WTFMove. So, the name is
+        invalidated by the move. It could be fixed by simply copying the name, instead of using entry->name, but I think
+        that code could be simplified using HashMap::ensure and then we don't need any string copy, nor even the static
+        insertPerformanceEntry().
+
+        Fix crashes in several imported/w3c/web-platform-tests/user-timing/ tests.
+
+        * page/PerformanceUserTiming.cpp:
+        (WebCore::UserTiming::mark):
+        (WebCore::UserTiming::measure):
+        (WebCore::insertPerformanceEntry): Deleted.
+
+2017-01-30  Carlos Garcia Campos  <[email protected]>
+
         [Threaded Compositor] Crash in GraphicsContext3D::deleteTexture when destroying TextureMapperPlatformLayerProxy
         https://bugs.webkit.org/show_bug.cgi?id=167575
 

Modified: trunk/Source/WebCore/page/PerformanceUserTiming.cpp (211359 => 211360)


--- trunk/Source/WebCore/page/PerformanceUserTiming.cpp	2017-01-30 10:10:40 UTC (rev 211359)
+++ trunk/Source/WebCore/page/PerformanceUserTiming.cpp	2017-01-30 10:14:36 UTC (rev 211360)
@@ -88,16 +88,6 @@
 {
 }
 
-static void insertPerformanceEntry(PerformanceEntryMap& performanceEntryMap, Ref<PerformanceEntry>&& performanceEntry)
-{
-    RefPtr<PerformanceEntry> entry = WTFMove(performanceEntry);
-    auto it = performanceEntryMap.find(entry->name());
-    if (it != performanceEntryMap.end())
-        it->value.append(WTFMove(entry));
-    else
-        performanceEntryMap.set(entry->name(), Vector<RefPtr<PerformanceEntry>> { WTFMove(entry) });
-}
-
 static void clearPerformanceEntries(PerformanceEntryMap& performanceEntryMap, const String& name)
 {
     if (name.isNull()) {
@@ -113,7 +103,9 @@
     if (restrictedMarkFunction(markName))
         return Exception { SYNTAX_ERR };
 
-    insertPerformanceEntry(m_marksMap, PerformanceMark::create(markName, m_performance.now()));
+    auto& performanceEntryList = m_marksMap.ensure(markName, [] { return Vector<RefPtr<PerformanceEntry>>(); }).iterator->value;
+    performanceEntryList.append(PerformanceMark::create(markName, m_performance.now()));
+
     return { };
 }
 
@@ -161,7 +153,9 @@
         endTime = endMarkResult.releaseReturnValue();
     }
 
-    insertPerformanceEntry(m_measuresMap, PerformanceMeasure::create(measureName, startTime, endTime));
+    auto& performanceEntryList = m_measuresMap.ensure(measureName, [] { return Vector<RefPtr<PerformanceEntry>>(); }).iterator->value;
+    performanceEntryList.append(PerformanceMeasure::create(measureName, startTime, endTime));
+
     return { };
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to