| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 #include "media/base/media.h" | 135 #include "media/base/media.h" |
| 136 #include "media/media_features.h" | 136 #include "media/media_features.h" |
| 137 #include "media/renderers/gpu_video_accelerator_factories.h" | 137 #include "media/renderers/gpu_video_accelerator_factories.h" |
| 138 #include "mojo/common/common_type_converters.h" | 138 #include "mojo/common/common_type_converters.h" |
| 139 #include "mojo/public/cpp/bindings/strong_binding.h" | 139 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 140 #include "net/base/net_errors.h" | 140 #include "net/base/net_errors.h" |
| 141 #include "net/base/port_util.h" | 141 #include "net/base/port_util.h" |
| 142 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 142 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 143 #include "net/base/url_util.h" | 143 #include "net/base/url_util.h" |
| 144 #include "ppapi/features/features.h" | 144 #include "ppapi/features/features.h" |
| 145 #include "services/service_manager/public/cpp/connector.h" |
| 145 #include "services/service_manager/public/cpp/interface_provider.h" | 146 #include "services/service_manager/public/cpp/interface_provider.h" |
| 146 #include "services/service_manager/public/cpp/interface_registry.h" | 147 #include "services/service_manager/public/cpp/interface_registry.h" |
| 148 #include "services/ui/public/interfaces/constants.mojom.h" |
| 147 #include "skia/ext/event_tracer_impl.h" | 149 #include "skia/ext/event_tracer_impl.h" |
| 148 #include "skia/ext/skia_memory_dump_provider.h" | 150 #include "skia/ext/skia_memory_dump_provider.h" |
| 149 #include "third_party/WebKit/public/platform/WebImageGenerator.h" | 151 #include "third_party/WebKit/public/platform/WebImageGenerator.h" |
| 150 #include "third_party/WebKit/public/platform/WebMemoryCoordinator.h" | 152 #include "third_party/WebKit/public/platform/WebMemoryCoordinator.h" |
| 151 #include "third_party/WebKit/public/platform/WebString.h" | 153 #include "third_party/WebKit/public/platform/WebString.h" |
| 152 #include "third_party/WebKit/public/platform/WebThread.h" | 154 #include "third_party/WebKit/public/platform/WebThread.h" |
| 153 #include "third_party/WebKit/public/platform/scheduler/child/compositor_worker_s
cheduler.h" | 155 #include "third_party/WebKit/public/platform/scheduler/child/compositor_worker_s
cheduler.h" |
| 154 #include "third_party/WebKit/public/platform/scheduler/child/webthread_impl_for_
worker_scheduler.h" | 156 #include "third_party/WebKit/public/platform/scheduler/child/webthread_impl_for_
worker_scheduler.h" |
| 155 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" | 157 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul
er.h" |
| 156 #include "third_party/WebKit/public/web/WebCache.h" | 158 #include "third_party/WebKit/public/web/WebCache.h" |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 blink::WebView::setUseExternalPopupMenus(true); | 650 blink::WebView::setUseExternalPopupMenus(true); |
| 649 #endif | 651 #endif |
| 650 | 652 |
| 651 lazy_tls.Pointer()->Set(this); | 653 lazy_tls.Pointer()->Set(this); |
| 652 | 654 |
| 653 // Register this object as the main thread. | 655 // Register this object as the main thread. |
| 654 ChildProcess::current()->set_main_thread(this); | 656 ChildProcess::current()->set_main_thread(this); |
| 655 | 657 |
| 656 #if defined(USE_AURA) | 658 #if defined(USE_AURA) |
| 657 if (IsRunningInMash()) { | 659 if (IsRunningInMash()) { |
| 658 gpu_service_ = | 660 gpu_service_ = ui::GpuService::Create( |
| 659 ui::GpuService::Create(GetServiceManagerConnection()->GetConnector(), | 661 GetServiceManagerConnection()->GetConnector(), GetIOTaskRunner()); |
| 660 ChildProcess::current()->io_task_runner()); | |
| 661 } | 662 } |
| 662 #endif | 663 #endif |
| 663 gpu_memory_buffer_manager_ = | 664 gpu_memory_buffer_manager_ = |
| 664 base::MakeUnique<ChildGpuMemoryBufferManager>(thread_safe_sender()); | 665 base::MakeUnique<ChildGpuMemoryBufferManager>(thread_safe_sender()); |
| 665 | 666 |
| 666 thread_safe_associated_interface_ptr_provider_ = | 667 thread_safe_associated_interface_ptr_provider_ = |
| 667 base::MakeUnique<ThreadSafeAssociatedInterfacePtrProvider>(channel()); | 668 base::MakeUnique<ThreadSafeAssociatedInterfacePtrProvider>(channel()); |
| 668 thread_safe_render_message_filter_ = | 669 thread_safe_render_message_filter_ = |
| 669 thread_safe_associated_interface_ptr_provider_ | 670 thread_safe_associated_interface_ptr_provider_ |
| 670 ->CreateInterfacePtr<mojom::RenderMessageFilter>(); | 671 ->CreateInterfacePtr<mojom::RenderMessageFilter>(); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 DCHECK(parsed_num_raster_threads) << string_value; | 878 DCHECK(parsed_num_raster_threads) << string_value; |
| 878 DCHECK_GT(num_raster_threads, 0); | 879 DCHECK_GT(num_raster_threads, 0); |
| 879 | 880 |
| 880 // TODO(vmpstr): If the flag sticks, we should clean it up and always have | 881 // TODO(vmpstr): If the flag sticks, we should clean it up and always have |
| 881 // image decode tasks. | 882 // image decode tasks. |
| 882 are_image_decode_tasks_enabled_ = true; | 883 are_image_decode_tasks_enabled_ = true; |
| 883 | 884 |
| 884 categorized_worker_pool_->Start(num_raster_threads); | 885 categorized_worker_pool_->Start(num_raster_threads); |
| 885 | 886 |
| 886 discardable_memory::mojom::DiscardableSharedMemoryManagerPtr manager_ptr; | 887 discardable_memory::mojom::DiscardableSharedMemoryManagerPtr manager_ptr; |
| 887 ChildThread::Get()->GetRemoteInterfaces()->GetInterface( | 888 if (IsRunningInMash()) { |
| 888 mojo::GetProxy(&manager_ptr)); | 889 #if defined(USE_AURA) |
| 890 GetServiceManagerConnection()->GetConnector()->ConnectToInterface( |
| 891 ui::mojom::kServiceName, &manager_ptr); |
| 892 #else |
| 893 NOTREACHED(); |
| 894 #endif |
| 895 } else { |
| 896 ChildThread::Get()->GetRemoteInterfaces()->GetInterface( |
| 897 mojo::GetProxy(&manager_ptr)); |
| 898 } |
| 899 |
| 889 discardable_shared_memory_manager_ = base::MakeUnique< | 900 discardable_shared_memory_manager_ = base::MakeUnique< |
| 890 discardable_memory::ClientDiscardableSharedMemoryManager>( | 901 discardable_memory::ClientDiscardableSharedMemoryManager>( |
| 891 std::move(manager_ptr), GetIOTaskRunner()); | 902 std::move(manager_ptr), GetIOTaskRunner()); |
| 892 | 903 |
| 893 // TODO(boliu): In single process, browser main loop should set up the | 904 // TODO(boliu): In single process, browser main loop should set up the |
| 894 // discardable memory manager, and should skip this if kSingleProcess. | 905 // discardable memory manager, and should skip this if kSingleProcess. |
| 895 // See crbug.com/503724. | 906 // See crbug.com/503724. |
| 896 base::DiscardableMemoryAllocator::SetInstance( | 907 base::DiscardableMemoryAllocator::SetInstance( |
| 897 discardable_shared_memory_manager_.get()); | 908 discardable_shared_memory_manager_.get()); |
| 898 | 909 |
| (...skipping 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2518 } | 2529 } |
| 2519 } | 2530 } |
| 2520 | 2531 |
| 2521 void RenderThreadImpl::OnRendererInterfaceRequest( | 2532 void RenderThreadImpl::OnRendererInterfaceRequest( |
| 2522 mojom::RendererAssociatedRequest request) { | 2533 mojom::RendererAssociatedRequest request) { |
| 2523 DCHECK(!renderer_binding_.is_bound()); | 2534 DCHECK(!renderer_binding_.is_bound()); |
| 2524 renderer_binding_.Bind(std::move(request)); | 2535 renderer_binding_.Bind(std::move(request)); |
| 2525 } | 2536 } |
| 2526 | 2537 |
| 2527 } // namespace content | 2538 } // namespace content |
| OLD | NEW |