| 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 <utility> | 10 #include <utility> |
| (...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 CreateOffscreenContext3d(), RENDERER_MAINTHREAD_CONTEXT); | 1527 CreateOffscreenContext3d(), RENDERER_MAINTHREAD_CONTEXT); |
| 1528 if (shared_main_thread_contexts_.get() && | 1528 if (shared_main_thread_contexts_.get() && |
| 1529 !shared_main_thread_contexts_->BindToCurrentThread()) | 1529 !shared_main_thread_contexts_->BindToCurrentThread()) |
| 1530 shared_main_thread_contexts_ = NULL; | 1530 shared_main_thread_contexts_ = NULL; |
| 1531 } | 1531 } |
| 1532 return shared_main_thread_contexts_; | 1532 return shared_main_thread_contexts_; |
| 1533 } | 1533 } |
| 1534 | 1534 |
| 1535 #if defined(OS_ANDROID) | 1535 #if defined(OS_ANDROID) |
| 1536 | 1536 |
| 1537 namespace { | |
| 1538 base::LazyInstance<scoped_refptr<StreamTextureFactory>> | |
| 1539 g_stream_texture_factory_override; | |
| 1540 } | |
| 1541 | |
| 1542 // static | |
| 1543 void RenderThreadImpl::SetStreamTextureFactory( | |
| 1544 scoped_refptr<StreamTextureFactory> factory) { | |
| 1545 g_stream_texture_factory_override.Get() = factory; | |
| 1546 } | |
| 1547 | |
| 1548 scoped_refptr<StreamTextureFactory> RenderThreadImpl::GetStreamTexureFactory() { | 1537 scoped_refptr<StreamTextureFactory> RenderThreadImpl::GetStreamTexureFactory() { |
| 1549 DCHECK(IsMainThread()); | 1538 DCHECK(IsMainThread()); |
| 1550 if (g_stream_texture_factory_override.Get()) { | 1539 if (!stream_texture_factory_.get() || |
| 1551 stream_texture_factory_ = g_stream_texture_factory_override.Get(); | 1540 stream_texture_factory_->ContextGL()->GetGraphicsResetStatusKHR() != |
| 1552 } else if (!stream_texture_factory_.get() || | 1541 GL_NO_ERROR) { |
| 1553 stream_texture_factory_->ContextGL() | |
| 1554 ->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { | |
| 1555 if (!SharedMainThreadContextProvider().get()) { | 1542 if (!SharedMainThreadContextProvider().get()) { |
| 1556 stream_texture_factory_ = NULL; | 1543 stream_texture_factory_ = NULL; |
| 1557 return NULL; | 1544 return NULL; |
| 1558 } | 1545 } |
| 1559 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( | 1546 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( |
| 1560 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE)); | 1547 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE)); |
| 1561 if (!gpu_channel_host.get()) { | 1548 if (!gpu_channel_host.get()) { |
| 1562 LOG(ERROR) << "Failed to establish GPU channel for media player"; | 1549 LOG(ERROR) << "Failed to establish GPU channel for media player"; |
| 1563 stream_texture_factory_ = NULL; | 1550 stream_texture_factory_ = NULL; |
| 1564 } else { | 1551 } else { |
| 1565 stream_texture_factory_ = StreamTextureFactoryImpl::Create( | 1552 stream_texture_factory_ = StreamTextureFactoryImpl::Create( |
| 1566 shared_main_thread_contexts_, gpu_channel_host.get()); | 1553 shared_main_thread_contexts_, gpu_channel_host.get()); |
| 1567 } | 1554 } |
| 1568 } | 1555 } |
| 1569 return stream_texture_factory_; | 1556 return stream_texture_factory_; |
| 1570 } | 1557 } |
| 1571 | 1558 |
| 1572 bool RenderThreadImpl::EnableStreamTextureCopy() { | 1559 bool RenderThreadImpl::EnableStreamTextureCopy() { |
| 1573 return !g_stream_texture_factory_override.Get() && | 1560 return sync_compositor_message_filter_.get(); |
| 1574 sync_compositor_message_filter_.get(); | |
| 1575 } | 1561 } |
| 1576 | 1562 |
| 1577 #endif | 1563 #endif |
| 1578 | 1564 |
| 1579 AudioRendererMixerManager* RenderThreadImpl::GetAudioRendererMixerManager() { | 1565 AudioRendererMixerManager* RenderThreadImpl::GetAudioRendererMixerManager() { |
| 1580 if (!audio_renderer_mixer_manager_) { | 1566 if (!audio_renderer_mixer_manager_) { |
| 1581 audio_renderer_mixer_manager_.reset(new AudioRendererMixerManager()); | 1567 audio_renderer_mixer_manager_.reset(new AudioRendererMixerManager()); |
| 1582 } | 1568 } |
| 1583 | 1569 |
| 1584 return audio_renderer_mixer_manager_.get(); | 1570 return audio_renderer_mixer_manager_.get(); |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2147 } | 2133 } |
| 2148 | 2134 |
| 2149 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | 2135 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { |
| 2150 size_t erased = | 2136 size_t erased = |
| 2151 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | 2137 RenderThreadImpl::current()->pending_render_frame_connects_.erase( |
| 2152 routing_id_); | 2138 routing_id_); |
| 2153 DCHECK_EQ(1u, erased); | 2139 DCHECK_EQ(1u, erased); |
| 2154 } | 2140 } |
| 2155 | 2141 |
| 2156 } // namespace content | 2142 } // namespace content |
| OLD | NEW |