Diff
Modified: branches/safari-536.28-branch/Source/WebCore/ChangeLog (135010 => 135011)
--- branches/safari-536.28-branch/Source/WebCore/ChangeLog 2012-11-16 23:31:03 UTC (rev 135010)
+++ branches/safari-536.28-branch/Source/WebCore/ChangeLog 2012-11-16 23:39:58 UTC (rev 135011)
@@ -1,5 +1,40 @@
2012-11-16 Lucas Forschler <lforsch...@apple.com>
+ Merge r131779
+
+ 2012-10-18 Jer Noble <jer.no...@apple.com>
+
+ Add diagnostic logging to track per-page media engine usage.
+ https://bugs.webkit.org/show_bug.cgi?id=99615
+ <rdar://problem/12476473>
+
+ Reviewed by Eric Carlson.
+
+ Add diagnostic logging triggered only once-per-page and once-per-page-per-engine.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::logMediaLoadRequest): Encapsulate diagnostic logging into single static method.
+ (WebCore::HTMLMediaElement::mediaLoadingFailed): Call logMediaLoadRequest.
+ (WebCore::HTMLMediaElement::setReadyState): Ditto.
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::dispatchDidCommitLoad): Reset the set of seen media engines.
+
+ Add new methods to Page to track per-page media engine diagnostic info, similar to plugin diagnostic info.
+ * page/Page.cpp:
+ (WebCore::Page::hasSeenAnyMediaEngine):
+ (WebCore::Page::hasSeenMediaEngine):
+ (WebCore::Page::sawMediaEngine):
+ (WebCore::Page::resetSeenMediaEngines):
+ * page/Page.h:
+
+ Add new static logging key definitions:
+ * page/DiagnosticLoggingKeys.cpp:
+ (WebCore::DiagnosticLoggingKeys::pageContainsMediaEngineKey):
+ (WebCore::DiagnosticLoggingKeys::pageContainsAtLeastOneMediaEngineKey):
+ * page/DiagnosticLoggingKeys.h:
+
+2012-11-16 Lucas Forschler <lforsch...@apple.com>
+
Merge r131280
2012-10-14 Jon Lee <jon...@apple.com>
Modified: branches/safari-536.28-branch/Source/WebCore/html/HTMLMediaElement.cpp (135010 => 135011)
--- branches/safari-536.28-branch/Source/WebCore/html/HTMLMediaElement.cpp 2012-11-16 23:31:03 UTC (rev 135010)
+++ branches/safari-536.28-branch/Source/WebCore/html/HTMLMediaElement.cpp 2012-11-16 23:39:58 UTC (rev 135011)
@@ -1473,6 +1473,29 @@
endProcessingMediaPlayerCallback();
}
+static void logMediaLoadRequest(Page* page, const String& mediaEngine, const String& errorMessage, bool succeeded)
+{
+ if (!page || !page->settings()->diagnosticLoggingEnabled())
+ return;
+
+ ChromeClient* client = page->chrome()->client();
+
+ if (!succeeded) {
+ client->logDiagnosticMessage(DiagnosticLoggingKeys::mediaLoadingFailedKey(), errorMessage, DiagnosticLoggingKeys::failKey());
+ return;
+ }
+
+ client->logDiagnosticMessage(DiagnosticLoggingKeys::mediaLoadedKey(), mediaEngine, DiagnosticLoggingKeys::noopKey());
+
+ if (!page->hasSeenAnyMediaEngine())
+ client->logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsAtLeastOneMediaEngineKey(), emptyString(), DiagnosticLoggingKeys::noopKey());
+
+ if (!page->hasSeenMediaEngine(mediaEngine))
+ client->logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsMediaEngineKey(), mediaEngine, DiagnosticLoggingKeys::noopKey());
+
+ page->sawMediaEngine(mediaEngine);
+}
+
static String stringForNetworkState(MediaPlayer::NetworkState state)
{
switch (state) {
@@ -1524,8 +1547,7 @@
mediaControls()->reportedError();
}
- if (document()->page() && document()->page()->settings()->diagnosticLoggingEnabled())
- document()->page()->chrome()->client()->logDiagnosticMessage(DiagnosticLoggingKeys::mediaLoadingFailedKey(), stringForNetworkState(error), DiagnosticLoggingKeys::failKey());
+ logMediaLoadRequest(document()->page(), String(), stringForNetworkState(error), false);
}
void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state)
@@ -1655,8 +1677,7 @@
if (renderer())
renderer()->updateFromElement();
- if (document()->page() && document()->page()->settings()->diagnosticLoggingEnabled())
- document()->page()->chrome()->client()->logDiagnosticMessage(DiagnosticLoggingKeys::mediaLoadedKey(), m_player->engineDescription(), DiagnosticLoggingKeys::noopKey());
+ logMediaLoadRequest(document()->page(), m_player->engineDescription(), String(), true);
}
bool shouldUpdateDisplayState = false;
Modified: branches/safari-536.28-branch/Source/WebCore/loader/FrameLoader.cpp (135010 => 135011)
--- branches/safari-536.28-branch/Source/WebCore/loader/FrameLoader.cpp 2012-11-16 23:31:03 UTC (rev 135010)
+++ branches/safari-536.28-branch/Source/WebCore/loader/FrameLoader.cpp 2012-11-16 23:39:58 UTC (rev 135011)
@@ -3167,8 +3167,10 @@
m_client->dispatchDidCommitLoad();
- if (isLoadingMainFrame())
+ if (isLoadingMainFrame()) {
m_frame->page()->resetSeenPlugins();
+ m_frame->page()->resetSeenMediaEngines();
+ }
InspectorInstrumentation::didCommitLoad(m_frame, m_documentLoader.get());
}
Modified: branches/safari-536.28-branch/Source/WebCore/page/DiagnosticLoggingKeys.cpp (135010 => 135011)
--- branches/safari-536.28-branch/Source/WebCore/page/DiagnosticLoggingKeys.cpp 2012-11-16 23:31:03 UTC (rev 135010)
+++ branches/safari-536.28-branch/Source/WebCore/page/DiagnosticLoggingKeys.cpp 2012-11-16 23:39:58 UTC (rev 135011)
@@ -64,6 +64,18 @@
return key;
}
+const String& DiagnosticLoggingKeys::pageContainsMediaEngineKey()
+{
+ DEFINE_STATIC_LOCAL(const String, key, (String("pageContainsMediaEngine")));
+ return key;
+}
+
+const String& DiagnosticLoggingKeys::pageContainsAtLeastOneMediaEngineKey()
+{
+ DEFINE_STATIC_LOCAL(const String, key, (String("pageContainsAtLeastOneMediaEngine")));
+ return key;
+}
+
const String& DiagnosticLoggingKeys::passKey()
{
DEFINE_STATIC_LOCAL(const String, key, ("pass"));
Modified: branches/safari-536.28-branch/Source/WebCore/page/DiagnosticLoggingKeys.h (135010 => 135011)
--- branches/safari-536.28-branch/Source/WebCore/page/DiagnosticLoggingKeys.h 2012-11-16 23:31:03 UTC (rev 135010)
+++ branches/safari-536.28-branch/Source/WebCore/page/DiagnosticLoggingKeys.h 2012-11-16 23:39:58 UTC (rev 135011)
@@ -39,7 +39,9 @@
static const String& pluginLoadingFailedKey();
static const String& pageContainsPluginKey();
static const String& pageContainsAtLeastOnePluginKey();
-
+ static const String& pageContainsMediaEngineKey();
+ static const String& pageContainsAtLeastOneMediaEngineKey();
+
// Success keys
static const String& passKey();
static const String& failKey();
Modified: branches/safari-536.28-branch/Source/WebCore/page/Page.cpp (135010 => 135011)
--- branches/safari-536.28-branch/Source/WebCore/page/Page.cpp 2012-11-16 23:31:03 UTC (rev 135010)
+++ branches/safari-536.28-branch/Source/WebCore/page/Page.cpp 2012-11-16 23:39:58 UTC (rev 135011)
@@ -1172,6 +1172,26 @@
m_seenPlugins.clear();
}
+bool Page::hasSeenAnyMediaEngine() const
+{
+ return !m_seenMediaEngines.isEmpty();
+}
+
+bool Page::hasSeenMediaEngine(const String& engineDescription) const
+{
+ return m_seenMediaEngines.contains(engineDescription);
+}
+
+void Page::sawMediaEngine(const String& engineDescription)
+{
+ m_seenMediaEngines.add(engineDescription);
+}
+
+void Page::resetSeenMediaEngines()
+{
+ m_seenMediaEngines.clear();
+}
+
Page::PageClients::PageClients()
: alternativeTextClient(0)
, chromeClient(0)
Modified: branches/safari-536.28-branch/Source/WebCore/page/Page.h (135010 => 135011)
--- branches/safari-536.28-branch/Source/WebCore/page/Page.h 2012-11-16 23:31:03 UTC (rev 135010)
+++ branches/safari-536.28-branch/Source/WebCore/page/Page.h 2012-11-16 23:39:58 UTC (rev 135011)
@@ -356,6 +356,11 @@
void sawPlugin(const String& serviceType);
void resetSeenPlugins();
+ bool hasSeenMediaEngine(const String& engineName) const;
+ bool hasSeenAnyMediaEngine() const;
+ void sawMediaEngine(const String& engineName);
+ void resetSeenMediaEngines();
+
private:
void initGroup();
@@ -461,6 +466,7 @@
bool m_scriptedAnimationsSuspended;
HashSet<String> m_seenPlugins;
+ HashSet<String> m_seenMediaEngines;
};
} // namespace WebCore