Chromium Code Reviews| Index: webkit/glue/webmediaplayer_impl.cc |
| diff --git a/webkit/glue/webmediaplayer_impl.cc b/webkit/glue/webmediaplayer_impl.cc |
| index 01ddcc06c9191fef3966592df87892058792b880..c3e5d0e543f302648a65afe9352a577e2a9db106 100644 |
| --- a/webkit/glue/webmediaplayer_impl.cc |
| +++ b/webkit/glue/webmediaplayer_impl.cc |
| @@ -120,6 +120,7 @@ WebMediaPlayerImpl::WebMediaPlayerImpl( |
| delegate_(delegate), |
| media_stream_client_(media_stream_client), |
| media_log_(media_log), |
| + is_accelerated_compositing_active_(false), |
| incremented_externally_allocated_memory_(false) { |
| // Saves the current message loop. |
| DCHECK(!main_loop_); |
| @@ -152,8 +153,8 @@ bool WebMediaPlayerImpl::Initialize( |
| AsWeakPtr())); |
| } |
| - UMA_HISTOGRAM_BOOLEAN("Media.AcceleratedCompositingActive", |
| - frame->view()->isAcceleratedCompositingActive()); |
| + is_accelerated_compositing_active_ = |
| + frame->view()->isAcceleratedCompositingActive(); |
| pipeline_ = new media::PipelineImpl(pipeline_message_loop, media_log_); |
| @@ -237,10 +238,40 @@ WebMediaPlayerImpl::~WebMediaPlayerImpl() { |
| } |
| } |
| +// Helper enum for reporting scheme histograms. |
| +enum URLSchemeForHistogram { |
|
tony
2011/11/15 20:50:54
Nit: Can we put this in the anonymous namespace?
Ami GONE FROM CHROMIUM
2011/11/15 21:03:53
I prefer to keep this near the (only) site of use,
tony
2011/11/15 21:33:21
Style guide says to put it in an anonymous namespa
Ami GONE FROM CHROMIUM
2011/11/15 21:47:35
Ok, but under protest.
The justification in the
|
| + kUnknownURLScheme, |
| + kMissingURLScheme, |
| + kHttpURLScheme, |
| + kHttpsURLScheme, |
| + kFtpURLScheme, |
| + kChromeExtensionURLScheme, |
| + kJavascriptURLScheme, |
| + kFileURLScheme, |
| + kBlobURLScheme, |
| + kDataURLScheme, |
| + kMaxURLScheme = kDataURLScheme // Must be equal to highest enum value. |
| +}; |
| + |
| +static URLSchemeForHistogram URLScheme(const GURL& url) { |
|
tony
2011/11/15 20:50:54
Nit: This could also go in the anonymous namespace
Ami GONE FROM CHROMIUM
2011/11/15 21:03:53
Ditto.
(plus anonymous namespaces are generally le
|
| + if (!url.has_scheme()) return kMissingURLScheme; |
| + if (url.SchemeIs("http")) return kHttpURLScheme; |
| + if (url.SchemeIs("https")) return kHttpsURLScheme; |
| + if (url.SchemeIs("ftp")) return kFtpURLScheme; |
| + if (url.SchemeIs("chrome-extension")) return kChromeExtensionURLScheme; |
| + if (url.SchemeIs("javascript")) return kJavascriptURLScheme; |
| + if (url.SchemeIs("file")) return kFileURLScheme; |
| + if (url.SchemeIs("blob")) return kBlobURLScheme; |
| + if (url.SchemeIs("data")) return kDataURLScheme; |
|
tony
2011/11/15 20:50:54
Nit: You could just make an array of char* pointer
Ami GONE FROM CHROMIUM
2011/11/15 21:03:53
I started out really liking this suggestion, and c
tony
2011/11/15 21:33:21
You could avoid some of the ickiness by doing:
sta
|
| + return kUnknownURLScheme; |
| +} |
| + |
| void WebMediaPlayerImpl::load(const WebKit::WebURL& url) { |
| DCHECK_EQ(main_loop_, MessageLoop::current()); |
| DCHECK(proxy_); |
| + UMA_HISTOGRAM_ENUMERATION("Media.URLScheme", URLScheme(url), kMaxURLScheme); |
| + |
| if (media_stream_client_) { |
| bool has_video = false; |
| bool has_audio = false; |
| @@ -708,6 +739,11 @@ void WebMediaPlayerImpl::OnPipelineInitialize(PipelineStatus status) { |
| static_cast<float>(pipeline_->GetMediaDuration().InSecondsF()); |
| buffered_.swap(new_buffered); |
| + if (hasVideo()) { |
| + UMA_HISTOGRAM_BOOLEAN("Media.AcceleratedCompositingActive", |
| + is_accelerated_compositing_active_); |
| + } |
| + |
| if (pipeline_->IsLoaded()) { |
| SetNetworkState(WebKit::WebMediaPlayer::Loaded); |
| } |