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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 #include "content/common/dom_storage/dom_storage_messages.h" | 71 #include "content/common/dom_storage/dom_storage_messages.h" |
72 #include "content/common/features.h" | 72 #include "content/common/features.h" |
73 #include "content/common/field_trial_recorder.mojom.h" | 73 #include "content/common/field_trial_recorder.mojom.h" |
74 #include "content/common/frame_messages.h" | 74 #include "content/common/frame_messages.h" |
75 #include "content/common/frame_owner_properties.h" | 75 #include "content/common/frame_owner_properties.h" |
76 #include "content/common/render_process_messages.h" | 76 #include "content/common/render_process_messages.h" |
77 #include "content/common/resource_messages.h" | 77 #include "content/common/resource_messages.h" |
78 #include "content/common/site_isolation_policy.h" | 78 #include "content/common/site_isolation_policy.h" |
79 #include "content/common/view_messages.h" | 79 #include "content/common/view_messages.h" |
80 #include "content/common/worker_messages.h" | 80 #include "content/common/worker_messages.h" |
81 #include "content/public/common/connection_filter_impl.h" | |
81 #include "content/public/common/content_constants.h" | 82 #include "content/public/common/content_constants.h" |
82 #include "content/public/common/content_features.h" | 83 #include "content/public/common/content_features.h" |
83 #include "content/public/common/content_paths.h" | 84 #include "content/public/common/content_paths.h" |
84 #include "content/public/common/content_switches.h" | 85 #include "content/public/common/content_switches.h" |
85 #include "content/public/common/renderer_preferences.h" | 86 #include "content/public/common/renderer_preferences.h" |
87 #include "content/public/common/service_manager_connection.h" | |
86 #include "content/public/common/service_names.mojom.h" | 88 #include "content/public/common/service_names.mojom.h" |
87 #include "content/public/common/url_constants.h" | 89 #include "content/public/common/url_constants.h" |
88 #include "content/public/renderer/content_renderer_client.h" | 90 #include "content/public/renderer/content_renderer_client.h" |
89 #include "content/public/renderer/render_thread_observer.h" | 91 #include "content/public/renderer/render_thread_observer.h" |
90 #include "content/public/renderer/render_view_visitor.h" | 92 #include "content/public/renderer/render_view_visitor.h" |
91 #include "content/renderer/browser_plugin/browser_plugin_manager.h" | 93 #include "content/renderer/browser_plugin/browser_plugin_manager.h" |
92 #include "content/renderer/cache_storage/cache_storage_dispatcher.h" | 94 #include "content/renderer/cache_storage/cache_storage_dispatcher.h" |
93 #include "content/renderer/cache_storage/cache_storage_message_filter.h" | 95 #include "content/renderer/cache_storage/cache_storage_message_filter.h" |
94 #include "content/renderer/categorized_worker_pool.h" | 96 #include "content/renderer/categorized_worker_pool.h" |
95 #include "content/renderer/devtools/devtools_agent_filter.h" | 97 #include "content/renderer/devtools/devtools_agent_filter.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 #include "media/base/media.h" | 135 #include "media/base/media.h" |
134 #include "media/base/media_switches.h" | 136 #include "media/base/media_switches.h" |
135 #include "media/media_features.h" | 137 #include "media/media_features.h" |
136 #include "media/renderers/gpu_video_accelerator_factories.h" | 138 #include "media/renderers/gpu_video_accelerator_factories.h" |
137 #include "mojo/public/cpp/bindings/strong_binding.h" | 139 #include "mojo/public/cpp/bindings/strong_binding.h" |
138 #include "net/base/net_errors.h" | 140 #include "net/base/net_errors.h" |
139 #include "net/base/port_util.h" | 141 #include "net/base/port_util.h" |
140 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 142 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
141 #include "net/base/url_util.h" | 143 #include "net/base/url_util.h" |
142 #include "ppapi/features/features.h" | 144 #include "ppapi/features/features.h" |
145 #include "services/service_manager/public/cpp/binder_registry.h" | |
143 #include "services/service_manager/public/cpp/connector.h" | 146 #include "services/service_manager/public/cpp/connector.h" |
144 #include "services/service_manager/public/cpp/interface_provider.h" | 147 #include "services/service_manager/public/cpp/interface_provider.h" |
145 #include "services/service_manager/public/cpp/interface_registry.h" | |
146 #include "services/ui/public/cpp/bitmap/child_shared_bitmap_manager.h" | 148 #include "services/ui/public/cpp/bitmap/child_shared_bitmap_manager.h" |
147 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" | 149 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" |
148 #include "services/ui/public/interfaces/constants.mojom.h" | 150 #include "services/ui/public/interfaces/constants.mojom.h" |
149 #include "skia/ext/event_tracer_impl.h" | 151 #include "skia/ext/event_tracer_impl.h" |
150 #include "skia/ext/skia_memory_dump_provider.h" | 152 #include "skia/ext/skia_memory_dump_provider.h" |
151 #include "third_party/WebKit/public/platform/WebCache.h" | 153 #include "third_party/WebKit/public/platform/WebCache.h" |
152 #include "third_party/WebKit/public/platform/WebImageGenerator.h" | 154 #include "third_party/WebKit/public/platform/WebImageGenerator.h" |
153 #include "third_party/WebKit/public/platform/WebMemoryCoordinator.h" | 155 #include "third_party/WebKit/public/platform/WebMemoryCoordinator.h" |
154 #include "third_party/WebKit/public/platform/WebNetworkStateNotifier.h" | 156 #include "third_party/WebKit/public/platform/WebNetworkStateNotifier.h" |
155 #include "third_party/WebKit/public/platform/WebString.h" | 157 #include "third_party/WebKit/public/platform/WebString.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
338 } | 340 } |
339 | 341 |
340 frame->BindFrame(std::move(frame_request), std::move(frame_host)); | 342 frame->BindFrame(std::move(frame_request), std::move(frame_host)); |
341 } | 343 } |
342 | 344 |
343 private: | 345 private: |
344 int32_t routing_id_highmark_; | 346 int32_t routing_id_highmark_; |
345 }; | 347 }; |
346 | 348 |
347 void CreateFrameFactory(mojom::FrameFactoryRequest request) { | 349 void CreateFrameFactory(mojom::FrameFactoryRequest request) { |
350 LOG(ERROR) << "CREATEFRAMEFACTORY"; | |
Ken Rockot(use gerrit already)
2017/04/18 21:42:11
remove
| |
348 mojo::MakeStrongBinding(base::MakeUnique<FrameFactoryImpl>(), | 351 mojo::MakeStrongBinding(base::MakeUnique<FrameFactoryImpl>(), |
349 std::move(request)); | 352 std::move(request)); |
350 } | 353 } |
351 | 354 |
352 scoped_refptr<ui::ContextProviderCommandBuffer> CreateOffscreenContext( | 355 scoped_refptr<ui::ContextProviderCommandBuffer> CreateOffscreenContext( |
353 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, | 356 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host, |
354 const gpu::SharedMemoryLimits& limits, | 357 const gpu::SharedMemoryLimits& limits, |
355 bool support_locking, | 358 bool support_locking, |
356 ui::command_buffer_metrics::ContextType type, | 359 ui::command_buffer_metrics::ContextType type, |
357 int32_t stream_id, | 360 int32_t stream_id, |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
683 AddFilter((new CacheStorageMessageFilter(thread_safe_sender()))->GetFilter()); | 686 AddFilter((new CacheStorageMessageFilter(thread_safe_sender()))->GetFilter()); |
684 | 687 |
685 AddFilter((new ServiceWorkerContextMessageFilter())->GetFilter()); | 688 AddFilter((new ServiceWorkerContextMessageFilter())->GetFilter()); |
686 | 689 |
687 #if defined(USE_AURA) | 690 #if defined(USE_AURA) |
688 if (IsRunningInMash()) { | 691 if (IsRunningInMash()) { |
689 CreateRenderWidgetWindowTreeClientFactory(GetServiceManagerConnection()); | 692 CreateRenderWidgetWindowTreeClientFactory(GetServiceManagerConnection()); |
690 } | 693 } |
691 #endif | 694 #endif |
692 | 695 |
693 // Must be called before RenderThreadStarted() below. | 696 auto registry = base::MakeUnique<service_manager::BinderRegistry>(); |
Ken Rockot(use gerrit already)
2017/04/18 21:42:11
I wish I could remember what this comment was refe
| |
694 StartServiceManagerConnection(); | 697 registry->AddInterface(base::Bind(&CreateFrameFactory), |
698 base::ThreadTaskRunnerHandle::Get()); | |
699 registry->AddInterface(base::Bind(&EmbeddedWorkerInstanceClientImpl::Create), | |
700 base::ThreadTaskRunnerHandle::Get()); | |
701 GetServiceManagerConnection()->AddConnectionFilter( | |
702 base::MakeUnique<ConnectionFilterImpl>(std::move(registry))); | |
695 | 703 |
696 GetContentClient()->renderer()->RenderThreadStarted(); | 704 GetContentClient()->renderer()->RenderThreadStarted(); |
697 | 705 |
706 StartServiceManagerConnection(); | |
707 | |
698 field_trial_syncer_.InitFieldTrialObserving( | 708 field_trial_syncer_.InitFieldTrialObserving( |
699 *base::CommandLine::ForCurrentProcess(), switches::kSingleProcess); | 709 *base::CommandLine::ForCurrentProcess(), switches::kSingleProcess); |
700 | 710 |
701 GetAssociatedInterfaceRegistry()->AddInterface( | 711 GetAssociatedInterfaceRegistry()->AddInterface( |
702 base::Bind(&RenderThreadImpl::OnRendererInterfaceRequest, | 712 base::Bind(&RenderThreadImpl::OnRendererInterfaceRequest, |
703 base::Unretained(this))); | 713 base::Unretained(this))); |
704 | 714 |
705 InitSkiaEventTracer(); | 715 InitSkiaEventTracer(); |
706 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 716 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
707 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr); | 717 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
851 discardable_shared_memory_manager_ = base::MakeUnique< | 861 discardable_shared_memory_manager_ = base::MakeUnique< |
852 discardable_memory::ClientDiscardableSharedMemoryManager>( | 862 discardable_memory::ClientDiscardableSharedMemoryManager>( |
853 std::move(manager_ptr), GetIOTaskRunner()); | 863 std::move(manager_ptr), GetIOTaskRunner()); |
854 | 864 |
855 // TODO(boliu): In single process, browser main loop should set up the | 865 // TODO(boliu): In single process, browser main loop should set up the |
856 // discardable memory manager, and should skip this if kSingleProcess. | 866 // discardable memory manager, and should skip this if kSingleProcess. |
857 // See crbug.com/503724. | 867 // See crbug.com/503724. |
858 base::DiscardableMemoryAllocator::SetInstance( | 868 base::DiscardableMemoryAllocator::SetInstance( |
859 discardable_shared_memory_manager_.get()); | 869 discardable_shared_memory_manager_.get()); |
860 | 870 |
861 GetContentClient()->renderer()->ExposeInterfacesToBrowser( | |
862 GetInterfaceRegistry()); | |
863 | |
864 GetInterfaceRegistry()->AddInterface(base::Bind(&CreateFrameFactory)); | |
865 GetInterfaceRegistry()->AddInterface( | |
866 base::Bind(&EmbeddedWorkerInstanceClientImpl::Create)); | |
867 | |
868 GetConnector()->BindInterface(mojom::kBrowserServiceName, | 871 GetConnector()->BindInterface(mojom::kBrowserServiceName, |
869 mojo::MakeRequest(&storage_partition_service_)); | 872 mojo::MakeRequest(&storage_partition_service_)); |
870 | 873 |
871 #if defined(OS_LINUX) | 874 #if defined(OS_LINUX) |
872 ChildProcess::current()->SetIOThreadPriority(base::ThreadPriority::DISPLAY); | 875 ChildProcess::current()->SetIOThreadPriority(base::ThreadPriority::DISPLAY); |
873 ChildThreadImpl::current()->SetThreadPriority( | 876 ChildThreadImpl::current()->SetThreadPriority( |
874 categorized_worker_pool_->background_worker_thread_id(), | 877 categorized_worker_pool_->background_worker_thread_id(), |
875 base::ThreadPriority::BACKGROUND); | 878 base::ThreadPriority::BACKGROUND); |
876 #endif | 879 #endif |
877 | 880 |
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2445 } | 2448 } |
2446 } | 2449 } |
2447 | 2450 |
2448 void RenderThreadImpl::OnRendererInterfaceRequest( | 2451 void RenderThreadImpl::OnRendererInterfaceRequest( |
2449 mojom::RendererAssociatedRequest request) { | 2452 mojom::RendererAssociatedRequest request) { |
2450 DCHECK(!renderer_binding_.is_bound()); | 2453 DCHECK(!renderer_binding_.is_bound()); |
2451 renderer_binding_.Bind(std::move(request)); | 2454 renderer_binding_.Bind(std::move(request)); |
2452 } | 2455 } |
2453 | 2456 |
2454 } // namespace content | 2457 } // namespace content |
OLD | NEW |