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 bool manager_initialized = false; |
888 mojo::GetProxy(&manager_ptr)); | 889 #if defined(USE_AURA) |
890 if (IsRunningInMash()) { | |
891 GetServiceManagerConnection()->GetConnector()->ConnectToInterface( | |
892 ui::mojom::kServiceName, &manager_ptr); | |
893 manager_initialized = true; | |
894 } | |
895 #endif | |
896 if (!manager_initialized) { | |
sadrul
2016/12/07 17:56:40
Do you need |manager_initialized|? Can you check |
Peng
2016/12/07 19:02:05
Seems ConnectToInterface() can be failed, so proba
| |
897 ChildThread::Get()->GetRemoteInterfaces()->GetInterface( | |
898 mojo::GetProxy(&manager_ptr)); | |
899 } | |
900 | |
889 discardable_shared_memory_manager_ = base::MakeUnique< | 901 discardable_shared_memory_manager_ = base::MakeUnique< |
890 discardable_memory::ClientDiscardableSharedMemoryManager>( | 902 discardable_memory::ClientDiscardableSharedMemoryManager>( |
891 std::move(manager_ptr), GetIOTaskRunner()); | 903 std::move(manager_ptr), GetIOTaskRunner()); |
892 | 904 |
893 // TODO(boliu): In single process, browser main loop should set up the | 905 // TODO(boliu): In single process, browser main loop should set up the |
894 // discardable memory manager, and should skip this if kSingleProcess. | 906 // discardable memory manager, and should skip this if kSingleProcess. |
895 // See crbug.com/503724. | 907 // See crbug.com/503724. |
896 base::DiscardableMemoryAllocator::SetInstance( | 908 base::DiscardableMemoryAllocator::SetInstance( |
897 discardable_shared_memory_manager_.get()); | 909 discardable_shared_memory_manager_.get()); |
898 | 910 |
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2512 } | 2524 } |
2513 } | 2525 } |
2514 | 2526 |
2515 void RenderThreadImpl::OnRendererInterfaceRequest( | 2527 void RenderThreadImpl::OnRendererInterfaceRequest( |
2516 mojom::RendererAssociatedRequest request) { | 2528 mojom::RendererAssociatedRequest request) { |
2517 DCHECK(!renderer_binding_.is_bound()); | 2529 DCHECK(!renderer_binding_.is_bound()); |
2518 renderer_binding_.Bind(std::move(request)); | 2530 renderer_binding_.Bind(std::move(request)); |
2519 } | 2531 } |
2520 | 2532 |
2521 } // namespace content | 2533 } // namespace content |
OLD | NEW |