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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 #include "webkit/media/webmediaplayer_ms.h" | 209 #include "webkit/media/webmediaplayer_ms.h" |
210 #include "webkit/media/webmediaplayer_params.h" | 210 #include "webkit/media/webmediaplayer_params.h" |
211 #include "webkit/plugins/npapi/plugin_list.h" | 211 #include "webkit/plugins/npapi/plugin_list.h" |
212 #include "webkit/plugins/npapi/plugin_utils.h" | 212 #include "webkit/plugins/npapi/plugin_utils.h" |
213 #include "webkit/plugins/npapi/webplugin_delegate.h" | 213 #include "webkit/plugins/npapi/webplugin_delegate.h" |
214 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 214 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
215 #include "webkit/plugins/npapi/webplugin_impl.h" | 215 #include "webkit/plugins/npapi/webplugin_impl.h" |
216 | 216 |
217 #if defined(OS_ANDROID) | 217 #if defined(OS_ANDROID) |
218 #include "content/common/android/device_telephony_info.h" | 218 #include "content/common/android/device_telephony_info.h" |
| 219 #include "content/common/gpu/client/context_provider_command_buffer.h" |
219 #include "content/renderer/android/address_detector.h" | 220 #include "content/renderer/android/address_detector.h" |
220 #include "content/renderer/android/content_detector.h" | 221 #include "content/renderer/android/content_detector.h" |
221 #include "content/renderer/android/email_detector.h" | 222 #include "content/renderer/android/email_detector.h" |
222 #include "content/renderer/android/phone_number_detector.h" | 223 #include "content/renderer/android/phone_number_detector.h" |
223 #include "content/renderer/media/stream_texture_factory_impl_android.h" | 224 #include "content/renderer/media/stream_texture_factory_impl_android.h" |
224 #include "content/renderer/media/webmediaplayer_proxy_impl_android.h" | 225 #include "content/renderer/media/webmediaplayer_proxy_impl_android.h" |
225 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" | 226 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" |
226 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" | 227 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" |
227 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHitTestResult.h" | 228 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHitTestResult.h" |
228 #include "ui/gfx/rect_f.h" | 229 #include "ui/gfx/rect_f.h" |
(...skipping 2485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2714 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 2715 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
2715 #if defined(ENABLE_WEBRTC) | 2716 #if defined(ENABLE_WEBRTC) |
2716 if (MediaStreamImpl::CheckMediaStream(url)) { | 2717 if (MediaStreamImpl::CheckMediaStream(url)) { |
2717 EnsureMediaStreamImpl(); | 2718 EnsureMediaStreamImpl(); |
2718 return new webkit_media::WebMediaPlayerMS( | 2719 return new webkit_media::WebMediaPlayerMS( |
2719 frame, client, AsWeakPtr(), media_stream_impl_, new RenderMediaLog()); | 2720 frame, client, AsWeakPtr(), media_stream_impl_, new RenderMediaLog()); |
2720 } | 2721 } |
2721 #endif | 2722 #endif |
2722 | 2723 |
2723 #if defined(OS_ANDROID) | 2724 #if defined(OS_ANDROID) |
2724 WebGraphicsContext3D* resource_context = | |
2725 GetWebView()->sharedGraphicsContext3D(); | |
2726 | |
2727 GpuChannelHost* gpu_channel_host = | 2725 GpuChannelHost* gpu_channel_host = |
2728 RenderThreadImpl::current()->EstablishGpuChannelSync( | 2726 RenderThreadImpl::current()->EstablishGpuChannelSync( |
2729 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); | 2727 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); |
2730 if (!gpu_channel_host) { | 2728 if (!gpu_channel_host) { |
2731 LOG(ERROR) << "Failed to establish GPU channel for media player"; | 2729 LOG(ERROR) << "Failed to establish GPU channel for media player"; |
2732 return NULL; | 2730 return NULL; |
2733 } | 2731 } |
2734 | 2732 |
| 2733 scoped_refptr<cc::ContextProvider> context_provider = |
| 2734 RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); |
| 2735 if (!context_provider->InitializeOnMainThread() || |
| 2736 !context_provider->BindToCurrentThread()) { |
| 2737 LOG(ERROR) << "Failed to get context3d for media player"; |
| 2738 return NULL; |
| 2739 } |
| 2740 |
2735 if (cmd_line->HasSwitch(switches::kInProcessWebGL)) { | 2741 if (cmd_line->HasSwitch(switches::kInProcessWebGL)) { |
2736 if (!media_bridge_manager_.get()) { | 2742 if (!media_bridge_manager_.get()) { |
2737 media_bridge_manager_.reset( | 2743 media_bridge_manager_.reset( |
2738 new webkit_media::MediaPlayerBridgeManagerImpl(1)); | 2744 new webkit_media::MediaPlayerBridgeManagerImpl(1)); |
2739 } | 2745 } |
2740 return new webkit_media::WebMediaPlayerInProcessAndroid( | 2746 return new webkit_media::WebMediaPlayerInProcessAndroid( |
2741 frame, | 2747 frame, |
2742 client, | 2748 client, |
2743 cookieJar(frame), | 2749 cookieJar(frame), |
2744 media_player_manager_.get(), | 2750 media_player_manager_.get(), |
2745 media_bridge_manager_.get(), | 2751 media_bridge_manager_.get(), |
2746 new StreamTextureFactoryImpl( | 2752 new StreamTextureFactoryImpl( |
2747 resource_context, gpu_channel_host, routing_id_), | 2753 context_provider->Context3d(), gpu_channel_host, routing_id_), |
2748 cmd_line->HasSwitch(switches::kDisableMediaHistoryLogging)); | 2754 cmd_line->HasSwitch(switches::kDisableMediaHistoryLogging)); |
2749 } | 2755 } |
2750 if (!media_player_proxy_) { | 2756 if (!media_player_proxy_) { |
2751 media_player_proxy_ = new WebMediaPlayerProxyImplAndroid( | 2757 media_player_proxy_ = new WebMediaPlayerProxyImplAndroid( |
2752 this, media_player_manager_.get()); | 2758 this, media_player_manager_.get()); |
2753 } | 2759 } |
2754 return new webkit_media::WebMediaPlayerImplAndroid( | 2760 return new webkit_media::WebMediaPlayerImplAndroid( |
2755 frame, | 2761 frame, |
2756 client, | 2762 client, |
2757 media_player_manager_.get(), | 2763 media_player_manager_.get(), |
2758 media_player_proxy_, | 2764 media_player_proxy_, |
2759 new StreamTextureFactoryImpl( | 2765 new StreamTextureFactoryImpl( |
2760 resource_context, gpu_channel_host, routing_id_)); | 2766 context_provider->Context3d(), gpu_channel_host, routing_id_)); |
2761 #endif | 2767 #endif |
2762 | 2768 |
2763 scoped_refptr<media::AudioRendererSink> sink; | 2769 scoped_refptr<media::AudioRendererSink> sink; |
2764 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { | 2770 if (!cmd_line->HasSwitch(switches::kDisableAudio)) { |
2765 if (!cmd_line->HasSwitch(switches::kDisableRendererSideMixing)) { | 2771 if (!cmd_line->HasSwitch(switches::kDisableRendererSideMixing)) { |
2766 sink = RenderThreadImpl::current()->GetAudioRendererMixerManager()-> | 2772 sink = RenderThreadImpl::current()->GetAudioRendererMixerManager()-> |
2767 CreateInput(routing_id_); | 2773 CreateInput(routing_id_); |
2768 DVLOG(1) << "Using AudioRendererMixerManager-provided sink: " << sink; | 2774 DVLOG(1) << "Using AudioRendererMixerManager-provided sink: " << sink; |
2769 } else { | 2775 } else { |
2770 scoped_refptr<RendererAudioOutputDevice> device = | 2776 scoped_refptr<RendererAudioOutputDevice> device = |
(...skipping 3983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6754 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6760 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
6755 RenderProcess::current()->ReleaseTransportDIB(dib); | 6761 RenderProcess::current()->ReleaseTransportDIB(dib); |
6756 } | 6762 } |
6757 | 6763 |
6758 void RenderViewImpl::DidCommitCompositorFrame() { | 6764 void RenderViewImpl::DidCommitCompositorFrame() { |
6759 RenderWidget::DidCommitCompositorFrame(); | 6765 RenderWidget::DidCommitCompositorFrame(); |
6760 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame()); | 6766 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame()); |
6761 } | 6767 } |
6762 | 6768 |
6763 } // namespace content | 6769 } // namespace content |
OLD | NEW |