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 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1631 scoped_refptr<base::SingleThreadTaskRunner> | 1631 scoped_refptr<base::SingleThreadTaskRunner> |
1632 RenderThreadImpl::GetCompositorImplThreadTaskRunner() { | 1632 RenderThreadImpl::GetCompositorImplThreadTaskRunner() { |
1633 return compositor_task_runner_; | 1633 return compositor_task_runner_; |
1634 } | 1634 } |
1635 | 1635 |
1636 gpu::GpuMemoryBufferManager* RenderThreadImpl::GetGpuMemoryBufferManager() { | 1636 gpu::GpuMemoryBufferManager* RenderThreadImpl::GetGpuMemoryBufferManager() { |
1637 #if defined(USE_AURA) | 1637 #if defined(USE_AURA) |
1638 if (gpu_service_) | 1638 if (gpu_service_) |
1639 return gpu_service_->gpu_memory_buffer_manager(); | 1639 return gpu_service_->gpu_memory_buffer_manager(); |
1640 #endif | 1640 #endif |
1641 return gpu_memory_buffer_manager(); | 1641 if (!gpu_memory_buffer_manager_) { |
1642 gpu_memory_buffer_manager_ = | |
reveman
2016/10/03 15:37:40
Can you initialize this in RenderThreadImpl::Init
sadrul
2016/10/03 21:24:20
Done.
| |
1643 base::MakeUnique<ChildGpuMemoryBufferManager>(thread_safe_sender()); | |
1644 } | |
1645 | |
1646 return gpu_memory_buffer_manager_.get(); | |
1642 } | 1647 } |
1643 | 1648 |
1644 blink::scheduler::RendererScheduler* RenderThreadImpl::GetRendererScheduler() { | 1649 blink::scheduler::RendererScheduler* RenderThreadImpl::GetRendererScheduler() { |
1645 return renderer_scheduler_.get(); | 1650 return renderer_scheduler_.get(); |
1646 } | 1651 } |
1647 | 1652 |
1648 std::unique_ptr<cc::BeginFrameSource> | 1653 std::unique_ptr<cc::BeginFrameSource> |
1649 RenderThreadImpl::CreateExternalBeginFrameSource(int routing_id) { | 1654 RenderThreadImpl::CreateExternalBeginFrameSource(int routing_id) { |
1650 const base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 1655 const base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
1651 if (cmd->HasSwitch(switches::kDisableGpuVsync)) { | 1656 if (cmd->HasSwitch(switches::kDisableGpuVsync)) { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1850 } | 1855 } |
1851 GetContentClient()->SetGpuInfo(gpu_info); | 1856 GetContentClient()->SetGpuInfo(gpu_info); |
1852 | 1857 |
1853 // Cache some variables that are needed on the compositor thread for our | 1858 // Cache some variables that are needed on the compositor thread for our |
1854 // implementation of GpuChannelHostFactory. | 1859 // implementation of GpuChannelHostFactory. |
1855 io_thread_task_runner_ = ChildProcess::current()->io_task_runner(); | 1860 io_thread_task_runner_ = ChildProcess::current()->io_task_runner(); |
1856 | 1861 |
1857 gpu_channel_ = | 1862 gpu_channel_ = |
1858 gpu::GpuChannelHost::Create(this, client_id, gpu_info, channel_handle, | 1863 gpu::GpuChannelHost::Create(this, client_id, gpu_info, channel_handle, |
1859 ChildProcess::current()->GetShutDownEvent(), | 1864 ChildProcess::current()->GetShutDownEvent(), |
1860 gpu_memory_buffer_manager()); | 1865 GetGpuMemoryBufferManager()); |
1861 } else { | 1866 } else { |
1862 #if defined(USE_AURA) | 1867 #if defined(USE_AURA) |
1863 gpu_channel_ = gpu_service_->EstablishGpuChannelSync(); | 1868 gpu_channel_ = gpu_service_->EstablishGpuChannelSync(); |
1864 #else | 1869 #else |
1865 NOTREACHED(); | 1870 NOTREACHED(); |
1866 #endif | 1871 #endif |
1867 } | 1872 } |
1868 return gpu_channel_; | 1873 return gpu_channel_; |
1869 } | 1874 } |
1870 | 1875 |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2331 } | 2336 } |
2332 } | 2337 } |
2333 | 2338 |
2334 void RenderThreadImpl::OnRendererInterfaceRequest( | 2339 void RenderThreadImpl::OnRendererInterfaceRequest( |
2335 mojom::RendererAssociatedRequest request) { | 2340 mojom::RendererAssociatedRequest request) { |
2336 DCHECK(!renderer_binding_.is_bound()); | 2341 DCHECK(!renderer_binding_.is_bound()); |
2337 renderer_binding_.Bind(std::move(request)); | 2342 renderer_binding_.Bind(std::move(request)); |
2338 } | 2343 } |
2339 | 2344 |
2340 } // namespace content | 2345 } // namespace content |
OLD | NEW |