| 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 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 media::GpuVideoAcceleratorFactories* RenderThreadImpl::GetGpuFactories() { | 1335 media::GpuVideoAcceleratorFactories* RenderThreadImpl::GetGpuFactories() { |
| 1336 DCHECK(IsMainThread()); | 1336 DCHECK(IsMainThread()); |
| 1337 | 1337 |
| 1338 if (!gpu_factories_.empty()) { | 1338 if (!gpu_factories_.empty()) { |
| 1339 scoped_refptr<ui::ContextProviderCommandBuffer> shared_context_provider = | 1339 scoped_refptr<ui::ContextProviderCommandBuffer> shared_context_provider = |
| 1340 gpu_factories_.back()->ContextProviderMainThread(); | 1340 gpu_factories_.back()->ContextProviderMainThread(); |
| 1341 if (shared_context_provider) { | 1341 if (shared_context_provider) { |
| 1342 cc::ContextProvider::ScopedContextLock lock( | 1342 cc::ContextProvider::ScopedContextLock lock( |
| 1343 shared_context_provider.get()); | 1343 shared_context_provider.get()); |
| 1344 if (lock.ContextGL()->GetGraphicsResetStatusKHR() == GL_NO_ERROR) { | 1344 if (lock.ContextGL()->GetGraphicsResetStatusKHR() == GL_NO_ERROR) { |
| 1345 return gpu_factories_.back(); | 1345 return gpu_factories_.back().get(); |
| 1346 } else { | 1346 } else { |
| 1347 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner = | 1347 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner = |
| 1348 GetMediaThreadTaskRunner(); | 1348 GetMediaThreadTaskRunner(); |
| 1349 media_task_runner->PostTask( | 1349 media_task_runner->PostTask( |
| 1350 FROM_HERE, | 1350 FROM_HERE, |
| 1351 base::Bind( | 1351 base::Bind( |
| 1352 base::IgnoreResult( | 1352 base::IgnoreResult( |
| 1353 &RendererGpuVideoAcceleratorFactories::CheckContextLost), | 1353 &RendererGpuVideoAcceleratorFactories::CheckContextLost), |
| 1354 base::Unretained(gpu_factories_.back()))); | 1354 base::Unretained(gpu_factories_.back().get()))); |
| 1355 } | 1355 } |
| 1356 } | 1356 } |
| 1357 } | 1357 } |
| 1358 | 1358 |
| 1359 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 1359 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 1360 | 1360 |
| 1361 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host = | 1361 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host = |
| 1362 EstablishGpuChannelSync(); | 1362 EstablishGpuChannelSync(); |
| 1363 if (!gpu_channel_host) | 1363 if (!gpu_channel_host) |
| 1364 return nullptr; | 1364 return nullptr; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1385 !gpu_channel_host->gpu_info().software_rendering; | 1385 !gpu_channel_host->gpu_info().software_rendering; |
| 1386 #else | 1386 #else |
| 1387 cmd_line->HasSwitch(switches::kEnableGpuMemoryBufferVideoFrames); | 1387 cmd_line->HasSwitch(switches::kEnableGpuMemoryBufferVideoFrames); |
| 1388 #endif | 1388 #endif |
| 1389 | 1389 |
| 1390 gpu_factories_.push_back(RendererGpuVideoAcceleratorFactories::Create( | 1390 gpu_factories_.push_back(RendererGpuVideoAcceleratorFactories::Create( |
| 1391 std::move(gpu_channel_host), base::ThreadTaskRunnerHandle::Get(), | 1391 std::move(gpu_channel_host), base::ThreadTaskRunnerHandle::Get(), |
| 1392 media_task_runner, std::move(media_context_provider), | 1392 media_task_runner, std::move(media_context_provider), |
| 1393 enable_gpu_memory_buffer_video_frames, buffer_to_texture_target_map_, | 1393 enable_gpu_memory_buffer_video_frames, buffer_to_texture_target_map_, |
| 1394 enable_video_accelerator)); | 1394 enable_video_accelerator)); |
| 1395 return gpu_factories_.back(); | 1395 return gpu_factories_.back().get(); |
| 1396 } | 1396 } |
| 1397 | 1397 |
| 1398 scoped_refptr<ui::ContextProviderCommandBuffer> | 1398 scoped_refptr<ui::ContextProviderCommandBuffer> |
| 1399 RenderThreadImpl::SharedMainThreadContextProvider() { | 1399 RenderThreadImpl::SharedMainThreadContextProvider() { |
| 1400 DCHECK(IsMainThread()); | 1400 DCHECK(IsMainThread()); |
| 1401 if (shared_main_thread_contexts_ && | 1401 if (shared_main_thread_contexts_ && |
| 1402 shared_main_thread_contexts_->ContextGL()->GetGraphicsResetStatusKHR() == | 1402 shared_main_thread_contexts_->ContextGL()->GetGraphicsResetStatusKHR() == |
| 1403 GL_NO_ERROR) | 1403 GL_NO_ERROR) |
| 1404 return shared_main_thread_contexts_; | 1404 return shared_main_thread_contexts_; |
| 1405 | 1405 |
| (...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2380 } | 2380 } |
| 2381 } | 2381 } |
| 2382 | 2382 |
| 2383 void RenderThreadImpl::OnRendererInterfaceRequest( | 2383 void RenderThreadImpl::OnRendererInterfaceRequest( |
| 2384 mojom::RendererAssociatedRequest request) { | 2384 mojom::RendererAssociatedRequest request) { |
| 2385 DCHECK(!renderer_binding_.is_bound()); | 2385 DCHECK(!renderer_binding_.is_bound()); |
| 2386 renderer_binding_.Bind(std::move(request)); | 2386 renderer_binding_.Bind(std::move(request)); |
| 2387 } | 2387 } |
| 2388 | 2388 |
| 2389 } // namespace content | 2389 } // namespace content |
| OLD | NEW |