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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 #include "ui/base/layout.h" | 157 #include "ui/base/layout.h" |
158 #include "ui/base/ui_base_switches.h" | 158 #include "ui/base/ui_base_switches.h" |
159 #include "v8/include/v8.h" | 159 #include "v8/include/v8.h" |
160 | 160 |
161 #if defined(OS_ANDROID) | 161 #if defined(OS_ANDROID) |
162 #include <cpu-features.h> | 162 #include <cpu-features.h> |
163 #include "content/renderer/android/synchronous_compositor_external_begin_frame_s ource.h" | 163 #include "content/renderer/android/synchronous_compositor_external_begin_frame_s ource.h" |
164 #include "content/renderer/android/synchronous_compositor_factory.h" | 164 #include "content/renderer/android/synchronous_compositor_factory.h" |
165 #include "content/renderer/android/synchronous_compositor_filter.h" | 165 #include "content/renderer/android/synchronous_compositor_filter.h" |
166 #include "content/renderer/media/android/renderer_demuxer_android.h" | 166 #include "content/renderer/media/android/renderer_demuxer_android.h" |
167 #include "content/renderer/media/android/stream_texture_factory_impl.h" | |
167 #endif | 168 #endif |
168 | 169 |
169 #if defined(OS_MACOSX) | 170 #if defined(OS_MACOSX) |
170 #include "base/mac/mac_util.h" | 171 #include "base/mac/mac_util.h" |
171 #include "content/renderer/theme_helper_mac.h" | 172 #include "content/renderer/theme_helper_mac.h" |
172 #include "content/renderer/webscrollbarbehavior_impl_mac.h" | 173 #include "content/renderer/webscrollbarbehavior_impl_mac.h" |
173 #endif | 174 #endif |
174 | 175 |
175 #if defined(OS_POSIX) | 176 #if defined(OS_POSIX) |
176 #include "ipc/ipc_channel_posix.h" | 177 #include "ipc/ipc_channel_posix.h" |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
862 if (compositor_message_filter_.get()) { | 863 if (compositor_message_filter_.get()) { |
863 RemoveFilter(compositor_message_filter_.get()); | 864 RemoveFilter(compositor_message_filter_.get()); |
864 compositor_message_filter_ = NULL; | 865 compositor_message_filter_ = NULL; |
865 } | 866 } |
866 | 867 |
867 #if defined(OS_ANDROID) | 868 #if defined(OS_ANDROID) |
868 if (sync_compositor_message_filter_) { | 869 if (sync_compositor_message_filter_) { |
869 RemoveFilter(sync_compositor_message_filter_.get()); | 870 RemoveFilter(sync_compositor_message_filter_.get()); |
870 sync_compositor_message_filter_ = nullptr; | 871 sync_compositor_message_filter_ = nullptr; |
871 } | 872 } |
873 stream_texture_factory_ = nullptr; | |
872 #endif | 874 #endif |
873 | 875 |
874 media_thread_.reset(); | 876 media_thread_.reset(); |
875 | 877 |
876 compositor_thread_.reset(); | 878 compositor_thread_.reset(); |
877 | 879 |
878 // AudioMessageFilter may be accessed on |media_thread_|, so shutdown after. | 880 // AudioMessageFilter may be accessed on |media_thread_|, so shutdown after. |
879 RemoveFilter(audio_message_filter_.get()); | 881 RemoveFilter(audio_message_filter_.get()); |
880 audio_message_filter_ = NULL; | 882 audio_message_filter_ = NULL; |
881 | 883 |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1457 GL_NO_ERROR) { | 1459 GL_NO_ERROR) { |
1458 shared_main_thread_contexts_ = ContextProviderCommandBuffer::Create( | 1460 shared_main_thread_contexts_ = ContextProviderCommandBuffer::Create( |
1459 CreateOffscreenContext3d(), RENDERER_MAINTHREAD_CONTEXT); | 1461 CreateOffscreenContext3d(), RENDERER_MAINTHREAD_CONTEXT); |
1460 if (shared_main_thread_contexts_.get() && | 1462 if (shared_main_thread_contexts_.get() && |
1461 !shared_main_thread_contexts_->BindToCurrentThread()) | 1463 !shared_main_thread_contexts_->BindToCurrentThread()) |
1462 shared_main_thread_contexts_ = NULL; | 1464 shared_main_thread_contexts_ = NULL; |
1463 } | 1465 } |
1464 return shared_main_thread_contexts_; | 1466 return shared_main_thread_contexts_; |
1465 } | 1467 } |
1466 | 1468 |
1469 #if defined(OS_ANDROID) | |
1470 scoped_refptr<StreamTextureFactory> RenderThreadImpl::GetStreamTexureFactory() { | |
1471 DCHECK(IsMainThread()); | |
1472 if (!SharedMainThreadContextProvider().get()) { | |
1473 stream_texture_factory_ = NULL; | |
1474 return NULL; | |
1475 } | |
1476 // Create shared StreamTextureFactoryImpl per RenderThreadImpl when we | |
1477 // create ContextProviderCommandBuffer. | |
1478 scoped_refptr<GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( | |
1479 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE)); | |
1480 if (!gpu_channel_host.get()) { | |
1481 LOG(ERROR) << "Failed to establish GPU channel for media player"; | |
1482 stream_texture_factory_ = NULL; | |
1483 } else { | |
1484 stream_texture_factory_ = StreamTextureFactoryImpl::Create( | |
no sievers
2015/11/09 21:27:34
If you are creating a new factory every time, then
sivag
2015/11/10 13:18:56
Done.
| |
1485 shared_main_thread_contexts_, gpu_channel_host.get()); | |
1486 } | |
1487 return stream_texture_factory_; | |
1488 } | |
1489 #endif | |
1490 | |
1467 AudioRendererMixerManager* RenderThreadImpl::GetAudioRendererMixerManager() { | 1491 AudioRendererMixerManager* RenderThreadImpl::GetAudioRendererMixerManager() { |
1468 if (!audio_renderer_mixer_manager_) { | 1492 if (!audio_renderer_mixer_manager_) { |
1469 audio_renderer_mixer_manager_.reset(new AudioRendererMixerManager()); | 1493 audio_renderer_mixer_manager_.reset(new AudioRendererMixerManager()); |
1470 } | 1494 } |
1471 | 1495 |
1472 return audio_renderer_mixer_manager_.get(); | 1496 return audio_renderer_mixer_manager_.get(); |
1473 } | 1497 } |
1474 | 1498 |
1475 media::AudioHardwareConfig* RenderThreadImpl::GetAudioHardwareConfig() { | 1499 media::AudioHardwareConfig* RenderThreadImpl::GetAudioHardwareConfig() { |
1476 if (!audio_hardware_config_) { | 1500 if (!audio_hardware_config_) { |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2037 } | 2061 } |
2038 | 2062 |
2039 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | 2063 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { |
2040 size_t erased = | 2064 size_t erased = |
2041 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | 2065 RenderThreadImpl::current()->pending_render_frame_connects_.erase( |
2042 routing_id_); | 2066 routing_id_); |
2043 DCHECK_EQ(1u, erased); | 2067 DCHECK_EQ(1u, erased); |
2044 } | 2068 } |
2045 | 2069 |
2046 } // namespace content | 2070 } // namespace content |
OLD | NEW |