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 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/json/json_writer.h" | 16 #include "base/json/json_writer.h" |
17 #include "base/lazy_instance.h" | 17 #include "base/lazy_instance.h" |
| 18 #include "base/message_loop_proxy.h" |
18 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
19 #include "base/path_service.h" | 20 #include "base/path_service.h" |
20 #include "base/process_util.h" | 21 #include "base/process_util.h" |
21 #include "base/string_number_conversions.h" | 22 #include "base/string_number_conversions.h" |
22 #include "base/string_piece.h" | 23 #include "base/string_piece.h" |
23 #include "base/string_split.h" | 24 #include "base/string_split.h" |
24 #include "base/string_util.h" | 25 #include "base/string_util.h" |
25 #include "base/sys_string_conversions.h" | 26 #include "base/sys_string_conversions.h" |
26 #include "base/time.h" | 27 #include "base/time.h" |
27 #include "base/utf_string_conversions.h" | 28 #include "base/utf_string_conversions.h" |
(...skipping 2381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2409 #if defined(OS_CHROMEOS) || defined(OS_WIN) | 2410 #if defined(OS_CHROMEOS) || defined(OS_WIN) |
2410 use_accelerated_video_decode = true; | 2411 use_accelerated_video_decode = true; |
2411 #endif | 2412 #endif |
2412 use_accelerated_video_decode &= !CommandLine::ForCurrentProcess()->HasSwitch( | 2413 use_accelerated_video_decode &= !CommandLine::ForCurrentProcess()->HasSwitch( |
2413 switches::kDisableAcceleratedVideoDecode); | 2414 switches::kDisableAcceleratedVideoDecode); |
2414 base::WeakPtr<WebGraphicsContext3DCommandBufferImpl> context3d = | 2415 base::WeakPtr<WebGraphicsContext3DCommandBufferImpl> context3d = |
2415 use_accelerated_video_decode ? | 2416 use_accelerated_video_decode ? |
2416 RenderThreadImpl::current()->GetGpuVDAContext3D() : | 2417 RenderThreadImpl::current()->GetGpuVDAContext3D() : |
2417 base::WeakPtr<WebGraphicsContext3DCommandBufferImpl>(); | 2418 base::WeakPtr<WebGraphicsContext3DCommandBufferImpl>(); |
2418 if (context3d) { | 2419 if (context3d) { |
2419 MessageLoop* factories_loop = | 2420 scoped_refptr<base::MessageLoopProxy> factories_loop = |
2420 RenderThreadImpl::current()->compositor_thread() ? | 2421 RenderThreadImpl::current()->compositor_thread() ? |
2421 RenderThreadImpl::current()->compositor_thread()->GetWebThread() | 2422 RenderThreadImpl::current()->compositor_thread()->GetWebThread() |
2422 ->message_loop() : | 2423 ->message_loop()->message_loop_proxy() : |
2423 MessageLoop::current(); | 2424 base::MessageLoopProxy::current(); |
2424 GpuChannelHost* gpu_channel_host = | 2425 GpuChannelHost* gpu_channel_host = |
2425 RenderThreadImpl::current()->EstablishGpuChannelSync( | 2426 RenderThreadImpl::current()->EstablishGpuChannelSync( |
2426 content::CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); | 2427 content::CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); |
2427 collection->AddVideoDecoder(new media::GpuVideoDecoder( | 2428 collection->AddVideoDecoder(new media::GpuVideoDecoder( |
2428 message_loop_factory->GetMessageLoop("GpuVideoDecoder"), | 2429 base::Bind(&media::MessageLoopFactory::GetMessageLoop, |
| 2430 base::Unretained(message_loop_factory), |
| 2431 media::MessageLoopFactory::kVideoDecoder), |
2429 factories_loop, | 2432 factories_loop, |
2430 new RendererGpuVideoDecoderFactories( | 2433 new RendererGpuVideoDecoderFactories( |
2431 gpu_channel_host, factories_loop, context3d))); | 2434 gpu_channel_host, factories_loop, context3d))); |
2432 } | 2435 } |
2433 | 2436 |
2434 WebMediaPlayer* media_player = | 2437 WebMediaPlayer* media_player = |
2435 content::GetContentClient()->renderer()->OverrideCreateWebMediaPlayer( | 2438 content::GetContentClient()->renderer()->OverrideCreateWebMediaPlayer( |
2436 this, frame, client, AsWeakPtr(), collection, audio_source_provider, | 2439 this, frame, client, AsWeakPtr(), collection, audio_source_provider, |
2437 audio_source_provider, message_loop_factory, media_stream_impl_, | 2440 audio_source_provider, message_loop_factory, media_stream_impl_, |
2438 render_media_log); | 2441 render_media_log); |
(...skipping 3335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5774 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5777 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
5775 return !!RenderThreadImpl::current()->compositor_thread(); | 5778 return !!RenderThreadImpl::current()->compositor_thread(); |
5776 } | 5779 } |
5777 | 5780 |
5778 void RenderViewImpl::OnJavaBridgeInit() { | 5781 void RenderViewImpl::OnJavaBridgeInit() { |
5779 DCHECK(!java_bridge_dispatcher_); | 5782 DCHECK(!java_bridge_dispatcher_); |
5780 #if defined(ENABLE_JAVA_BRIDGE) | 5783 #if defined(ENABLE_JAVA_BRIDGE) |
5781 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); | 5784 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); |
5782 #endif | 5785 #endif |
5783 } | 5786 } |
OLD | NEW |