| 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 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 #if defined(OS_ANDROID) | 955 #if defined(OS_ANDROID) |
| 956 if (SynchronousCompositorFactory* factory = | 956 if (SynchronousCompositorFactory* factory = |
| 957 SynchronousCompositorFactory::GetInstance()) { | 957 SynchronousCompositorFactory::GetInstance()) { |
| 958 return factory->GetOffscreenContextProviderForMainThread(); | 958 return factory->GetOffscreenContextProviderForMainThread(); |
| 959 } | 959 } |
| 960 #endif | 960 #endif |
| 961 | 961 |
| 962 if (!shared_contexts_main_thread_.get() || | 962 if (!shared_contexts_main_thread_.get() || |
| 963 shared_contexts_main_thread_->DestroyedOnMainThread()) { | 963 shared_contexts_main_thread_->DestroyedOnMainThread()) { |
| 964 shared_contexts_main_thread_ = | 964 shared_contexts_main_thread_ = |
| 965 ContextProviderCommandBuffer::Create( | 965 ContextProviderCommandBuffer::Create(CreateOffscreenContext3d()); |
| 966 base::Bind(&RenderThreadImpl::CreateOffscreenContext3d, | |
| 967 base::Unretained(this))); | |
| 968 if (shared_contexts_main_thread_.get() && | 966 if (shared_contexts_main_thread_.get() && |
| 969 !shared_contexts_main_thread_->BindToCurrentThread()) | 967 !shared_contexts_main_thread_->BindToCurrentThread()) |
| 970 shared_contexts_main_thread_ = NULL; | 968 shared_contexts_main_thread_ = NULL; |
| 971 } | 969 } |
| 972 return shared_contexts_main_thread_; | 970 return shared_contexts_main_thread_; |
| 973 } | 971 } |
| 974 | 972 |
| 975 scoped_refptr<cc::ContextProvider> | 973 scoped_refptr<cc::ContextProvider> |
| 976 RenderThreadImpl::OffscreenContextProviderForCompositorThread() { | 974 RenderThreadImpl::OffscreenContextProviderForCompositorThread() { |
| 977 DCHECK(IsMainThread()); | 975 DCHECK(IsMainThread()); |
| 978 | 976 |
| 979 #if defined(OS_ANDROID) | 977 #if defined(OS_ANDROID) |
| 980 if (SynchronousCompositorFactory* factory = | 978 if (SynchronousCompositorFactory* factory = |
| 981 SynchronousCompositorFactory::GetInstance()) { | 979 SynchronousCompositorFactory::GetInstance()) { |
| 982 return factory->GetOffscreenContextProviderForCompositorThread(); | 980 return factory->GetOffscreenContextProviderForCompositorThread(); |
| 983 } | 981 } |
| 984 #endif | 982 #endif |
| 985 | 983 |
| 986 if (!shared_contexts_compositor_thread_.get() || | 984 if (!shared_contexts_compositor_thread_.get() || |
| 987 shared_contexts_compositor_thread_->DestroyedOnMainThread()) { | 985 shared_contexts_compositor_thread_->DestroyedOnMainThread()) { |
| 988 shared_contexts_compositor_thread_ = | 986 shared_contexts_compositor_thread_ = |
| 989 ContextProviderCommandBuffer::Create( | 987 ContextProviderCommandBuffer::Create(CreateOffscreenContext3d()); |
| 990 base::Bind(&RenderThreadImpl::CreateOffscreenContext3d, | |
| 991 base::Unretained(this))); | |
| 992 } | 988 } |
| 993 return shared_contexts_compositor_thread_; | 989 return shared_contexts_compositor_thread_; |
| 994 } | 990 } |
| 995 | 991 |
| 996 AudioRendererMixerManager* RenderThreadImpl::GetAudioRendererMixerManager() { | 992 AudioRendererMixerManager* RenderThreadImpl::GetAudioRendererMixerManager() { |
| 997 if (!audio_renderer_mixer_manager_) { | 993 if (!audio_renderer_mixer_manager_) { |
| 998 audio_renderer_mixer_manager_.reset(new AudioRendererMixerManager( | 994 audio_renderer_mixer_manager_.reset(new AudioRendererMixerManager( |
| 999 GetAudioHardwareConfig())); | 995 GetAudioHardwareConfig())); |
| 1000 } | 996 } |
| 1001 | 997 |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1310 | 1306 |
| 1311 } | 1307 } |
| 1312 | 1308 |
| 1313 void RenderThreadImpl::SampleGamepads(WebKit::WebGamepads* data) { | 1309 void RenderThreadImpl::SampleGamepads(WebKit::WebGamepads* data) { |
| 1314 if (!gamepad_shared_memory_reader_) | 1310 if (!gamepad_shared_memory_reader_) |
| 1315 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); | 1311 gamepad_shared_memory_reader_.reset(new GamepadSharedMemoryReader); |
| 1316 gamepad_shared_memory_reader_->SampleGamepads(*data); | 1312 gamepad_shared_memory_reader_->SampleGamepads(*data); |
| 1317 } | 1313 } |
| 1318 | 1314 |
| 1319 } // namespace content | 1315 } // namespace content |
| OLD | NEW |