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 2390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2418 #if defined(OS_CHROMEOS) || defined(OS_WIN) | 2419 #if defined(OS_CHROMEOS) || defined(OS_WIN) |
2419 use_accelerated_video_decode = true; | 2420 use_accelerated_video_decode = true; |
2420 #endif | 2421 #endif |
2421 use_accelerated_video_decode &= !CommandLine::ForCurrentProcess()->HasSwitch( | 2422 use_accelerated_video_decode &= !CommandLine::ForCurrentProcess()->HasSwitch( |
2422 switches::kDisableAcceleratedVideoDecode); | 2423 switches::kDisableAcceleratedVideoDecode); |
2423 base::WeakPtr<WebGraphicsContext3DCommandBufferImpl> context3d = | 2424 base::WeakPtr<WebGraphicsContext3DCommandBufferImpl> context3d = |
2424 use_accelerated_video_decode ? | 2425 use_accelerated_video_decode ? |
2425 RenderThreadImpl::current()->GetGpuVDAContext3D() : | 2426 RenderThreadImpl::current()->GetGpuVDAContext3D() : |
2426 base::WeakPtr<WebGraphicsContext3DCommandBufferImpl>(); | 2427 base::WeakPtr<WebGraphicsContext3DCommandBufferImpl>(); |
2427 if (context3d) { | 2428 if (context3d) { |
2428 MessageLoop* factories_loop = | 2429 scoped_refptr<base::MessageLoopProxy> factories_loop = |
2429 RenderThreadImpl::current()->compositor_thread() ? | 2430 RenderThreadImpl::current()->compositor_thread() ? |
2430 RenderThreadImpl::current()->compositor_thread()->GetWebThread() | 2431 RenderThreadImpl::current()->compositor_thread()->GetWebThread() |
2431 ->message_loop() : | 2432 ->message_loop()->message_loop_proxy() : |
2432 MessageLoop::current(); | 2433 base::MessageLoopProxy::current(); |
2433 GpuChannelHost* gpu_channel_host = | 2434 GpuChannelHost* gpu_channel_host = |
2434 RenderThreadImpl::current()->EstablishGpuChannelSync( | 2435 RenderThreadImpl::current()->EstablishGpuChannelSync( |
2435 content::CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); | 2436 content::CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); |
2436 collection->GetVideoDecoders()->push_back(new media::GpuVideoDecoder( | 2437 collection->GetVideoDecoders()->push_back(new media::GpuVideoDecoder( |
2437 message_loop_factory->GetMessageLoop("GpuVideoDecoder"), | 2438 base::Bind(&media::MessageLoopFactory::GetMessageLoop, |
| 2439 base::Unretained(message_loop_factory), |
| 2440 media::MessageLoopFactory::kVideoDecoder), |
2438 factories_loop, | 2441 factories_loop, |
2439 new RendererGpuVideoDecoderFactories( | 2442 new RendererGpuVideoDecoderFactories( |
2440 gpu_channel_host, factories_loop, context3d))); | 2443 gpu_channel_host, factories_loop, context3d))); |
2441 } | 2444 } |
2442 | 2445 |
2443 WebMediaPlayer* media_player = | 2446 WebMediaPlayer* media_player = |
2444 content::GetContentClient()->renderer()->OverrideCreateWebMediaPlayer( | 2447 content::GetContentClient()->renderer()->OverrideCreateWebMediaPlayer( |
2445 this, frame, client, AsWeakPtr(), collection, audio_source_provider, | 2448 this, frame, client, AsWeakPtr(), collection, audio_source_provider, |
2446 audio_source_provider, message_loop_factory, media_stream_impl_, | 2449 audio_source_provider, message_loop_factory, media_stream_impl_, |
2447 render_media_log); | 2450 render_media_log); |
(...skipping 3316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5764 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5767 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
5765 return !!RenderThreadImpl::current()->compositor_thread(); | 5768 return !!RenderThreadImpl::current()->compositor_thread(); |
5766 } | 5769 } |
5767 | 5770 |
5768 void RenderViewImpl::OnJavaBridgeInit() { | 5771 void RenderViewImpl::OnJavaBridgeInit() { |
5769 DCHECK(!java_bridge_dispatcher_); | 5772 DCHECK(!java_bridge_dispatcher_); |
5770 #if defined(ENABLE_JAVA_BRIDGE) | 5773 #if defined(ENABLE_JAVA_BRIDGE) |
5771 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); | 5774 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); |
5772 #endif | 5775 #endif |
5773 } | 5776 } |
OLD | NEW |