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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 attributes.bind_generates_resource = false; | 447 attributes.bind_generates_resource = false; |
448 attributes.lose_context_when_out_of_memory = true; | 448 attributes.lose_context_when_out_of_memory = true; |
449 const bool automatic_flushes = false; | 449 const bool automatic_flushes = false; |
450 return make_scoped_refptr(new ContextProviderCommandBuffer( | 450 return make_scoped_refptr(new ContextProviderCommandBuffer( |
451 std::move(gpu_channel_host), stream_id, stream_priority, | 451 std::move(gpu_channel_host), stream_id, stream_priority, |
452 gpu::kNullSurfaceHandle, | 452 gpu::kNullSurfaceHandle, |
453 GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext"), | 453 GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext"), |
454 automatic_flushes, support_locking, limits, attributes, nullptr, type)); | 454 automatic_flushes, support_locking, limits, attributes, nullptr, type)); |
455 } | 455 } |
456 | 456 |
| 457 bool IsRunningInMash() { |
| 458 const base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); |
| 459 return cmdline->HasSwitch(switches::kIsRunningInMash); |
| 460 } |
| 461 |
457 } // namespace | 462 } // namespace |
458 | 463 |
459 // For measuring memory usage after each task. Behind a command line flag. | 464 // For measuring memory usage after each task. Behind a command line flag. |
460 class MemoryObserver : public base::MessageLoop::TaskObserver { | 465 class MemoryObserver : public base::MessageLoop::TaskObserver { |
461 public: | 466 public: |
462 MemoryObserver() {} | 467 MemoryObserver() {} |
463 ~MemoryObserver() override {} | 468 ~MemoryObserver() override {} |
464 | 469 |
465 void WillProcessTask(const base::PendingTask& pending_task) override {} | 470 void WillProcessTask(const base::PendingTask& pending_task) override {} |
466 | 471 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 #if defined(USE_EXTERNAL_POPUP_MENU) | 639 #if defined(USE_EXTERNAL_POPUP_MENU) |
635 // On Mac and Android Java UI, the select popups are rendered by the browser. | 640 // On Mac and Android Java UI, the select popups are rendered by the browser. |
636 blink::WebView::setUseExternalPopupMenus(true); | 641 blink::WebView::setUseExternalPopupMenus(true); |
637 #endif | 642 #endif |
638 | 643 |
639 lazy_tls.Pointer()->Set(this); | 644 lazy_tls.Pointer()->Set(this); |
640 | 645 |
641 // Register this object as the main thread. | 646 // Register this object as the main thread. |
642 ChildProcess::current()->set_main_thread(this); | 647 ChildProcess::current()->set_main_thread(this); |
643 | 648 |
| 649 #if defined(MOJO_SHELL_CLIENT) |
| 650 if (IsRunningInMash()) { |
| 651 auto* shell_connection = ChildThread::Get()->GetMojoShellConnection(); |
| 652 ui::GpuService::Initialize(shell_connection->GetConnector()); |
| 653 } |
| 654 #endif |
| 655 |
644 InitializeWebKit(resource_task_queue); | 656 InitializeWebKit(resource_task_queue); |
645 | 657 |
646 // In single process the single process is all there is. | 658 // In single process the single process is all there is. |
647 webkit_shared_timer_suspended_ = false; | 659 webkit_shared_timer_suspended_ = false; |
648 widget_count_ = 0; | 660 widget_count_ = 0; |
649 hidden_widget_count_ = 0; | 661 hidden_widget_count_ = 0; |
650 idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs; | 662 idle_notification_delay_in_ms_ = kInitialIdleHandlerDelayMs; |
651 idle_notifications_to_skip_ = 0; | 663 idle_notifications_to_skip_ = 0; |
652 | 664 |
653 appcache_dispatcher_.reset( | 665 appcache_dispatcher_.reset( |
654 new AppCacheDispatcher(Get(), new AppCacheFrontendImpl())); | 666 new AppCacheDispatcher(Get(), new AppCacheFrontendImpl())); |
655 dom_storage_dispatcher_.reset(new DomStorageDispatcher()); | 667 dom_storage_dispatcher_.reset(new DomStorageDispatcher()); |
656 main_thread_indexed_db_dispatcher_.reset(new IndexedDBDispatcher( | 668 main_thread_indexed_db_dispatcher_.reset(new IndexedDBDispatcher( |
657 thread_safe_sender())); | 669 thread_safe_sender())); |
658 main_thread_cache_storage_dispatcher_.reset( | 670 main_thread_cache_storage_dispatcher_.reset( |
659 new CacheStorageDispatcher(thread_safe_sender())); | 671 new CacheStorageDispatcher(thread_safe_sender())); |
660 embedded_worker_dispatcher_.reset(new EmbeddedWorkerDispatcher()); | 672 embedded_worker_dispatcher_.reset(new EmbeddedWorkerDispatcher()); |
661 | 673 |
662 // Note: This may reorder messages from the ResourceDispatcher with respect to | 674 // Note: This may reorder messages from the ResourceDispatcher with respect to |
663 // other subsystems. | 675 // other subsystems. |
664 resource_dispatch_throttler_.reset(new ResourceDispatchThrottler( | 676 resource_dispatch_throttler_.reset(new ResourceDispatchThrottler( |
665 static_cast<RenderThread*>(this), renderer_scheduler_.get(), | 677 static_cast<RenderThread*>(this), renderer_scheduler_.get(), |
666 base::TimeDelta::FromSecondsD(kThrottledResourceRequestFlushPeriodS), | 678 base::TimeDelta::FromSecondsD(kThrottledResourceRequestFlushPeriodS), |
667 kMaxResourceRequestsPerFlushWhenThrottled)); | 679 kMaxResourceRequestsPerFlushWhenThrottled)); |
668 resource_dispatcher()->set_message_sender(resource_dispatch_throttler_.get()); | 680 resource_dispatcher()->set_message_sender(resource_dispatch_throttler_.get()); |
669 | 681 |
670 media_stream_center_ = NULL; | 682 media_stream_center_ = nullptr; |
671 | 683 |
672 blob_message_filter_ = new BlobMessageFilter(GetFileThreadMessageLoopProxy()); | 684 blob_message_filter_ = new BlobMessageFilter(GetFileThreadMessageLoopProxy()); |
673 AddFilter(blob_message_filter_.get()); | 685 AddFilter(blob_message_filter_.get()); |
674 db_message_filter_ = new DBMessageFilter(); | 686 db_message_filter_ = new DBMessageFilter(); |
675 AddFilter(db_message_filter_.get()); | 687 AddFilter(db_message_filter_.get()); |
676 | 688 |
677 vc_manager_.reset(new VideoCaptureImplManager()); | 689 vc_manager_.reset(new VideoCaptureImplManager()); |
678 AddFilter(vc_manager_->video_capture_message_filter()); | 690 AddFilter(vc_manager_->video_capture_message_filter()); |
679 | 691 |
680 browser_plugin_manager_.reset(new BrowserPluginManager()); | 692 browser_plugin_manager_.reset(new BrowserPluginManager()); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 if (blink_platform_impl_) { | 882 if (blink_platform_impl_) { |
871 // Crash the process if they fail to close after a generous amount of time. | 883 // Crash the process if they fail to close after a generous amount of time. |
872 bool all_closed = blink_platform_impl_->web_database_observer_impl() | 884 bool all_closed = blink_platform_impl_->web_database_observer_impl() |
873 ->WaitForAllDatabasesToClose(base::TimeDelta::FromSeconds(60)); | 885 ->WaitForAllDatabasesToClose(base::TimeDelta::FromSeconds(60)); |
874 CHECK(all_closed); | 886 CHECK(all_closed); |
875 } | 887 } |
876 | 888 |
877 // Shutdown in reverse of the initialization order. | 889 // Shutdown in reverse of the initialization order. |
878 if (devtools_agent_message_filter_.get()) { | 890 if (devtools_agent_message_filter_.get()) { |
879 RemoveFilter(devtools_agent_message_filter_.get()); | 891 RemoveFilter(devtools_agent_message_filter_.get()); |
880 devtools_agent_message_filter_ = NULL; | 892 devtools_agent_message_filter_ = nullptr; |
881 } | 893 } |
882 | 894 |
883 RemoveFilter(audio_input_message_filter_.get()); | 895 RemoveFilter(audio_input_message_filter_.get()); |
884 audio_input_message_filter_ = NULL; | 896 audio_input_message_filter_ = nullptr; |
885 | 897 |
886 #if defined(ENABLE_WEBRTC) | 898 #if defined(ENABLE_WEBRTC) |
887 RTCPeerConnectionHandler::DestructAllHandlers(); | 899 RTCPeerConnectionHandler::DestructAllHandlers(); |
888 // |peer_connection_factory_| cannot be deleted until after the main message | 900 // |peer_connection_factory_| cannot be deleted until after the main message |
889 // loop has been destroyed. This is because there may be pending tasks that | 901 // loop has been destroyed. This is because there may be pending tasks that |
890 // hold on to objects produced by the PC factory that depend on threads owned | 902 // hold on to objects produced by the PC factory that depend on threads owned |
891 // by the PC factory. Once those tasks have been freed, the factory can be | 903 // by the PC factory. Once those tasks have been freed, the factory can be |
892 // deleted. | 904 // deleted. |
893 #endif | 905 #endif |
894 RemoveFilter(vc_manager_->video_capture_message_filter()); | 906 RemoveFilter(vc_manager_->video_capture_message_filter()); |
895 vc_manager_.reset(); | 907 vc_manager_.reset(); |
896 | 908 |
897 RemoveFilter(db_message_filter_.get()); | 909 RemoveFilter(db_message_filter_.get()); |
898 db_message_filter_ = NULL; | 910 db_message_filter_ = nullptr; |
899 | 911 |
900 // Shutdown the file thread if it's running. | 912 // Shutdown the file thread if it's running. |
901 if (file_thread_) | 913 if (file_thread_) |
902 file_thread_->Stop(); | 914 file_thread_->Stop(); |
903 | 915 |
904 if (compositor_message_filter_.get()) { | 916 if (compositor_message_filter_.get()) { |
905 RemoveFilter(compositor_message_filter_.get()); | 917 RemoveFilter(compositor_message_filter_.get()); |
906 compositor_message_filter_ = NULL; | 918 compositor_message_filter_ = nullptr; |
907 } | 919 } |
908 | 920 |
909 #if defined(OS_ANDROID) | 921 #if defined(OS_ANDROID) |
910 if (sync_compositor_message_filter_) { | 922 if (sync_compositor_message_filter_) { |
911 RemoveFilter(sync_compositor_message_filter_.get()); | 923 RemoveFilter(sync_compositor_message_filter_.get()); |
912 sync_compositor_message_filter_ = nullptr; | 924 sync_compositor_message_filter_ = nullptr; |
913 } | 925 } |
914 stream_texture_factory_ = nullptr; | 926 stream_texture_factory_ = nullptr; |
915 #endif | 927 #endif |
916 | 928 |
917 media_thread_.reset(); | 929 media_thread_.reset(); |
918 | 930 |
919 blink_platform_impl_->SetCompositorThread(nullptr); | 931 blink_platform_impl_->SetCompositorThread(nullptr); |
920 | 932 |
921 compositor_thread_.reset(); | 933 compositor_thread_.reset(); |
922 | 934 |
923 // AudioMessageFilter may be accessed on |media_thread_|, so shutdown after. | 935 // AudioMessageFilter may be accessed on |media_thread_|, so shutdown after. |
924 RemoveFilter(audio_message_filter_.get()); | 936 RemoveFilter(audio_message_filter_.get()); |
925 audio_message_filter_ = NULL; | 937 audio_message_filter_ = nullptr; |
926 | 938 |
927 categorized_worker_pool_->Shutdown(); | 939 categorized_worker_pool_->Shutdown(); |
928 | 940 |
929 main_input_callback_.Cancel(); | 941 main_input_callback_.Cancel(); |
930 input_handler_manager_.reset(); | 942 input_handler_manager_.reset(); |
931 if (input_event_filter_.get()) { | 943 if (input_event_filter_.get()) { |
932 RemoveFilter(input_event_filter_.get()); | 944 RemoveFilter(input_event_filter_.get()); |
933 input_event_filter_ = NULL; | 945 input_event_filter_ = nullptr; |
934 } | 946 } |
935 | 947 |
936 // RemoveEmbeddedWorkerRoute may be called while deleting | 948 // RemoveEmbeddedWorkerRoute may be called while deleting |
937 // EmbeddedWorkerDispatcher. So it must be deleted before deleting | 949 // EmbeddedWorkerDispatcher. So it must be deleted before deleting |
938 // RenderThreadImpl. | 950 // RenderThreadImpl. |
939 embedded_worker_dispatcher_.reset(); | 951 embedded_worker_dispatcher_.reset(); |
940 | 952 |
941 // Ramp down IDB before we ramp down WebKit (and V8), since IDB classes might | 953 // Ramp down IDB before we ramp down WebKit (and V8), since IDB classes might |
942 // hold pointers to V8 objects (e.g., via pending requests). | 954 // hold pointers to V8 objects (e.g., via pending requests). |
943 main_thread_indexed_db_dispatcher_.reset(); | 955 main_thread_indexed_db_dispatcher_.reset(); |
944 | 956 |
945 main_thread_compositor_task_runner_ = NULL; | 957 main_thread_compositor_task_runner_ = nullptr; |
946 | 958 |
947 gpu_factories_.clear(); | 959 gpu_factories_.clear(); |
948 | 960 |
949 // Context providers must be released prior to destroying the GPU channel. | 961 // Context providers must be released prior to destroying the GPU channel. |
950 shared_worker_context_provider_ = nullptr; | 962 shared_worker_context_provider_ = nullptr; |
951 shared_main_thread_contexts_ = nullptr; | 963 shared_main_thread_contexts_ = nullptr; |
952 | 964 |
953 if (gpu_channel_.get()) | 965 if (gpu_channel_.get()) |
954 gpu_channel_->DestroyChannel(); | 966 gpu_channel_->DestroyChannel(); |
955 | 967 |
(...skipping 18 matching lines...) Expand all Loading... |
974 // Delay shutting down DiscardableSharedMemoryManager until blink::shutdown | 986 // Delay shutting down DiscardableSharedMemoryManager until blink::shutdown |
975 // is complete, because blink::shutdown destructs Blink Resources and they | 987 // is complete, because blink::shutdown destructs Blink Resources and they |
976 // may try to unlock their underlying discardable memory. | 988 // may try to unlock their underlying discardable memory. |
977 ChildThreadImpl::ShutdownDiscardableSharedMemoryManager(); | 989 ChildThreadImpl::ShutdownDiscardableSharedMemoryManager(); |
978 | 990 |
979 // The message loop must be cleared after shutting down | 991 // The message loop must be cleared after shutting down |
980 // the DiscardableSharedMemoryManager, which needs to send messages | 992 // the DiscardableSharedMemoryManager, which needs to send messages |
981 // to the browser process. | 993 // to the browser process. |
982 main_message_loop_.reset(); | 994 main_message_loop_.reset(); |
983 | 995 |
984 lazy_tls.Pointer()->Set(NULL); | 996 lazy_tls.Pointer()->Set(nullptr); |
985 } | 997 } |
986 | 998 |
987 bool RenderThreadImpl::Send(IPC::Message* msg) { | 999 bool RenderThreadImpl::Send(IPC::Message* msg) { |
988 // There are cases where we want to pump asynchronous messages while waiting | 1000 // There are cases where we want to pump asynchronous messages while waiting |
989 // synchronously for the replies to the message to be sent here. However, this | 1001 // synchronously for the replies to the message to be sent here. However, this |
990 // may create an opportunity for re-entrancy into WebKit and other subsystems, | 1002 // may create an opportunity for re-entrancy into WebKit and other subsystems, |
991 // so we need to take care to disable callbacks, timers, and pending network | 1003 // so we need to take care to disable callbacks, timers, and pending network |
992 // loads that could trigger such callbacks. | 1004 // loads that could trigger such callbacks. |
993 bool pumping_events = false; | 1005 bool pumping_events = false; |
994 if (msg->is_sync()) { | 1006 if (msg->is_sync()) { |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 #if defined(OS_ANDROID) | 1509 #if defined(OS_ANDROID) |
1498 | 1510 |
1499 scoped_refptr<StreamTextureFactory> RenderThreadImpl::GetStreamTexureFactory() { | 1511 scoped_refptr<StreamTextureFactory> RenderThreadImpl::GetStreamTexureFactory() { |
1500 DCHECK(IsMainThread()); | 1512 DCHECK(IsMainThread()); |
1501 if (!stream_texture_factory_.get() || | 1513 if (!stream_texture_factory_.get() || |
1502 stream_texture_factory_->ContextGL()->GetGraphicsResetStatusKHR() != | 1514 stream_texture_factory_->ContextGL()->GetGraphicsResetStatusKHR() != |
1503 GL_NO_ERROR) { | 1515 GL_NO_ERROR) { |
1504 scoped_refptr<ContextProviderCommandBuffer> shared_context_provider = | 1516 scoped_refptr<ContextProviderCommandBuffer> shared_context_provider = |
1505 SharedMainThreadContextProvider(); | 1517 SharedMainThreadContextProvider(); |
1506 if (!shared_context_provider) { | 1518 if (!shared_context_provider) { |
1507 stream_texture_factory_ = NULL; | 1519 stream_texture_factory_ = nullptr; |
1508 return NULL; | 1520 return nullptr; |
1509 } | 1521 } |
1510 DCHECK(shared_context_provider->GetCommandBufferProxy()); | 1522 DCHECK(shared_context_provider->GetCommandBufferProxy()); |
1511 DCHECK(shared_context_provider->GetCommandBufferProxy()->channel()); | 1523 DCHECK(shared_context_provider->GetCommandBufferProxy()->channel()); |
1512 stream_texture_factory_ = | 1524 stream_texture_factory_ = |
1513 StreamTextureFactory::Create(std::move(shared_context_provider)); | 1525 StreamTextureFactory::Create(std::move(shared_context_provider)); |
1514 } | 1526 } |
1515 return stream_texture_factory_; | 1527 return stream_texture_factory_; |
1516 } | 1528 } |
1517 | 1529 |
1518 bool RenderThreadImpl::EnableStreamTextureCopy() { | 1530 bool RenderThreadImpl::EnableStreamTextureCopy() { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1665 // more informative stack, since we will otherwise just crash later when we | 1677 // more informative stack, since we will otherwise just crash later when we |
1666 // try to restart it. | 1678 // try to restart it. |
1667 CHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch( | 1679 CHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch( |
1668 switches::kSingleProcess)); | 1680 switches::kSingleProcess)); |
1669 ChildThreadImpl::OnChannelError(); | 1681 ChildThreadImpl::OnChannelError(); |
1670 } | 1682 } |
1671 | 1683 |
1672 bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { | 1684 bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { |
1673 base::ObserverListBase<RenderThreadObserver>::Iterator it(&observers_); | 1685 base::ObserverListBase<RenderThreadObserver>::Iterator it(&observers_); |
1674 RenderThreadObserver* observer; | 1686 RenderThreadObserver* observer; |
1675 while ((observer = it.GetNext()) != NULL) { | 1687 while ((observer = it.GetNext()) != nullptr) { |
1676 if (observer->OnControlMessageReceived(msg)) | 1688 if (observer->OnControlMessageReceived(msg)) |
1677 return true; | 1689 return true; |
1678 } | 1690 } |
1679 | 1691 |
1680 // Some messages are handled by delegates. | 1692 // Some messages are handled by delegates. |
1681 if (appcache_dispatcher_->OnMessageReceived(msg) || | 1693 if (appcache_dispatcher_->OnMessageReceived(msg) || |
1682 dom_storage_dispatcher_->OnMessageReceived(msg) || | 1694 dom_storage_dispatcher_->OnMessageReceived(msg) || |
1683 embedded_worker_dispatcher_->OnMessageReceived(msg)) { | 1695 embedded_worker_dispatcher_->OnMessageReceived(msg)) { |
1684 return true; | 1696 return true; |
1685 } | 1697 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1771 TRACE_EVENT0("gpu", "RenderThreadImpl::EstablishGpuChannelSync"); | 1783 TRACE_EVENT0("gpu", "RenderThreadImpl::EstablishGpuChannelSync"); |
1772 | 1784 |
1773 if (gpu_channel_) { | 1785 if (gpu_channel_) { |
1774 // Do nothing if we already have a GPU channel or are already | 1786 // Do nothing if we already have a GPU channel or are already |
1775 // establishing one. | 1787 // establishing one. |
1776 if (!gpu_channel_->IsLost()) | 1788 if (!gpu_channel_->IsLost()) |
1777 return gpu_channel_; | 1789 return gpu_channel_; |
1778 | 1790 |
1779 // Recreate the channel if it has been lost. | 1791 // Recreate the channel if it has been lost. |
1780 gpu_channel_->DestroyChannel(); | 1792 gpu_channel_->DestroyChannel(); |
1781 gpu_channel_ = NULL; | 1793 gpu_channel_ = nullptr; |
1782 } | 1794 } |
1783 | 1795 |
1784 // Ask the browser for the channel name. | 1796 if (!IsRunningInMash()) { |
1785 int client_id = 0; | 1797 int client_id = 0; |
1786 IPC::ChannelHandle channel_handle; | 1798 IPC::ChannelHandle channel_handle; |
1787 gpu::GPUInfo gpu_info; | 1799 gpu::GPUInfo gpu_info; |
1788 if (!Send(new ChildProcessHostMsg_EstablishGpuChannel( | 1800 // Ask the browser for the channel name. |
1789 cause_for_gpu_launch, &client_id, &channel_handle, &gpu_info)) || | 1801 if (!Send(new ChildProcessHostMsg_EstablishGpuChannel( |
| 1802 cause_for_gpu_launch, &client_id, &channel_handle, &gpu_info)) || |
1790 #if defined(OS_POSIX) | 1803 #if defined(OS_POSIX) |
1791 channel_handle.socket.fd == -1 || | 1804 channel_handle.socket.fd == -1 || |
1792 #endif | 1805 #endif |
1793 channel_handle.name.empty()) { | 1806 channel_handle.name.empty()) { |
1794 // Otherwise cancel the connection. | 1807 // Otherwise cancel the connection. |
1795 return NULL; | 1808 return nullptr; |
| 1809 } |
| 1810 GetContentClient()->SetGpuInfo(gpu_info); |
| 1811 |
| 1812 // Cache some variables that are needed on the compositor thread for our |
| 1813 // implementation of GpuChannelHostFactory. |
| 1814 io_thread_task_runner_ = ChildProcess::current()->io_task_runner(); |
| 1815 |
| 1816 gpu_channel_ = |
| 1817 gpu::GpuChannelHost::Create(this, client_id, gpu_info, channel_handle, |
| 1818 ChildProcess::current()->GetShutDownEvent(), |
| 1819 gpu_memory_buffer_manager()); |
| 1820 } else { |
| 1821 #if defined(MOJO_SHELL_CLIENT) && defined(USE_AURA) |
| 1822 gpu_channel_ = ui::GpuService::GetInstance()->EstablishGpuChannelSync(); |
| 1823 #else |
| 1824 NOTREACHED(); |
| 1825 #endif |
1796 } | 1826 } |
1797 | |
1798 GetContentClient()->SetGpuInfo(gpu_info); | |
1799 | |
1800 // Cache some variables that are needed on the compositor thread for our | |
1801 // implementation of GpuChannelHostFactory. | |
1802 io_thread_task_runner_ = ChildProcess::current()->io_task_runner(); | |
1803 | |
1804 gpu_channel_ = gpu::GpuChannelHost::Create( | |
1805 this, client_id, gpu_info, channel_handle, | |
1806 ChildProcess::current()->GetShutDownEvent(), gpu_memory_buffer_manager()); | |
1807 return gpu_channel_; | 1827 return gpu_channel_; |
1808 } | 1828 } |
1809 | 1829 |
1810 std::unique_ptr<cc::OutputSurface> | 1830 std::unique_ptr<cc::OutputSurface> |
1811 RenderThreadImpl::CreateCompositorOutputSurface( | 1831 RenderThreadImpl::CreateCompositorOutputSurface( |
1812 bool use_software, | 1832 bool use_software, |
1813 int routing_id, | 1833 int routing_id, |
1814 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue, | 1834 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue, |
1815 const GURL& url) { | 1835 const GURL& url) { |
1816 const base::CommandLine& command_line = | 1836 const base::CommandLine& command_line = |
1817 *base::CommandLine::ForCurrentProcess(); | 1837 *base::CommandLine::ForCurrentProcess(); |
1818 if (command_line.HasSwitch(switches::kDisableGpuCompositing)) | 1838 if (command_line.HasSwitch(switches::kDisableGpuCompositing)) |
1819 use_software = true; | 1839 use_software = true; |
1820 | 1840 |
1821 #if defined(MOJO_SHELL_CLIENT) && defined(USE_AURA) | 1841 #if defined(MOJO_SHELL_CLIENT) && defined(USE_AURA) |
1822 auto shell_connection = MojoShellConnection::GetForProcess(); | 1842 auto* shell_connection = MojoShellConnection::GetForProcess(); |
1823 if (shell_connection && !use_software && | 1843 if (shell_connection && !use_software && |
1824 command_line.HasSwitch(switches::kUseMusInRenderer)) { | 1844 command_line.HasSwitch(switches::kUseMusInRenderer)) { |
1825 ui::GpuService::Initialize(shell_connection->GetConnector()); | |
1826 RenderWidgetMusConnection* connection = | 1845 RenderWidgetMusConnection* connection = |
1827 RenderWidgetMusConnection::GetOrCreate(routing_id); | 1846 RenderWidgetMusConnection::GetOrCreate(routing_id); |
1828 return connection->CreateOutputSurface(); | 1847 return connection->CreateOutputSurface(); |
1829 } | 1848 } |
1830 #endif | 1849 #endif |
1831 | 1850 |
1832 uint32_t output_surface_id = g_next_output_surface_id++; | 1851 uint32_t output_surface_id = g_next_output_surface_id++; |
1833 | 1852 |
1834 if (command_line.HasSwitch(switches::kEnableVulkan)) { | 1853 if (command_line.HasSwitch(switches::kEnableVulkan)) { |
1835 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider = | 1854 scoped_refptr<cc::VulkanContextProvider> vulkan_context_provider = |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2222 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) | 2241 v8_memory_pressure_level == v8::MemoryPressureLevel::kCritical) |
2223 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; | 2242 v8_memory_pressure_level = v8::MemoryPressureLevel::kModerate; |
2224 | 2243 |
2225 blink::mainThreadIsolate()->MemoryPressureNotification( | 2244 blink::mainThreadIsolate()->MemoryPressureNotification( |
2226 v8_memory_pressure_level); | 2245 v8_memory_pressure_level); |
2227 blink::MemoryPressureNotificationToWorkerThreadIsolates( | 2246 blink::MemoryPressureNotificationToWorkerThreadIsolates( |
2228 v8_memory_pressure_level); | 2247 v8_memory_pressure_level); |
2229 } | 2248 } |
2230 | 2249 |
2231 } // namespace content | 2250 } // namespace content |
OLD | NEW |