Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp

Issue 1990313002: Split Media.Controls.Show in .Video and .Audio. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add more comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2169 } 2169 }
2170 2170
2171 void HTMLMediaElement::setLoop(bool b) 2171 void HTMLMediaElement::setLoop(bool b)
2172 { 2172 {
2173 WTF_LOG(Media, "HTMLMediaElement::setLoop(%p, %s)", this, boolString(b)); 2173 WTF_LOG(Media, "HTMLMediaElement::setLoop(%p, %s)", this, boolString(b));
2174 setBooleanAttribute(loopAttr, b); 2174 setBooleanAttribute(loopAttr, b);
2175 } 2175 }
2176 2176
2177 bool HTMLMediaElement::shouldShowControls(const RecordMetricsBehavior recordMetr ics) const 2177 bool HTMLMediaElement::shouldShowControls(const RecordMetricsBehavior recordMetr ics) const
2178 { 2178 {
2179 DEFINE_STATIC_LOCAL(EnumerationHistogram, showControlsHistogram, ("Media.Con trols.Show", MediaControlsShowMax));
2180
2181 if (fastHasAttribute(controlsAttr)) { 2179 if (fastHasAttribute(controlsAttr)) {
2182 if (recordMetrics == RecordMetricsBehavior::DoRecord) 2180 if (recordMetrics == RecordMetricsBehavior::DoRecord)
2183 showControlsHistogram.count(MediaControlsShowAttribute); 2181 showControlsHistogram().count(MediaControlsShowAttribute);
2184 return true; 2182 return true;
2185 } 2183 }
2186 2184
2187 if (isFullscreen()) { 2185 if (isFullscreen()) {
2188 if (recordMetrics == RecordMetricsBehavior::DoRecord) 2186 if (recordMetrics == RecordMetricsBehavior::DoRecord)
2189 showControlsHistogram.count(MediaControlsShowFullscreen); 2187 showControlsHistogram().count(MediaControlsShowFullscreen);
2190 return true; 2188 return true;
2191 } 2189 }
2192 2190
2193 LocalFrame* frame = document().frame(); 2191 LocalFrame* frame = document().frame();
2194 if (frame && !frame->script().canExecuteScripts(NotAboutToExecuteScript)) { 2192 if (frame && !frame->script().canExecuteScripts(NotAboutToExecuteScript)) {
2195 if (recordMetrics == RecordMetricsBehavior::DoRecord) 2193 if (recordMetrics == RecordMetricsBehavior::DoRecord)
2196 showControlsHistogram.count(MediaControlsShowNoScript); 2194 showControlsHistogram().count(MediaControlsShowNoScript);
2197 return true; 2195 return true;
2198 } 2196 }
2199 2197
2200 if (recordMetrics == RecordMetricsBehavior::DoRecord) 2198 if (recordMetrics == RecordMetricsBehavior::DoRecord)
2201 showControlsHistogram.count(MediaControlsShowNotShown); 2199 showControlsHistogram().count(MediaControlsShowNotShown);
2202 return false; 2200 return false;
2203 } 2201 }
2204 2202
2205 double HTMLMediaElement::volume() const 2203 double HTMLMediaElement::volume() const
2206 { 2204 {
2207 return m_volume; 2205 return m_volume;
2208 } 2206 }
2209 2207
2210 void HTMLMediaElement::setVolume(double vol, ExceptionState& exceptionState) 2208 void HTMLMediaElement::setVolume(double vol, ExceptionState& exceptionState)
2211 { 2209 {
(...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after
3749 void HTMLMediaElement::rejectPlayPromises(ExceptionCode code, const String& mess age) 3747 void HTMLMediaElement::rejectPlayPromises(ExceptionCode code, const String& mess age)
3750 { 3748 {
3751 ASSERT(code == AbortError || code == NotSupportedError); 3749 ASSERT(code == AbortError || code == NotSupportedError);
3752 3750
3753 for (auto& resolver: m_playResolvers) 3751 for (auto& resolver: m_playResolvers)
3754 resolver->reject(DOMException::create(code, message)); 3752 resolver->reject(DOMException::create(code, message));
3755 3753
3756 m_playResolvers.clear(); 3754 m_playResolvers.clear();
3757 } 3755 }
3758 3756
3757 EnumerationHistogram& HTMLMediaElement::showControlsHistogram() const
3758 {
3759 if (isHTMLVideoElement()) {
3760 DEFINE_STATIC_LOCAL(EnumerationHistogram, histogram, ("Media.Controls.Sh ow.Video", MediaControlsShowMax));
3761 return histogram;
3762 }
3763
3764 DEFINE_STATIC_LOCAL(EnumerationHistogram, histogram, ("Media.Controls.Show.A udio", MediaControlsShowMax));
3765 return histogram;
3766 }
3767
3759 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) 3768 void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
3760 { 3769 {
3761 if (!ThreadHeap::isHeapObjectAlive(m_audioSourceNode)) { 3770 if (!ThreadHeap::isHeapObjectAlive(m_audioSourceNode)) {
3762 getAudioSourceProvider().setClient(nullptr); 3771 getAudioSourceProvider().setClient(nullptr);
3763 m_audioSourceNode = nullptr; 3772 m_audioSourceNode = nullptr;
3764 } 3773 }
3765 } 3774 }
3766 3775
3767 void HTMLMediaElement::AudioSourceProviderImpl::wrap(WebAudioSourceProvider* pro vider) 3776 void HTMLMediaElement::AudioSourceProviderImpl::wrap(WebAudioSourceProvider* pro vider)
3768 { 3777 {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
3866 3875
3867 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst 3876 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst
3868 { 3877 {
3869 IntRect result; 3878 IntRect result;
3870 if (LayoutObject* object = m_element->layoutObject()) 3879 if (LayoutObject* object = m_element->layoutObject())
3871 result = object->absoluteBoundingBoxRect(); 3880 result = object->absoluteBoundingBoxRect();
3872 return result; 3881 return result;
3873 } 3882 }
3874 3883
3875 } // namespace blink 3884 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698