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 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 // Register this object as the main thread. | 648 // Register this object as the main thread. |
649 ChildProcess::current()->set_main_thread(this); | 649 ChildProcess::current()->set_main_thread(this); |
650 | 650 |
651 #if defined(USE_AURA) | 651 #if defined(USE_AURA) |
652 if (IsRunningInMash()) { | 652 if (IsRunningInMash()) { |
653 gpu_service_ = | 653 gpu_service_ = |
654 ui::GpuService::Create(GetMojoShellConnection()->GetConnector(), | 654 ui::GpuService::Create(GetMojoShellConnection()->GetConnector(), |
655 ChildProcess::current()->io_task_runner()); | 655 ChildProcess::current()->io_task_runner()); |
656 } | 656 } |
657 #endif | 657 #endif |
| 658 gpu_memory_buffer_manager_ = |
| 659 base::MakeUnique<ChildGpuMemoryBufferManager>(thread_safe_sender()); |
658 | 660 |
659 InitializeWebKit(resource_task_queue); | 661 InitializeWebKit(resource_task_queue); |
660 | 662 |
661 // In single process the single process is all there is. | 663 // In single process the single process is all there is. |
662 webkit_shared_timer_suspended_ = false; | 664 webkit_shared_timer_suspended_ = false; |
663 widget_count_ = 0; | 665 widget_count_ = 0; |
664 hidden_widget_count_ = 0; | 666 hidden_widget_count_ = 0; |
665 idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs; | 667 idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs; |
666 idle_notifications_to_skip_ = 0; | 668 idle_notifications_to_skip_ = 0; |
667 | 669 |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 scoped_refptr<base::SingleThreadTaskRunner> | 1633 scoped_refptr<base::SingleThreadTaskRunner> |
1632 RenderThreadImpl::GetCompositorImplThreadTaskRunner() { | 1634 RenderThreadImpl::GetCompositorImplThreadTaskRunner() { |
1633 return compositor_task_runner_; | 1635 return compositor_task_runner_; |
1634 } | 1636 } |
1635 | 1637 |
1636 gpu::GpuMemoryBufferManager* RenderThreadImpl::GetGpuMemoryBufferManager() { | 1638 gpu::GpuMemoryBufferManager* RenderThreadImpl::GetGpuMemoryBufferManager() { |
1637 #if defined(USE_AURA) | 1639 #if defined(USE_AURA) |
1638 if (gpu_service_) | 1640 if (gpu_service_) |
1639 return gpu_service_->gpu_memory_buffer_manager(); | 1641 return gpu_service_->gpu_memory_buffer_manager(); |
1640 #endif | 1642 #endif |
1641 return gpu_memory_buffer_manager(); | 1643 return gpu_memory_buffer_manager_.get(); |
1642 } | 1644 } |
1643 | 1645 |
1644 blink::scheduler::RendererScheduler* RenderThreadImpl::GetRendererScheduler() { | 1646 blink::scheduler::RendererScheduler* RenderThreadImpl::GetRendererScheduler() { |
1645 return renderer_scheduler_.get(); | 1647 return renderer_scheduler_.get(); |
1646 } | 1648 } |
1647 | 1649 |
1648 std::unique_ptr<cc::BeginFrameSource> | 1650 std::unique_ptr<cc::BeginFrameSource> |
1649 RenderThreadImpl::CreateExternalBeginFrameSource(int routing_id) { | 1651 RenderThreadImpl::CreateExternalBeginFrameSource(int routing_id) { |
1650 const base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 1652 const base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
1651 if (cmd->HasSwitch(switches::kDisableGpuVsync)) { | 1653 if (cmd->HasSwitch(switches::kDisableGpuVsync)) { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1850 } | 1852 } |
1851 GetContentClient()->SetGpuInfo(gpu_info); | 1853 GetContentClient()->SetGpuInfo(gpu_info); |
1852 | 1854 |
1853 // Cache some variables that are needed on the compositor thread for our | 1855 // Cache some variables that are needed on the compositor thread for our |
1854 // implementation of GpuChannelHostFactory. | 1856 // implementation of GpuChannelHostFactory. |
1855 io_thread_task_runner_ = ChildProcess::current()->io_task_runner(); | 1857 io_thread_task_runner_ = ChildProcess::current()->io_task_runner(); |
1856 | 1858 |
1857 gpu_channel_ = | 1859 gpu_channel_ = |
1858 gpu::GpuChannelHost::Create(this, client_id, gpu_info, channel_handle, | 1860 gpu::GpuChannelHost::Create(this, client_id, gpu_info, channel_handle, |
1859 ChildProcess::current()->GetShutDownEvent(), | 1861 ChildProcess::current()->GetShutDownEvent(), |
1860 gpu_memory_buffer_manager()); | 1862 GetGpuMemoryBufferManager()); |
1861 } else { | 1863 } else { |
1862 #if defined(USE_AURA) | 1864 #if defined(USE_AURA) |
1863 gpu_channel_ = gpu_service_->EstablishGpuChannelSync(); | 1865 gpu_channel_ = gpu_service_->EstablishGpuChannelSync(); |
1864 #else | 1866 #else |
1865 NOTREACHED(); | 1867 NOTREACHED(); |
1866 #endif | 1868 #endif |
1867 } | 1869 } |
1868 return gpu_channel_; | 1870 return gpu_channel_; |
1869 } | 1871 } |
1870 | 1872 |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2331 } | 2333 } |
2332 } | 2334 } |
2333 | 2335 |
2334 void RenderThreadImpl::OnRendererInterfaceRequest( | 2336 void RenderThreadImpl::OnRendererInterfaceRequest( |
2335 mojom::RendererAssociatedRequest request) { | 2337 mojom::RendererAssociatedRequest request) { |
2336 DCHECK(!renderer_binding_.is_bound()); | 2338 DCHECK(!renderer_binding_.is_bound()); |
2337 renderer_binding_.Bind(std::move(request)); | 2339 renderer_binding_.Bind(std::move(request)); |
2338 } | 2340 } |
2339 | 2341 |
2340 } // namespace content | 2342 } // namespace content |
OLD | NEW |