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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
641 #if defined(USE_EXTERNAL_POPUP_MENU) | 641 #if defined(USE_EXTERNAL_POPUP_MENU) |
642 // On Mac and Android Java UI, the select popups are rendered by the browser. | 642 // On Mac and Android Java UI, the select popups are rendered by the browser. |
643 blink::WebView::setUseExternalPopupMenus(true); | 643 blink::WebView::setUseExternalPopupMenus(true); |
644 #endif | 644 #endif |
645 | 645 |
646 lazy_tls.Pointer()->Set(this); | 646 lazy_tls.Pointer()->Set(this); |
647 | 647 |
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 bool should_create_gpu_memory_buffer_manager = true; | |
651 #if defined(USE_AURA) | 652 #if defined(USE_AURA) |
652 if (IsRunningInMash()) { | 653 if (IsRunningInMash()) { |
653 gpu_service_ = | 654 gpu_service_ = |
654 ui::GpuService::Create(GetMojoShellConnection()->GetConnector(), | 655 ui::GpuService::Create(GetMojoShellConnection()->GetConnector(), |
655 ChildProcess::current()->io_task_runner()); | 656 ChildProcess::current()->io_task_runner()); |
657 should_create_gpu_memory_buffer_manager = false; | |
656 } | 658 } |
657 #endif | 659 #endif |
660 if (should_create_gpu_memory_buffer_manager) { | |
reveman
2016/10/03 21:47:44
nit: I think the overhead of creating this instanc
sadrul
2016/10/04 01:05:31
Done.
| |
661 gpu_memory_buffer_manager_ = | |
662 base::MakeUnique<ChildGpuMemoryBufferManager>(thread_safe_sender()); | |
663 } | |
658 | 664 |
659 InitializeWebKit(resource_task_queue); | 665 InitializeWebKit(resource_task_queue); |
660 | 666 |
661 // In single process the single process is all there is. | 667 // In single process the single process is all there is. |
662 webkit_shared_timer_suspended_ = false; | 668 webkit_shared_timer_suspended_ = false; |
663 widget_count_ = 0; | 669 widget_count_ = 0; |
664 hidden_widget_count_ = 0; | 670 hidden_widget_count_ = 0; |
665 idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs; | 671 idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs; |
666 idle_notifications_to_skip_ = 0; | 672 idle_notifications_to_skip_ = 0; |
667 | 673 |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1631 scoped_refptr<base::SingleThreadTaskRunner> | 1637 scoped_refptr<base::SingleThreadTaskRunner> |
1632 RenderThreadImpl::GetCompositorImplThreadTaskRunner() { | 1638 RenderThreadImpl::GetCompositorImplThreadTaskRunner() { |
1633 return compositor_task_runner_; | 1639 return compositor_task_runner_; |
1634 } | 1640 } |
1635 | 1641 |
1636 gpu::GpuMemoryBufferManager* RenderThreadImpl::GetGpuMemoryBufferManager() { | 1642 gpu::GpuMemoryBufferManager* RenderThreadImpl::GetGpuMemoryBufferManager() { |
1637 #if defined(USE_AURA) | 1643 #if defined(USE_AURA) |
1638 if (gpu_service_) | 1644 if (gpu_service_) |
1639 return gpu_service_->gpu_memory_buffer_manager(); | 1645 return gpu_service_->gpu_memory_buffer_manager(); |
1640 #endif | 1646 #endif |
1641 return gpu_memory_buffer_manager(); | 1647 if (!gpu_memory_buffer_manager_) { |
reveman
2016/10/03 21:47:44
remove this?
sadrul
2016/10/04 01:05:31
Sorry, I was sloppy. Removed.
| |
1648 } | |
1649 | |
1650 return gpu_memory_buffer_manager_.get(); | |
1642 } | 1651 } |
1643 | 1652 |
1644 blink::scheduler::RendererScheduler* RenderThreadImpl::GetRendererScheduler() { | 1653 blink::scheduler::RendererScheduler* RenderThreadImpl::GetRendererScheduler() { |
1645 return renderer_scheduler_.get(); | 1654 return renderer_scheduler_.get(); |
1646 } | 1655 } |
1647 | 1656 |
1648 std::unique_ptr<cc::BeginFrameSource> | 1657 std::unique_ptr<cc::BeginFrameSource> |
1649 RenderThreadImpl::CreateExternalBeginFrameSource(int routing_id) { | 1658 RenderThreadImpl::CreateExternalBeginFrameSource(int routing_id) { |
1650 const base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 1659 const base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
1651 if (cmd->HasSwitch(switches::kDisableGpuVsync)) { | 1660 if (cmd->HasSwitch(switches::kDisableGpuVsync)) { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1850 } | 1859 } |
1851 GetContentClient()->SetGpuInfo(gpu_info); | 1860 GetContentClient()->SetGpuInfo(gpu_info); |
1852 | 1861 |
1853 // Cache some variables that are needed on the compositor thread for our | 1862 // Cache some variables that are needed on the compositor thread for our |
1854 // implementation of GpuChannelHostFactory. | 1863 // implementation of GpuChannelHostFactory. |
1855 io_thread_task_runner_ = ChildProcess::current()->io_task_runner(); | 1864 io_thread_task_runner_ = ChildProcess::current()->io_task_runner(); |
1856 | 1865 |
1857 gpu_channel_ = | 1866 gpu_channel_ = |
1858 gpu::GpuChannelHost::Create(this, client_id, gpu_info, channel_handle, | 1867 gpu::GpuChannelHost::Create(this, client_id, gpu_info, channel_handle, |
1859 ChildProcess::current()->GetShutDownEvent(), | 1868 ChildProcess::current()->GetShutDownEvent(), |
1860 gpu_memory_buffer_manager()); | 1869 GetGpuMemoryBufferManager()); |
1861 } else { | 1870 } else { |
1862 #if defined(USE_AURA) | 1871 #if defined(USE_AURA) |
1863 gpu_channel_ = gpu_service_->EstablishGpuChannelSync(); | 1872 gpu_channel_ = gpu_service_->EstablishGpuChannelSync(); |
1864 #else | 1873 #else |
1865 NOTREACHED(); | 1874 NOTREACHED(); |
1866 #endif | 1875 #endif |
1867 } | 1876 } |
1868 return gpu_channel_; | 1877 return gpu_channel_; |
1869 } | 1878 } |
1870 | 1879 |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2331 } | 2340 } |
2332 } | 2341 } |
2333 | 2342 |
2334 void RenderThreadImpl::OnRendererInterfaceRequest( | 2343 void RenderThreadImpl::OnRendererInterfaceRequest( |
2335 mojom::RendererAssociatedRequest request) { | 2344 mojom::RendererAssociatedRequest request) { |
2336 DCHECK(!renderer_binding_.is_bound()); | 2345 DCHECK(!renderer_binding_.is_bound()); |
2337 renderer_binding_.Bind(std::move(request)); | 2346 renderer_binding_.Bind(std::move(request)); |
2338 } | 2347 } |
2339 | 2348 |
2340 } // namespace content | 2349 } // namespace content |
OLD | NEW |