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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_external_begin_frame_s
ource.h" | 162 #include "content/renderer/android/synchronous_compositor_external_begin_frame_s
ource.h" |
163 #include "content/renderer/android/synchronous_compositor_factory.h" | 163 #include "content/renderer/android/synchronous_compositor_factory.h" |
164 #include "content/renderer/android/synchronous_compositor_filter.h" | 164 #include "content/renderer/android/synchronous_compositor_filter.h" |
165 #include "content/renderer/media/android/renderer_demuxer_android.h" | 165 #include "content/renderer/media/android/renderer_demuxer_android.h" |
| 166 #include "content/renderer/media/android/stream_texture_factory_impl.h" |
166 #endif | 167 #endif |
167 | 168 |
168 #if defined(OS_MACOSX) | 169 #if defined(OS_MACOSX) |
169 #include "base/mac/mac_util.h" | 170 #include "base/mac/mac_util.h" |
170 #include "content/renderer/theme_helper_mac.h" | 171 #include "content/renderer/theme_helper_mac.h" |
171 #include "content/renderer/webscrollbarbehavior_impl_mac.h" | 172 #include "content/renderer/webscrollbarbehavior_impl_mac.h" |
172 #endif | 173 #endif |
173 | 174 |
174 #if defined(OS_POSIX) | 175 #if defined(OS_POSIX) |
175 #include "ipc/ipc_channel_posix.h" | 176 #include "ipc/ipc_channel_posix.h" |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 if (compositor_message_filter_.get()) { | 862 if (compositor_message_filter_.get()) { |
862 RemoveFilter(compositor_message_filter_.get()); | 863 RemoveFilter(compositor_message_filter_.get()); |
863 compositor_message_filter_ = NULL; | 864 compositor_message_filter_ = NULL; |
864 } | 865 } |
865 | 866 |
866 #if defined(OS_ANDROID) | 867 #if defined(OS_ANDROID) |
867 if (sync_compositor_message_filter_) { | 868 if (sync_compositor_message_filter_) { |
868 RemoveFilter(sync_compositor_message_filter_.get()); | 869 RemoveFilter(sync_compositor_message_filter_.get()); |
869 sync_compositor_message_filter_ = nullptr; | 870 sync_compositor_message_filter_ = nullptr; |
870 } | 871 } |
| 872 stream_texture_factory_ = nullptr; |
871 #endif | 873 #endif |
872 | 874 |
873 media_thread_.reset(); | 875 media_thread_.reset(); |
874 | 876 |
875 compositor_thread_.reset(); | 877 compositor_thread_.reset(); |
876 | 878 |
877 // AudioMessageFilter may be accessed on |media_thread_|, so shutdown after. | 879 // AudioMessageFilter may be accessed on |media_thread_|, so shutdown after. |
878 RemoveFilter(audio_message_filter_.get()); | 880 RemoveFilter(audio_message_filter_.get()); |
879 audio_message_filter_ = NULL; | 881 audio_message_filter_ = NULL; |
880 | 882 |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1461 GL_NO_ERROR) { | 1463 GL_NO_ERROR) { |
1462 shared_main_thread_contexts_ = ContextProviderCommandBuffer::Create( | 1464 shared_main_thread_contexts_ = ContextProviderCommandBuffer::Create( |
1463 CreateOffscreenContext3d(), RENDERER_MAINTHREAD_CONTEXT); | 1465 CreateOffscreenContext3d(), RENDERER_MAINTHREAD_CONTEXT); |
1464 if (shared_main_thread_contexts_.get() && | 1466 if (shared_main_thread_contexts_.get() && |
1465 !shared_main_thread_contexts_->BindToCurrentThread()) | 1467 !shared_main_thread_contexts_->BindToCurrentThread()) |
1466 shared_main_thread_contexts_ = NULL; | 1468 shared_main_thread_contexts_ = NULL; |
1467 } | 1469 } |
1468 return shared_main_thread_contexts_; | 1470 return shared_main_thread_contexts_; |
1469 } | 1471 } |
1470 | 1472 |
| 1473 #if defined(OS_ANDROID) |
| 1474 scoped_refptr<StreamTextureFactory> RenderThreadImpl::GetStreamTexureFactory() { |
| 1475 DCHECK(IsMainThread()); |
| 1476 if (!stream_texture_factory_.get() || |
| 1477 stream_texture_factory_->ContextGL()->GetGraphicsResetStatusKHR() != |
| 1478 GL_NO_ERROR) { |
| 1479 if (!SharedMainThreadContextProvider().get()) { |
| 1480 stream_texture_factory_ = NULL; |
| 1481 return NULL; |
| 1482 } |
| 1483 scoped_refptr<GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( |
| 1484 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE)); |
| 1485 if (!gpu_channel_host.get()) { |
| 1486 LOG(ERROR) << "Failed to establish GPU channel for media player"; |
| 1487 stream_texture_factory_ = NULL; |
| 1488 } else { |
| 1489 stream_texture_factory_ = StreamTextureFactoryImpl::Create( |
| 1490 shared_main_thread_contexts_, gpu_channel_host.get()); |
| 1491 } |
| 1492 } |
| 1493 return stream_texture_factory_; |
| 1494 } |
| 1495 #endif |
| 1496 |
1471 AudioRendererMixerManager* RenderThreadImpl::GetAudioRendererMixerManager() { | 1497 AudioRendererMixerManager* RenderThreadImpl::GetAudioRendererMixerManager() { |
1472 if (!audio_renderer_mixer_manager_) { | 1498 if (!audio_renderer_mixer_manager_) { |
1473 audio_renderer_mixer_manager_.reset(new AudioRendererMixerManager()); | 1499 audio_renderer_mixer_manager_.reset(new AudioRendererMixerManager()); |
1474 } | 1500 } |
1475 | 1501 |
1476 return audio_renderer_mixer_manager_.get(); | 1502 return audio_renderer_mixer_manager_.get(); |
1477 } | 1503 } |
1478 | 1504 |
1479 media::AudioHardwareConfig* RenderThreadImpl::GetAudioHardwareConfig() { | 1505 media::AudioHardwareConfig* RenderThreadImpl::GetAudioHardwareConfig() { |
1480 if (!audio_hardware_config_) { | 1506 if (!audio_hardware_config_) { |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2042 } | 2068 } |
2043 | 2069 |
2044 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | 2070 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { |
2045 size_t erased = | 2071 size_t erased = |
2046 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | 2072 RenderThreadImpl::current()->pending_render_frame_connects_.erase( |
2047 routing_id_); | 2073 routing_id_); |
2048 DCHECK_EQ(1u, erased); | 2074 DCHECK_EQ(1u, erased); |
2049 } | 2075 } |
2050 | 2076 |
2051 } // namespace content | 2077 } // namespace content |
OLD | NEW |