Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(760)

Side by Side Diff: content/renderer/render_thread_impl.cc

Issue 2823693002: Migrate RenderThreadImpl to use ConnectionFilter instead of the ChildThread's InterfaceRegistry to … (Closed)
Patch Set: . Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/public/renderer/content_renderer_client.h ('k') | content/shell/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/content_constants.h" 81 #include "content/public/common/content_constants.h"
82 #include "content/public/common/content_features.h" 82 #include "content/public/common/content_features.h"
83 #include "content/public/common/content_paths.h" 83 #include "content/public/common/content_paths.h"
84 #include "content/public/common/content_switches.h" 84 #include "content/public/common/content_switches.h"
85 #include "content/public/common/renderer_preferences.h" 85 #include "content/public/common/renderer_preferences.h"
86 #include "content/public/common/service_manager_connection.h"
86 #include "content/public/common/service_names.mojom.h" 87 #include "content/public/common/service_names.mojom.h"
88 #include "content/public/common/simple_connection_filter.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"
96 #include "content/renderer/dom_storage/dom_storage_dispatcher.h" 98 #include "content/renderer/dom_storage/dom_storage_dispatcher.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 #include "media/base/media.h" 136 #include "media/base/media.h"
135 #include "media/base/media_switches.h" 137 #include "media/base/media_switches.h"
136 #include "media/media_features.h" 138 #include "media/media_features.h"
137 #include "media/renderers/gpu_video_accelerator_factories.h" 139 #include "media/renderers/gpu_video_accelerator_factories.h"
138 #include "mojo/public/cpp/bindings/strong_binding.h" 140 #include "mojo/public/cpp/bindings/strong_binding.h"
139 #include "net/base/net_errors.h" 141 #include "net/base/net_errors.h"
140 #include "net/base/port_util.h" 142 #include "net/base/port_util.h"
141 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 143 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
142 #include "net/base/url_util.h" 144 #include "net/base/url_util.h"
143 #include "ppapi/features/features.h" 145 #include "ppapi/features/features.h"
146 #include "services/service_manager/public/cpp/binder_registry.h"
144 #include "services/service_manager/public/cpp/connector.h" 147 #include "services/service_manager/public/cpp/connector.h"
145 #include "services/service_manager/public/cpp/interface_provider.h" 148 #include "services/service_manager/public/cpp/interface_provider.h"
146 #include "services/service_manager/public/cpp/interface_registry.h"
147 #include "services/ui/public/cpp/bitmap/child_shared_bitmap_manager.h" 149 #include "services/ui/public/cpp/bitmap/child_shared_bitmap_manager.h"
148 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" 150 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h"
149 #include "services/ui/public/interfaces/constants.mojom.h" 151 #include "services/ui/public/interfaces/constants.mojom.h"
150 #include "skia/ext/event_tracer_impl.h" 152 #include "skia/ext/event_tracer_impl.h"
151 #include "skia/ext/skia_memory_dump_provider.h" 153 #include "skia/ext/skia_memory_dump_provider.h"
152 #include "third_party/WebKit/public/platform/WebCache.h" 154 #include "third_party/WebKit/public/platform/WebCache.h"
153 #include "third_party/WebKit/public/platform/WebImageGenerator.h" 155 #include "third_party/WebKit/public/platform/WebImageGenerator.h"
154 #include "third_party/WebKit/public/platform/WebMemoryCoordinator.h" 156 #include "third_party/WebKit/public/platform/WebMemoryCoordinator.h"
155 #include "third_party/WebKit/public/platform/WebNetworkStateNotifier.h" 157 #include "third_party/WebKit/public/platform/WebNetworkStateNotifier.h"
156 #include "third_party/WebKit/public/platform/WebString.h" 158 #include "third_party/WebKit/public/platform/WebString.h"
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 AddFilter((new CacheStorageMessageFilter(thread_safe_sender()))->GetFilter()); 686 AddFilter((new CacheStorageMessageFilter(thread_safe_sender()))->GetFilter());
685 687
686 AddFilter((new ServiceWorkerContextMessageFilter())->GetFilter()); 688 AddFilter((new ServiceWorkerContextMessageFilter())->GetFilter());
687 689
688 #if defined(USE_AURA) 690 #if defined(USE_AURA)
689 if (IsRunningInMash()) { 691 if (IsRunningInMash()) {
690 CreateRenderWidgetWindowTreeClientFactory(GetServiceManagerConnection()); 692 CreateRenderWidgetWindowTreeClientFactory(GetServiceManagerConnection());
691 } 693 }
692 #endif 694 #endif
693 695
694 // Must be called before RenderThreadStarted() below. 696 auto registry = base::MakeUnique<service_manager::BinderRegistry>();
695 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<SimpleConnectionFilter>(std::move(registry)));
696 703
697 GetContentClient()->renderer()->RenderThreadStarted(); 704 GetContentClient()->renderer()->RenderThreadStarted();
698 705
706 StartServiceManagerConnection();
707
699 field_trial_syncer_.InitFieldTrialObserving( 708 field_trial_syncer_.InitFieldTrialObserving(
700 *base::CommandLine::ForCurrentProcess(), switches::kSingleProcess); 709 *base::CommandLine::ForCurrentProcess(), switches::kSingleProcess);
701 710
702 GetAssociatedInterfaceRegistry()->AddInterface( 711 GetAssociatedInterfaceRegistry()->AddInterface(
703 base::Bind(&RenderThreadImpl::OnRendererInterfaceRequest, 712 base::Bind(&RenderThreadImpl::OnRendererInterfaceRequest,
704 base::Unretained(this))); 713 base::Unretained(this)));
705 714
706 InitSkiaEventTracer(); 715 InitSkiaEventTracer();
707 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 716 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
708 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr); 717 skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 discardable_shared_memory_manager_ = base::MakeUnique< 861 discardable_shared_memory_manager_ = base::MakeUnique<
853 discardable_memory::ClientDiscardableSharedMemoryManager>( 862 discardable_memory::ClientDiscardableSharedMemoryManager>(
854 std::move(manager_ptr), GetIOTaskRunner()); 863 std::move(manager_ptr), GetIOTaskRunner());
855 864
856 // 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
857 // discardable memory manager, and should skip this if kSingleProcess. 866 // discardable memory manager, and should skip this if kSingleProcess.
858 // See crbug.com/503724. 867 // See crbug.com/503724.
859 base::DiscardableMemoryAllocator::SetInstance( 868 base::DiscardableMemoryAllocator::SetInstance(
860 discardable_shared_memory_manager_.get()); 869 discardable_shared_memory_manager_.get());
861 870
862 GetContentClient()->renderer()->ExposeInterfacesToBrowser(
863 GetInterfaceRegistry());
864
865 GetInterfaceRegistry()->AddInterface(base::Bind(&CreateFrameFactory));
866 GetInterfaceRegistry()->AddInterface(
867 base::Bind(&EmbeddedWorkerInstanceClientImpl::Create));
868
869 GetConnector()->BindInterface(mojom::kBrowserServiceName, 871 GetConnector()->BindInterface(mojom::kBrowserServiceName,
870 mojo::MakeRequest(&storage_partition_service_)); 872 mojo::MakeRequest(&storage_partition_service_));
871 873
872 #if defined(OS_LINUX) 874 #if defined(OS_LINUX)
873 ChildProcess::current()->SetIOThreadPriority(base::ThreadPriority::DISPLAY); 875 ChildProcess::current()->SetIOThreadPriority(base::ThreadPriority::DISPLAY);
874 ChildThreadImpl::current()->SetThreadPriority( 876 ChildThreadImpl::current()->SetThreadPriority(
875 categorized_worker_pool_->background_worker_thread_id(), 877 categorized_worker_pool_->background_worker_thread_id(),
876 base::ThreadPriority::BACKGROUND); 878 base::ThreadPriority::BACKGROUND);
877 #endif 879 #endif
878 880
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
2446 } 2448 }
2447 } 2449 }
2448 2450
2449 void RenderThreadImpl::OnRendererInterfaceRequest( 2451 void RenderThreadImpl::OnRendererInterfaceRequest(
2450 mojom::RendererAssociatedRequest request) { 2452 mojom::RendererAssociatedRequest request) {
2451 DCHECK(!renderer_binding_.is_bound()); 2453 DCHECK(!renderer_binding_.is_bound());
2452 renderer_binding_.Bind(std::move(request)); 2454 renderer_binding_.Bind(std::move(request));
2453 } 2455 }
2454 2456
2455 } // namespace content 2457 } // namespace content
OLDNEW
« no previous file with comments | « content/public/renderer/content_renderer_client.h ('k') | content/shell/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698