OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 // These values are used for a histogram. Do not reorder. | 269 // These values are used for a histogram. Do not reorder. |
270 enum AutoplayMetrics { | 270 enum AutoplayMetrics { |
271 // Media element with autoplay seen. | 271 // Media element with autoplay seen. |
272 AutoplayMediaFound = 0, | 272 AutoplayMediaFound = 0, |
273 // Autoplay enabled and user stopped media play at any point. | 273 // Autoplay enabled and user stopped media play at any point. |
274 AutoplayStopped = 1, | 274 AutoplayStopped = 1, |
275 // Autoplay enabled but user bailed out on media play early. | 275 // Autoplay enabled but user bailed out on media play early. |
276 AutoplayBailout = 2, | 276 AutoplayBailout = 2, |
277 // Autoplay disabled but user manually started media. | 277 // Autoplay disabled but user manually started media. |
278 AutoplayManualStart = 3, | 278 AutoplayManualStart = 3, |
| 279 // Autoplay was (re)enabled through a user-gesture triggered load() |
| 280 AutoplayEnabledThroughLoad = 4, |
279 // This enum value must be last. | 281 // This enum value must be last. |
280 NumberOfAutoplayMetrics, | 282 NumberOfAutoplayMetrics, |
281 }; | 283 }; |
282 | 284 |
283 static void recordAutoplayMetric(AutoplayMetrics metric) | 285 static void recordAutoplayMetric(AutoplayMetrics metric) |
284 { | 286 { |
285 blink::Platform::current()->histogramEnumeration("Blink.MediaElement.Autopla
y", metric, NumberOfAutoplayMetrics); | 287 blink::Platform::current()->histogramEnumeration("Blink.MediaElement.Autopla
y", metric, NumberOfAutoplayMetrics); |
286 } | 288 } |
287 | 289 |
288 WebMimeRegistry::SupportsType HTMLMediaElement::supportsType(const ContentType&
contentType, const String& keySystem) | 290 WebMimeRegistry::SupportsType HTMLMediaElement::supportsType(const ContentType&
contentType, const String& keySystem) |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 | 735 |
734 WTF_LOG(Media, "HTMLMediaElement::canPlayType(%p, %s, %s) -> %s", this, mime
Type.utf8().data(), keySystem.utf8().data(), canPlay.utf8().data()); | 736 WTF_LOG(Media, "HTMLMediaElement::canPlayType(%p, %s, %s) -> %s", this, mime
Type.utf8().data(), keySystem.utf8().data(), canPlay.utf8().data()); |
735 | 737 |
736 return canPlay; | 738 return canPlay; |
737 } | 739 } |
738 | 740 |
739 void HTMLMediaElement::load() | 741 void HTMLMediaElement::load() |
740 { | 742 { |
741 WTF_LOG(Media, "HTMLMediaElement::load(%p)", this); | 743 WTF_LOG(Media, "HTMLMediaElement::load(%p)", this); |
742 | 744 |
743 if (UserGestureIndicator::processingUserGesture()) | 745 if (UserGestureIndicator::processingUserGesture()) { |
| 746 recordAutoplayMetric(AutoplayEnabledThroughLoad); |
744 m_userGestureRequiredForPlay = false; | 747 m_userGestureRequiredForPlay = false; |
| 748 } |
745 | 749 |
746 prepareForLoad(); | 750 prepareForLoad(); |
747 loadInternal(); | 751 loadInternal(); |
748 prepareToPlay(); | 752 prepareToPlay(); |
749 } | 753 } |
750 | 754 |
751 void HTMLMediaElement::prepareForLoad() | 755 void HTMLMediaElement::prepareForLoad() |
752 { | 756 { |
753 WTF_LOG(Media, "HTMLMediaElement::prepareForLoad(%p)", this); | 757 WTF_LOG(Media, "HTMLMediaElement::prepareForLoad(%p)", this); |
754 | 758 |
(...skipping 3342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4097 | 4101 |
4098 #if ENABLE(WEB_AUDIO) | 4102 #if ENABLE(WEB_AUDIO) |
4099 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) | 4103 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
4100 { | 4104 { |
4101 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) | 4105 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) |
4102 audioSourceProvider()->setClient(nullptr); | 4106 audioSourceProvider()->setClient(nullptr); |
4103 } | 4107 } |
4104 #endif | 4108 #endif |
4105 | 4109 |
4106 } | 4110 } |
OLD | NEW |