Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 3050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3061 return; | 3061 return; |
| 3062 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); | 3062 webview()->devToolsAgent()->setLayerTreeId(rwc->GetLayerTreeId()); |
| 3063 } | 3063 } |
| 3064 | 3064 |
| 3065 // WebKit::WebFrameClient ----------------------------------------------------- | 3065 // WebKit::WebFrameClient ----------------------------------------------------- |
| 3066 | 3066 |
| 3067 WebMediaPlayer* RenderViewImpl::createMediaPlayer( | 3067 WebMediaPlayer* RenderViewImpl::createMediaPlayer( |
| 3068 WebFrame* frame, const WebKit::WebURL& url, WebMediaPlayerClient* client) { | 3068 WebFrame* frame, const WebKit::WebURL& url, WebMediaPlayerClient* client) { |
| 3069 FOR_EACH_OBSERVER( | 3069 FOR_EACH_OBSERVER( |
| 3070 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); | 3070 RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); |
| 3071 | |
| 3072 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 3071 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| 3073 #if defined(ENABLE_WEBRTC) | 3072 #if defined(ENABLE_WEBRTC) |
| 3074 if (!InitializeMediaStreamClient()) | 3073 bool webrtc_enabled = !cmd_line->HasSwitch(switches::kDisableWebRTC); |
| 3075 return NULL; | 3074 if (webrtc_enabled) { |
|
jamesr
2013/10/30 22:45:20
early return would be better
if (cmd_line->HasSwi
michaelbai
2013/10/30 22:48:35
We can't return and still want to create WebMediaP
jamesr
2013/10/30 22:50:11
This function's way too complicated. Break it up i
michaelbai
2013/10/30 23:13:30
Agreed, I had another CL https://codereview.chromi
| |
| 3076 | 3075 if (!InitializeMediaStreamClient()) { |
| 3076 LOG(ERROR) << "Failed to initialize MediaStreamClient"; | |
| 3077 return NULL; | |
| 3078 } | |
| 3077 #if !defined(GOOGLE_TV) | 3079 #if !defined(GOOGLE_TV) |
| 3078 if (media_stream_client_->IsMediaStream(url)) { | 3080 if (media_stream_client_->IsMediaStream(url)) { |
| 3079 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) | 3081 #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) |
| 3080 bool found_neon = | 3082 bool found_neon = |
| 3081 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; | 3083 (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; |
| 3082 UMA_HISTOGRAM_BOOLEAN("Platform.WebRtcNEONFound", found_neon); | 3084 UMA_HISTOGRAM_BOOLEAN("Platform.WebRtcNEONFound", found_neon); |
| 3083 #endif // defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) | 3085 #endif // defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) |
| 3084 return new WebMediaPlayerMS( | 3086 return new WebMediaPlayerMS(frame, client, AsWeakPtr(), |
| 3085 frame, client, AsWeakPtr(), media_stream_client_, new RenderMediaLog()); | 3087 media_stream_client_, new RenderMediaLog()); |
| 3088 } | |
| 3089 #endif // !defined(GOOGLE_TV) | |
| 3086 } | 3090 } |
| 3087 #endif // !defined(GOOGLE_TV) | |
| 3088 #endif // defined(ENABLE_WEBRTC) | 3091 #endif // defined(ENABLE_WEBRTC) |
| 3089 | 3092 |
| 3090 #if defined(OS_ANDROID) | 3093 #if defined(OS_ANDROID) |
| 3091 GpuChannelHost* gpu_channel_host = | 3094 GpuChannelHost* gpu_channel_host = |
| 3092 RenderThreadImpl::current()->EstablishGpuChannelSync( | 3095 RenderThreadImpl::current()->EstablishGpuChannelSync( |
| 3093 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); | 3096 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); |
| 3094 if (!gpu_channel_host) { | 3097 if (!gpu_channel_host) { |
| 3095 LOG(ERROR) << "Failed to establish GPU channel for media player"; | 3098 LOG(ERROR) << "Failed to establish GPU channel for media player"; |
| 3096 return NULL; | 3099 return NULL; |
| 3097 } | 3100 } |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 3123 new WebMediaPlayerAndroid( | 3126 new WebMediaPlayerAndroid( |
| 3124 frame, | 3127 frame, |
| 3125 client, | 3128 client, |
| 3126 AsWeakPtr(), | 3129 AsWeakPtr(), |
| 3127 media_player_manager_.get(), | 3130 media_player_manager_.get(), |
| 3128 media_player_proxy_, | 3131 media_player_proxy_, |
| 3129 stream_texture_factory.release(), | 3132 stream_texture_factory.release(), |
| 3130 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(), | 3133 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(), |
| 3131 new RenderMediaLog())); | 3134 new RenderMediaLog())); |
| 3132 #if defined(ENABLE_WEBRTC) && defined(GOOGLE_TV) | 3135 #if defined(ENABLE_WEBRTC) && defined(GOOGLE_TV) |
| 3133 if (media_stream_client_->IsMediaStream(url)) { | 3136 if (webrtc_enabled && media_stream_client_->IsMediaStream(url)) { |
| 3134 RTCVideoDecoderFactoryTv* factory = RenderThreadImpl::current() | 3137 RTCVideoDecoderFactoryTv* factory = RenderThreadImpl::current() |
| 3135 ->GetMediaStreamDependencyFactory()->decoder_factory_tv(); | 3138 ->GetMediaStreamDependencyFactory()->decoder_factory_tv(); |
| 3136 // |media_stream_client| and |factory| outlives |web_media_player_android|. | 3139 // |media_stream_client| and |factory| outlives |web_media_player_android|. |
| 3137 if (!factory->AcquireDemuxer() || | 3140 if (!factory->AcquireDemuxer() || |
| 3138 !web_media_player_android->InjectMediaStream( | 3141 !web_media_player_android->InjectMediaStream( |
| 3139 media_stream_client_, | 3142 media_stream_client_, |
| 3140 factory, | 3143 factory, |
| 3141 base::Bind( | 3144 base::Bind( |
| 3142 base::IgnoreResult(&RTCVideoDecoderFactoryTv::ReleaseDemuxer), | 3145 base::IgnoreResult(&RTCVideoDecoderFactoryTv::ReleaseDemuxer), |
| 3143 base::Unretained(factory)))) { | 3146 base::Unretained(factory)))) { |
| (...skipping 3445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6589 for (size_t i = 0; i < icon_urls.size(); i++) { | 6592 for (size_t i = 0; i < icon_urls.size(); i++) { |
| 6590 WebURL url = icon_urls[i].iconURL(); | 6593 WebURL url = icon_urls[i].iconURL(); |
| 6591 if (!url.isEmpty()) | 6594 if (!url.isEmpty()) |
| 6592 urls.push_back(FaviconURL(url, | 6595 urls.push_back(FaviconURL(url, |
| 6593 ToFaviconType(icon_urls[i].iconType()))); | 6596 ToFaviconType(icon_urls[i].iconType()))); |
| 6594 } | 6597 } |
| 6595 SendUpdateFaviconURL(urls); | 6598 SendUpdateFaviconURL(urls); |
| 6596 } | 6599 } |
| 6597 | 6600 |
| 6598 } // namespace content | 6601 } // namespace content |
| OLD | NEW |