- Revision
- 123780
- Author
- [email protected]
- Date
- 2012-07-26 12:01:20 -0700 (Thu, 26 Jul 2012)
Log Message
Add diagnostic messages when media and plugins load or fail to load.
https://bugs.webkit.org/show_bug.cgi?id=92341
Reviewed by Anders Carlsson.
Send diagnostic messages when a media or plugin element loads or fails to load. Include in
the trace the media engine description, error code, or plugin mime type.
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::updateWidget): Send a diagnostic message.
* html/HTMLMediaElement.cpp:
(WebCore::stringForNetworkState): Added convenience function to stringify network states.
(WebCore::HTMLMediaElement::mediaLoadingFailed): Send a diagnostic message.
(WebCore::HTMLMediaElement::setReadyState): Send a diagnostic message.
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::updateWidget): Send a diagnostic message.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (123779 => 123780)
--- trunk/Source/WebCore/ChangeLog 2012-07-26 18:50:48 UTC (rev 123779)
+++ trunk/Source/WebCore/ChangeLog 2012-07-26 19:01:20 UTC (rev 123780)
@@ -1,3 +1,22 @@
+2012-07-25 Jer Noble <[email protected]>
+
+ Add diagnostic messages when media and plugins load or fail to load.
+ https://bugs.webkit.org/show_bug.cgi?id=92341
+
+ Reviewed by Anders Carlsson.
+
+ Send diagnostic messages when a media or plugin element loads or fails to load. Include in
+ the trace the media engine description, error code, or plugin mime type.
+
+ * html/HTMLEmbedElement.cpp:
+ (WebCore::HTMLEmbedElement::updateWidget): Send a diagnostic message.
+ * html/HTMLMediaElement.cpp:
+ (WebCore::stringForNetworkState): Added convenience function to stringify network states.
+ (WebCore::HTMLMediaElement::mediaLoadingFailed): Send a diagnostic message.
+ (WebCore::HTMLMediaElement::setReadyState): Send a diagnostic message.
+ * html/HTMLObjectElement.cpp:
+ (WebCore::HTMLObjectElement::updateWidget): Send a diagnostic message.
+
2012-07-26 Sheriff Bot <[email protected]>
Unreviewed, rolling out r123159, r123165, r123168, r123492,
Modified: trunk/Source/WebCore/html/HTMLEmbedElement.cpp (123779 => 123780)
--- trunk/Source/WebCore/html/HTMLEmbedElement.cpp 2012-07-26 18:50:48 UTC (rev 123779)
+++ trunk/Source/WebCore/html/HTMLEmbedElement.cpp 2012-07-26 19:01:20 UTC (rev 123780)
@@ -26,6 +26,9 @@
#include "Attribute.h"
#include "CSSPropertyNames.h"
+#include "Chrome.h"
+#include "ChromeClient.h"
+#include "DiagnosticLoggingKeys.h"
#include "DocumentLoader.h"
#include "Frame.h"
#include "HTMLDocument.h"
@@ -34,6 +37,7 @@
#include "HTMLObjectElement.h"
#include "HTMLParserIdioms.h"
#include "MainResourceLoader.h"
+#include "Page.h"
#include "PluginDocument.h"
#include "RenderEmbeddedObject.h"
#include "RenderImage.h"
@@ -172,7 +176,10 @@
SubframeLoader* loader = document()->frame()->loader()->subframeLoader();
// FIXME: beforeLoad could have detached the renderer! Just like in the <object> case above.
- loader->requestObject(this, m_url, getNameAttribute(), m_serviceType, paramNames, paramValues);
+ bool success = loader->requestObject(this, m_url, getNameAttribute(), m_serviceType, paramNames, paramValues);
+
+ if (document()->page() && document()->page()->settings()->diagnosticLoggingEnabled())
+ document()->page()->chrome()->client()->logDiagnosticMessage(success ? DiagnosticLoggingKeys::pluginLoadedKey() : DiagnosticLoggingKeys::pluginLoadingFailedKey(), m_serviceType, DiagnosticLoggingKeys::noopKey());
}
bool HTMLEmbedElement::rendererIsNeeded(const NodeRenderingContext& context)
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (123779 => 123780)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2012-07-26 18:50:48 UTC (rev 123779)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2012-07-26 19:01:20 UTC (rev 123780)
@@ -39,6 +39,7 @@
#include "ContentType.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
+#include "DiagnosticLoggingKeys.h"
#include "DocumentLoader.h"
#include "ElementShadow.h"
#include "Event.h"
@@ -1507,6 +1508,20 @@
endProcessingMediaPlayerCallback();
}
+static String stringForNetworkState(MediaPlayer::NetworkState state)
+{
+ switch (state) {
+ case MediaPlayer::Empty: return "Empty";
+ case MediaPlayer::Idle: return "Idle";
+ case MediaPlayer::Loading: return "Loading";
+ case MediaPlayer::Loaded: return "Loaded";
+ case MediaPlayer::FormatError: return "FormatError";
+ case MediaPlayer::NetworkError: return "NetworkError";
+ case MediaPlayer::DecodeError: return "DecodeError";
+ default: return emptyString();
+ }
+}
+
void HTMLMediaElement::mediaLoadingFailed(MediaPlayer::NetworkState error)
{
stopPeriodicTimers();
@@ -1543,6 +1558,9 @@
mediaControls()->reset();
mediaControls()->reportedError();
}
+
+ if (document()->page() && document()->page()->settings()->diagnosticLoggingEnabled())
+ document()->page()->chrome()->client()->logDiagnosticMessage(DiagnosticLoggingKeys::mediaLoadingFailedKey(), stringForNetworkState(error), DiagnosticLoggingKeys::failKey());
}
void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state)
@@ -1671,6 +1689,9 @@
mediaControls()->loadedMetadata();
if (renderer())
renderer()->updateFromElement();
+
+ if (document()->page() && document()->page()->settings()->diagnosticLoggingEnabled())
+ document()->page()->chrome()->client()->logDiagnosticMessage(DiagnosticLoggingKeys::mediaLoadedKey(), m_player->engineDescription(), DiagnosticLoggingKeys::noopKey());
}
bool shouldUpdateDisplayState = false;
Modified: trunk/Source/WebCore/html/HTMLObjectElement.cpp (123779 => 123780)
--- trunk/Source/WebCore/html/HTMLObjectElement.cpp 2012-07-26 18:50:48 UTC (rev 123779)
+++ trunk/Source/WebCore/html/HTMLObjectElement.cpp 2012-07-26 19:01:20 UTC (rev 123780)
@@ -26,6 +26,9 @@
#include "Attribute.h"
#include "CSSValueKeywords.h"
+#include "Chrome.h"
+#include "ChromeClient.h"
+#include "DiagnosticLoggingKeys.h"
#include "EventNames.h"
#include "ExceptionCode.h"
#include "FormDataList.h"
@@ -316,6 +319,9 @@
bool success = beforeLoadAllowedLoad && hasValidClassId() && loader->requestObject(this, url, getNameAttribute(), serviceType, paramNames, paramValues);
if (!success && fallbackContent)
renderFallbackContent();
+
+ if (document()->page() && document()->page()->settings()->diagnosticLoggingEnabled())
+ document()->page()->chrome()->client()->logDiagnosticMessage(success ? DiagnosticLoggingKeys::pluginLoadedKey() : DiagnosticLoggingKeys::pluginLoadingFailedKey(), serviceType, DiagnosticLoggingKeys::noopKey());
}
bool HTMLObjectElement::rendererIsNeeded(const NodeRenderingContext& context)