Title: [177591] trunk/Source/WebCore
- Revision
- 177591
- Author
- [email protected]
- Date
- 2014-12-19 13:07:35 -0800 (Fri, 19 Dec 2014)
Log Message
[iOS] Log how often media element playback happens using FeatureCounter
https://bugs.webkit.org/show_bug.cgi?id=139819
<rdar://problem/19309988>
Reviewed by Eric Carlson.
Log using FeatureCounter how often we start loading for audio / video
elements, and how often they end up being played.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
Add flag to identify when a media element starts playing for the first
time.
(WebCore::HTMLMediaElement::loadResource):
Log when a media element starts loading.
(WebCore::HTMLMediaElement::updatePlayState):
Log when a media element starts playing for the first time.
* html/HTMLMediaElement.h:
Add flag to identify when a media element starts playing for the first
time.
* platform/FeatureCounterKeys.h:
Add FeatureCounter keys for HTMLMediaElement loading / playback.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (177590 => 177591)
--- trunk/Source/WebCore/ChangeLog 2014-12-19 20:53:01 UTC (rev 177590)
+++ trunk/Source/WebCore/ChangeLog 2014-12-19 21:07:35 UTC (rev 177591)
@@ -1,3 +1,32 @@
+2014-12-19 Chris Dumez <[email protected]>
+
+ [iOS] Log how often media element playback happens using FeatureCounter
+ https://bugs.webkit.org/show_bug.cgi?id=139819
+ <rdar://problem/19309988>
+
+ Reviewed by Eric Carlson.
+
+ Log using FeatureCounter how often we start loading for audio / video
+ elements, and how often they end up being played.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::HTMLMediaElement):
+ Add flag to identify when a media element starts playing for the first
+ time.
+
+ (WebCore::HTMLMediaElement::loadResource):
+ Log when a media element starts loading.
+
+ (WebCore::HTMLMediaElement::updatePlayState):
+ Log when a media element starts playing for the first time.
+
+ * html/HTMLMediaElement.h:
+ Add flag to identify when a media element starts playing for the first
+ time.
+
+ * platform/FeatureCounterKeys.h:
+ Add FeatureCounter keys for HTMLMediaElement loading / playback.
+
2014-12-19 Andreas Kling <[email protected]>
Ref-ify TextIterator API.
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (177590 => 177591)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2014-12-19 20:53:01 UTC (rev 177590)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2014-12-19 21:07:35 UTC (rev 177591)
@@ -45,6 +45,7 @@
#include "ElementIterator.h"
#include "EventNames.h"
#include "ExceptionCodePlaceholder.h"
+#include "FeatureCounter.h"
#include "FrameLoader.h"
#include "FrameLoaderClient.h"
#include "FrameView.h"
@@ -289,6 +290,7 @@
, m_actionAfterScan(Nothing)
, m_scanType(Scan)
, m_scanDirection(Forward)
+ , m_firstTimePlaying(true)
, m_playing(false)
, m_isWaitingUntilMediaCanStart(false)
, m_shouldDelayLoadEvent(false)
@@ -1160,6 +1162,10 @@
}
}
+ // Log that we started loading a media element.
+ FEATURE_COUNTER_INCREMENT_KEY(document().page(), isVideo() ? FeatureCounterMediaVideoElementLoadingKey : FeatureCounterMediaAudioElementLoadingKey);
+ m_firstTimePlaying = true;
+
// Set m_currentSrc *before* changing to the cache url, the fact that we are loading from the app
// cache is an internal detail not exposed through the media element API.
m_currentSrc = url;
@@ -4536,6 +4542,12 @@
m_player->setRate(effectivePlaybackRate());
m_player->setMuted(effectiveMuted());
+ if (m_firstTimePlaying) {
+ // Log that a media element was played.
+ FEATURE_COUNTER_INCREMENT_KEY(document().page(), isVideo() ? FeatureCounterMediaVideoElementPlayedKey : FeatureCounterMediaAudioElementPlayedKey);
+ m_firstTimePlaying = false;
+ }
+
m_player->play();
}
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (177590 => 177591)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2014-12-19 20:53:01 UTC (rev 177590)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2014-12-19 21:07:35 UTC (rev 177591)
@@ -827,6 +827,7 @@
ScanType m_scanType;
ScanDirection m_scanDirection;
+ bool m_firstTimePlaying : 1;
bool m_playing : 1;
bool m_isWaitingUntilMediaCanStart : 1;
bool m_shouldDelayLoadEvent : 1;
Modified: trunk/Source/WebCore/platform/FeatureCounterKeys.h (177590 => 177591)
--- trunk/Source/WebCore/platform/FeatureCounterKeys.h 2014-12-19 20:53:01 UTC (rev 177590)
+++ trunk/Source/WebCore/platform/FeatureCounterKeys.h 2014-12-19 21:07:35 UTC (rev 177591)
@@ -70,6 +70,12 @@
static const char FeatureCounterCachedResourceRevalidationReasonMustRevalidateIsExpiredKey[] = "com.apple.WebKit.cachedResourceRevalidation.reason.mustRevalidateIsExpired";
static const char FeatureCounterCachedResourceRevalidationReasonIsExpiredKey[] = "com.apple.WebKit.cachedResourceRevalidation.reason.isExpired";
+// Media playback.
+static const char FeatureCounterMediaVideoElementLoadingKey[] = "com.apple.WebKit.media.video.loading";
+static const char FeatureCounterMediaAudioElementLoadingKey[] = "com.apple.WebKit.media.audio.loading";
+static const char FeatureCounterMediaVideoElementPlayedKey[] = "com.apple.WebKit.media.video.played";
+static const char FeatureCounterMediaAudioElementPlayedKey[] = "com.apple.WebKit.media.audio.played";
+
// Navigation types.
static const char FeatureCounterNavigationStandard[] = "com.apple.WebKit.navigation.standard";
static const char FeatureCounterNavigationBack[] = "com.apple.WebKit.navigation.back";
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes