Title: [209417] trunk/Source/WebCore
Revision
209417
Author
wei...@apple.com
Date
2016-12-06 13:52:18 -0800 (Tue, 06 Dec 2016)

Log Message

REGRESSION: media/track LayoutTests are flaky failures
https://bugs.webkit.org/show_bug.cgi?id=165432

Reviewed by Antoine Quint.

RenderThemeMac was caching the media controls script / style sheets
and not being invalidated when the RuntimeEnabledFeatures changed. So,
we can just cache both.

* bindings/generic/RuntimeEnabledFeatures.h:
Initialize m_areModernMediaControlsEnabled to false.

* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::mediaControlsStyleSheet):
(WebCore::RenderThemeMac::mediaControlsScript):
Have separate caches for the modern and legacy media control scripts/style sheets.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (209416 => 209417)


--- trunk/Source/WebCore/ChangeLog	2016-12-06 21:45:00 UTC (rev 209416)
+++ trunk/Source/WebCore/ChangeLog	2016-12-06 21:52:18 UTC (rev 209417)
@@ -1,5 +1,25 @@
 2016-12-06  Sam Weinig  <s...@webkit.org>
 
+        REGRESSION: media/track LayoutTests are flaky failures
+        https://bugs.webkit.org/show_bug.cgi?id=165432
+
+        Reviewed by Antoine Quint.
+
+        RenderThemeMac was caching the media controls script / style sheets
+        and not being invalidated when the RuntimeEnabledFeatures changed. So,
+        we can just cache both.
+
+        * bindings/generic/RuntimeEnabledFeatures.h:
+        Initialize m_areModernMediaControlsEnabled to false.
+
+        * rendering/RenderThemeMac.h:
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::mediaControlsStyleSheet):
+        (WebCore::RenderThemeMac::mediaControlsScript):
+        Have separate caches for the modern and legacy media control scripts/style sheets.
+
+2016-12-06  Sam Weinig  <s...@webkit.org>
+
         DumpRenderTree crashed in com.apple.WebCore: WebCore::MockMediaEndpoint::generateDtlsInfo const + 23
         https://bugs.webkit.org/show_bug.cgi?id=165486
         <rdar://problem/29149588>

Modified: trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h (209416 => 209417)


--- trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h	2016-12-06 21:45:00 UTC (rev 209416)
+++ trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h	2016-12-06 21:52:18 UTC (rev 209417)
@@ -258,7 +258,7 @@
     // Never instantiate.
     RuntimeEnabledFeatures();
 
-    bool m_areModernMediaControlsEnabled;
+    bool m_areModernMediaControlsEnabled { false };
     bool m_isLocalStorageEnabled;
     bool m_isSessionStorageEnabled;
     bool m_isWebkitNotificationsEnabled;

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (209416 => 209417)


--- trunk/Source/WebCore/rendering/RenderThemeMac.h	2016-12-06 21:45:00 UTC (rev 209416)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h	2016-12-06 21:52:18 UTC (rev 209417)
@@ -245,7 +245,9 @@
 
     RetainPtr<WebCoreRenderThemeNotificationObserver> m_notificationObserver;
 
+    String m_legacyMediaControlsScript;
     String m_mediaControlsScript;
+    String m_legacyMediaControlsStyleSheet;
     String m_mediaControlsStyleSheet;
 };
 

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (209416 => 209417)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2016-12-06 21:45:00 UTC (rev 209416)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2016-12-06 21:52:18 UTC (rev 209417)
@@ -232,15 +232,15 @@
 String RenderThemeMac::mediaControlsStyleSheet()
 {
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
-    if (m_mediaControlsStyleSheet.isEmpty()) {
-        StringBuilder styleSheetBuilder;
-        if (RuntimeEnabledFeatures::sharedFeatures().modernMediaControlsEnabled())
-            styleSheetBuilder.append([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"modern-media-controls" ofType:@"css" inDirectory:@"modern-media-controls"] encoding:NSUTF8StringEncoding error:nil]);
-        else
-            styleSheetBuilder.append([NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsApple" ofType:@"css"] encoding:NSUTF8StringEncoding error:nil]);
-        m_mediaControlsStyleSheet = styleSheetBuilder.toString();
+    if (RuntimeEnabledFeatures::sharedFeatures().modernMediaControlsEnabled()) {
+        if (m_mediaControlsStyleSheet.isEmpty())
+            m_mediaControlsStyleSheet = [NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"modern-media-controls" ofType:@"css" inDirectory:@"modern-media-controls"] encoding:NSUTF8StringEncoding error:nil];
+        return m_mediaControlsStyleSheet;
     }
-    return m_mediaControlsStyleSheet;
+
+    if (m_legacyMediaControlsStyleSheet.isEmpty())
+        m_legacyMediaControlsStyleSheet = [NSString stringWithContentsOfFile:[[NSBundle bundleForClass:[WebCoreRenderThemeBundle class]] pathForResource:@"mediaControlsApple" ofType:@"css"] encoding:NSUTF8StringEncoding error:nil];
+    return m_legacyMediaControlsStyleSheet;
 #else
     return emptyString();
 #endif
@@ -249,19 +249,28 @@
 String RenderThemeMac::mediaControlsScript()
 {
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
-    if (m_mediaControlsScript.isEmpty()) {
-        StringBuilder scriptBuilder;
-        NSBundle *bundle = [NSBundle bundleForClass:[WebCoreRenderThemeBundle class]];
-        if (RuntimeEnabledFeatures::sharedFeatures().modernMediaControlsEnabled()) {
+    if (RuntimeEnabledFeatures::sharedFeatures().modernMediaControlsEnabled()) {
+        if (m_mediaControlsScript.isEmpty()) {
+            NSBundle *bundle = [NSBundle bundleForClass:[WebCoreRenderThemeBundle class]];
+
+            StringBuilder scriptBuilder;
             scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:@"modern-media-controls-localized-strings.js" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]);
             scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:@"modern-media-controls" ofType:@"js" inDirectory:@"modern-media-controls"] encoding:NSUTF8StringEncoding error:nil]);
-        } else {
-            scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:@"mediaControlsLocalizedStrings" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]);
-            scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:@"mediaControlsApple" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]);
+            m_mediaControlsScript = scriptBuilder.toString();
         }
-        m_mediaControlsScript = scriptBuilder.toString();
+        return m_mediaControlsScript;
     }
-    return m_mediaControlsScript;
+
+    if (m_legacyMediaControlsScript.isEmpty()) {
+        NSBundle *bundle = [NSBundle bundleForClass:[WebCoreRenderThemeBundle class]];
+
+        StringBuilder scriptBuilder;
+        scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:@"mediaControlsLocalizedStrings" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]);
+        scriptBuilder.append([NSString stringWithContentsOfFile:[bundle pathForResource:@"mediaControlsApple" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]);
+
+        m_legacyMediaControlsScript = scriptBuilder.toString();
+    }
+    return m_legacyMediaControlsScript;
 #else
     return emptyString();
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to