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_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" | 154 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h" |
| 155 #include "third_party/skia/include/core/SkGraphics.h" | 155 #include "third_party/skia/include/core/SkGraphics.h" |
| 156 #include "ui/base/layout.h" | 156 #include "ui/base/layout.h" |
| 157 #include "ui/base/ui_base_switches.h" | 157 #include "ui/base/ui_base_switches.h" |
| 158 #include "v8/include/v8.h" | 158 #include "v8/include/v8.h" |
| 159 | 159 |
| 160 #if defined(OS_ANDROID) | 160 #if defined(OS_ANDROID) |
| 161 #include <cpu-features.h> | 161 #include <cpu-features.h> |
| 162 #include "content/renderer/android/synchronous_compositor_factory.h" | 162 #include "content/renderer/android/synchronous_compositor_factory.h" |
| 163 #include "content/renderer/media/android/renderer_demuxer_android.h" | 163 #include "content/renderer/media/android/renderer_demuxer_android.h" |
| 164 #include "content/renderer/media/android/stream_texture_factory_impl.h" | |
| 164 #endif | 165 #endif |
| 165 | 166 |
| 166 #if defined(OS_MACOSX) | 167 #if defined(OS_MACOSX) |
| 167 #include "base/mac/mac_util.h" | 168 #include "base/mac/mac_util.h" |
| 168 #include "content/renderer/theme_helper_mac.h" | 169 #include "content/renderer/theme_helper_mac.h" |
| 169 #include "content/renderer/webscrollbarbehavior_impl_mac.h" | 170 #include "content/renderer/webscrollbarbehavior_impl_mac.h" |
| 170 #endif | 171 #endif |
| 171 | 172 |
| 172 #if defined(OS_POSIX) | 173 #if defined(OS_POSIX) |
| 173 #include "ipc/ipc_channel_posix.h" | 174 #include "ipc/ipc_channel_posix.h" |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 885 // hold pointers to V8 objects (e.g., via pending requests). | 886 // hold pointers to V8 objects (e.g., via pending requests). |
| 886 main_thread_indexed_db_dispatcher_.reset(); | 887 main_thread_indexed_db_dispatcher_.reset(); |
| 887 | 888 |
| 888 main_thread_compositor_task_runner_ = NULL; | 889 main_thread_compositor_task_runner_ = NULL; |
| 889 | 890 |
| 890 gpu_factories_.reset(); | 891 gpu_factories_.reset(); |
| 891 | 892 |
| 892 // Context providers must be released prior to destroying the GPU channel. | 893 // Context providers must be released prior to destroying the GPU channel. |
| 893 shared_worker_context_provider_ = nullptr; | 894 shared_worker_context_provider_ = nullptr; |
| 894 shared_main_thread_contexts_ = nullptr; | 895 shared_main_thread_contexts_ = nullptr; |
| 895 | 896 #if defined(OS_ANDROID) |
| 897 stream_texture_factory_ = nullptr; | |
| 898 #endif | |
| 896 if (gpu_channel_.get()) | 899 if (gpu_channel_.get()) |
| 897 gpu_channel_->DestroyChannel(); | 900 gpu_channel_->DestroyChannel(); |
| 898 | 901 |
| 899 // TODO(port) | 902 // TODO(port) |
| 900 #if defined(OS_WIN) | 903 #if defined(OS_WIN) |
| 901 // Clean up plugin channels before this thread goes away. | 904 // Clean up plugin channels before this thread goes away. |
| 902 NPChannelBase::CleanupChannels(); | 905 NPChannelBase::CleanupChannels(); |
| 903 #endif | 906 #endif |
| 904 | 907 |
| 905 // Shut down the message loop and the renderer scheduler before shutting down | 908 // Shut down the message loop and the renderer scheduler before shutting down |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1423 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), | 1426 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), |
| 1424 NULL)); | 1427 NULL)); |
| 1425 } | 1428 } |
| 1426 | 1429 |
| 1427 scoped_refptr<cc_blink::ContextProviderWebContext> | 1430 scoped_refptr<cc_blink::ContextProviderWebContext> |
| 1428 RenderThreadImpl::SharedMainThreadContextProvider() { | 1431 RenderThreadImpl::SharedMainThreadContextProvider() { |
| 1429 DCHECK(IsMainThread()); | 1432 DCHECK(IsMainThread()); |
| 1430 if (!shared_main_thread_contexts_.get() || | 1433 if (!shared_main_thread_contexts_.get() || |
| 1431 shared_main_thread_contexts_->ContextGL()->GetGraphicsResetStatusKHR() != | 1434 shared_main_thread_contexts_->ContextGL()->GetGraphicsResetStatusKHR() != |
| 1432 GL_NO_ERROR) { | 1435 GL_NO_ERROR) { |
| 1433 shared_main_thread_contexts_ = ContextProviderCommandBuffer::Create( | 1436 scoped_refptr<ContextProviderCommandBuffer> context_provider = |
| 1434 CreateOffscreenContext3d(), RENDERER_MAINTHREAD_CONTEXT); | 1437 ContextProviderCommandBuffer::Create(CreateOffscreenContext3d(), |
| 1435 if (shared_main_thread_contexts_.get() && | 1438 RENDERER_MAINTHREAD_CONTEXT); |
| 1436 !shared_main_thread_contexts_->BindToCurrentThread()) | 1439 if (!context_provider.get()) { |
| 1440 LOG(ERROR) << "Failed to get context3d for media player"; | |
| 1441 return NULL; | |
| 1442 } | |
| 1443 if (context_provider.get() && context_provider->BindToCurrentThread()) { | |
| 1444 #if defined(OS_ANDROID) | |
| 1445 // Create shared StreamTextureFactoryImpl per RenderThreadImpl when we | |
|
no sievers
2015/11/06 22:08:41
can you move this android block to GetStreamTextur
sivag
2015/11/09 14:06:32
Done.
| |
| 1446 // create ContextProviderCommandBuffer. | |
| 1447 scoped_refptr<GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( | |
| 1448 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE)); | |
| 1449 if (!gpu_channel_host.get()) { | |
| 1450 LOG(ERROR) << "Failed to establish GPU channel for media player"; | |
| 1451 stream_texture_factory_ = NULL; | |
| 1452 } else { | |
| 1453 stream_texture_factory_ = StreamTextureFactoryImpl::Create( | |
| 1454 context_provider, gpu_channel_host.get()); | |
| 1455 } | |
| 1456 #endif | |
| 1457 shared_main_thread_contexts_ = context_provider; | |
| 1458 } else | |
| 1437 shared_main_thread_contexts_ = NULL; | 1459 shared_main_thread_contexts_ = NULL; |
| 1438 } | 1460 } |
| 1439 return shared_main_thread_contexts_; | 1461 return shared_main_thread_contexts_; |
| 1440 } | 1462 } |
| 1441 | 1463 |
| 1464 #if defined(OS_ANDROID) | |
| 1465 scoped_refptr<StreamTextureFactory> RenderThreadImpl::GetStreamTexureFactory() { | |
| 1466 DCHECK(IsMainThread()); | |
| 1467 if (!stream_texture_factory_.get()) { | |
| 1468 // StreamTextureFactoryImpl is created while creating | |
| 1469 // ContextProviderCommandBuffer. | |
| 1470 SharedMainThreadContextProvider(); | |
| 1471 } | |
| 1472 return stream_texture_factory_; | |
| 1473 } | |
| 1474 #endif | |
| 1475 | |
| 1442 AudioRendererMixerManager* RenderThreadImpl::GetAudioRendererMixerManager() { | 1476 AudioRendererMixerManager* RenderThreadImpl::GetAudioRendererMixerManager() { |
| 1443 if (!audio_renderer_mixer_manager_) { | 1477 if (!audio_renderer_mixer_manager_) { |
| 1444 audio_renderer_mixer_manager_.reset(new AudioRendererMixerManager()); | 1478 audio_renderer_mixer_manager_.reset(new AudioRendererMixerManager()); |
| 1445 } | 1479 } |
| 1446 | 1480 |
| 1447 return audio_renderer_mixer_manager_.get(); | 1481 return audio_renderer_mixer_manager_.get(); |
| 1448 } | 1482 } |
| 1449 | 1483 |
| 1450 media::AudioHardwareConfig* RenderThreadImpl::GetAudioHardwareConfig() { | 1484 media::AudioHardwareConfig* RenderThreadImpl::GetAudioHardwareConfig() { |
| 1451 if (!audio_hardware_config_) { | 1485 if (!audio_hardware_config_) { |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2008 } | 2042 } |
| 2009 | 2043 |
| 2010 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | 2044 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { |
| 2011 size_t erased = | 2045 size_t erased = |
| 2012 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | 2046 RenderThreadImpl::current()->pending_render_frame_connects_.erase( |
| 2013 routing_id_); | 2047 routing_id_); |
| 2014 DCHECK_EQ(1u, erased); | 2048 DCHECK_EQ(1u, erased); |
| 2015 } | 2049 } |
| 2016 | 2050 |
| 2017 } // namespace content | 2051 } // namespace content |
| OLD | NEW |