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

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 2755813002: Begin to wean child processes off reliance on a persistent service_manager::Connection to the brows… (Closed)
Patch Set: . Created 3 years, 9 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
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 "chrome/renderer/chrome_content_renderer_client.h" 5 #include "chrome/renderer/chrome_content_renderer_client.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 #include "components/spellcheck/spellcheck_build_features.h" 80 #include "components/spellcheck/spellcheck_build_features.h"
81 #include "components/startup_metric_utils/common/startup_metric.mojom.h" 81 #include "components/startup_metric_utils/common/startup_metric.mojom.h"
82 #include "components/subresource_filter/content/renderer/subresource_filter_agen t.h" 82 #include "components/subresource_filter/content/renderer/subresource_filter_agen t.h"
83 #include "components/subresource_filter/content/renderer/unverified_ruleset_deal er.h" 83 #include "components/subresource_filter/content/renderer/unverified_ruleset_deal er.h"
84 #include "components/task_scheduler_util/renderer/initialization.h" 84 #include "components/task_scheduler_util/renderer/initialization.h"
85 #include "components/version_info/version_info.h" 85 #include "components/version_info/version_info.h"
86 #include "components/visitedlink/renderer/visitedlink_slave.h" 86 #include "components/visitedlink/renderer/visitedlink_slave.h"
87 #include "components/web_cache/renderer/web_cache_impl.h" 87 #include "components/web_cache/renderer/web_cache_impl.h"
88 #include "content/public/common/content_constants.h" 88 #include "content/public/common/content_constants.h"
89 #include "content/public/common/content_switches.h" 89 #include "content/public/common/content_switches.h"
90 #include "content/public/common/service_names.mojom.h"
90 #include "content/public/common/url_constants.h" 91 #include "content/public/common/url_constants.h"
91 #include "content/public/renderer/plugin_instance_throttler.h" 92 #include "content/public/renderer/plugin_instance_throttler.h"
92 #include "content/public/renderer/render_frame.h" 93 #include "content/public/renderer/render_frame.h"
93 #include "content/public/renderer/render_thread.h" 94 #include "content/public/renderer/render_thread.h"
94 #include "content/public/renderer/render_view.h" 95 #include "content/public/renderer/render_view.h"
95 #include "content/public/renderer/render_view_visitor.h" 96 #include "content/public/renderer/render_view_visitor.h"
96 #include "extensions/common/constants.h" 97 #include "extensions/common/constants.h"
97 #include "extensions/features/features.h" 98 #include "extensions/features/features.h"
98 #include "ipc/ipc_sync_channel.h" 99 #include "ipc/ipc_sync_channel.h"
99 #include "media/media_features.h" 100 #include "media/media_features.h"
100 #include "net/base/net_errors.h" 101 #include "net/base/net_errors.h"
101 #include "ppapi/c/private/ppb_pdf.h" 102 #include "ppapi/c/private/ppb_pdf.h"
102 #include "ppapi/features/features.h" 103 #include "ppapi/features/features.h"
103 #include "ppapi/shared_impl/ppapi_switches.h" 104 #include "ppapi/shared_impl/ppapi_switches.h"
104 #include "printing/features/features.h" 105 #include "printing/features/features.h"
105 #include "services/service_manager/public/cpp/interface_provider.h" 106 #include "services/service_manager/public/cpp/connector.h"
106 #include "third_party/WebKit/public/platform/URLConversion.h" 107 #include "third_party/WebKit/public/platform/URLConversion.h"
107 #include "third_party/WebKit/public/platform/WebCache.h" 108 #include "third_party/WebKit/public/platform/WebCache.h"
108 #include "third_party/WebKit/public/platform/WebCachePolicy.h" 109 #include "third_party/WebKit/public/platform/WebCachePolicy.h"
109 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h" 110 #include "third_party/WebKit/public/platform/WebSecurityOrigin.h"
110 #include "third_party/WebKit/public/platform/WebURL.h" 111 #include "third_party/WebKit/public/platform/WebURL.h"
111 #include "third_party/WebKit/public/platform/WebURLError.h" 112 #include "third_party/WebKit/public/platform/WebURLError.h"
112 #include "third_party/WebKit/public/platform/WebURLRequest.h" 113 #include "third_party/WebKit/public/platform/WebURLRequest.h"
113 #include "third_party/WebKit/public/platform/WebURLResponse.h" 114 #include "third_party/WebKit/public/platform/WebURLResponse.h"
114 #include "third_party/WebKit/public/web/WebDataSource.h" 115 #include "third_party/WebKit/public/web/WebDataSource.h"
115 #include "third_party/WebKit/public/web/WebDocument.h" 116 #include "third_party/WebKit/public/web/WebDocument.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 } 352 }
352 353
353 ChromeContentRendererClient::~ChromeContentRendererClient() { 354 ChromeContentRendererClient::~ChromeContentRendererClient() {
354 } 355 }
355 356
356 void ChromeContentRendererClient::RenderThreadStarted() { 357 void ChromeContentRendererClient::RenderThreadStarted() {
357 RenderThread* thread = RenderThread::Get(); 358 RenderThread* thread = RenderThread::Get();
358 359
359 { 360 {
360 startup_metric_utils::mojom::StartupMetricHostPtr startup_metric_host; 361 startup_metric_utils::mojom::StartupMetricHostPtr startup_metric_host;
361 thread->GetRemoteInterfaces()->GetInterface(&startup_metric_host); 362 thread->GetConnector()->BindInterface(content::mojom::kBrowserServiceName,
363 &startup_metric_host);
362 startup_metric_host->RecordRendererMainEntryTime(main_entry_time_); 364 startup_metric_host->RecordRendererMainEntryTime(main_entry_time_);
363 } 365 }
364 366
365 #if defined(OS_WIN) 367 #if defined(OS_WIN)
366 if (base::FeatureList::IsEnabled(features::kModuleDatabase)) { 368 if (base::FeatureList::IsEnabled(features::kModuleDatabase)) {
367 thread->GetRemoteInterfaces()->GetInterface(&module_event_sink_); 369 thread->GetConnector()->BindInterface(content::mojom::kBrowserServiceName,
370 &module_event_sink_);
368 371
369 // Rebind the ModuleEventSink so that it can be accessed on the IO thread. 372 // Rebind the ModuleEventSink so that it can be accessed on the IO thread.
370 module_event_sink_.Bind(module_event_sink_.PassInterface(), 373 module_event_sink_.Bind(module_event_sink_.PassInterface(),
371 thread->GetIOTaskRunner()); 374 thread->GetIOTaskRunner());
372 375
373 // It is safe to pass an unretained pointer to |module_event_sink_|, as it 376 // It is safe to pass an unretained pointer to |module_event_sink_|, as it
374 // is owned by the process singleton ChromeContentRendererClient, which is 377 // is owned by the process singleton ChromeContentRendererClient, which is
375 // leaked. 378 // leaked.
376 module_watcher_ = ModuleWatcher::Create( 379 module_watcher_ = ModuleWatcher::Create(
377 base::Bind(&OnModuleEvent, thread->GetIOTaskRunner(), 380 base::Bind(&OnModuleEvent, thread->GetIOTaskRunner(),
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 #if BUILDFLAG(ENABLE_EXTENSIONS) 1355 #if BUILDFLAG(ENABLE_EXTENSIONS)
1353 return ChromeExtensionsRendererClient::CreateBrowserPluginDelegate( 1356 return ChromeExtensionsRendererClient::CreateBrowserPluginDelegate(
1354 render_frame, mime_type, original_url); 1357 render_frame, mime_type, original_url);
1355 #else 1358 #else
1356 return nullptr; 1359 return nullptr;
1357 #endif 1360 #endif
1358 } 1361 }
1359 1362
1360 void ChromeContentRendererClient::RecordRappor(const std::string& metric, 1363 void ChromeContentRendererClient::RecordRappor(const std::string& metric,
1361 const std::string& sample) { 1364 const std::string& sample) {
1362 if (!rappor_recorder_) 1365 if (!rappor_recorder_) {
1363 RenderThread::Get()->GetRemoteInterfaces()->GetInterface(&rappor_recorder_); 1366 RenderThread::Get()->GetConnector()->BindInterface(
1367 content::mojom::kBrowserServiceName, &rappor_recorder_);
1368 }
1364 rappor_recorder_->RecordRappor(metric, sample); 1369 rappor_recorder_->RecordRappor(metric, sample);
1365 } 1370 }
1366 1371
1367 void ChromeContentRendererClient::RecordRapporURL(const std::string& metric, 1372 void ChromeContentRendererClient::RecordRapporURL(const std::string& metric,
1368 const GURL& url) { 1373 const GURL& url) {
1369 if (!rappor_recorder_) 1374 if (!rappor_recorder_) {
1370 RenderThread::Get()->GetRemoteInterfaces()->GetInterface(&rappor_recorder_); 1375 RenderThread::Get()->GetConnector()->BindInterface(
1376 content::mojom::kBrowserServiceName, &rappor_recorder_);
1377 }
1371 rappor_recorder_->RecordRapporURL(metric, url); 1378 rappor_recorder_->RecordRapporURL(metric, url);
1372 } 1379 }
1373 1380
1374 void ChromeContentRendererClient::AddImageContextMenuProperties( 1381 void ChromeContentRendererClient::AddImageContextMenuProperties(
1375 const WebURLResponse& response, 1382 const WebURLResponse& response,
1376 std::map<std::string, std::string>* properties) { 1383 std::map<std::string, std::string>* properties) {
1377 DCHECK(properties); 1384 DCHECK(properties);
1378 WebString header_key(WebString::fromASCII( 1385 WebString header_key(WebString::fromASCII(
1379 data_reduction_proxy::chrome_proxy_content_transform_header())); 1386 data_reduction_proxy::chrome_proxy_content_transform_header()));
1380 if (!response.httpHeaderField(header_key).isNull() && 1387 if (!response.httpHeaderField(header_key).isNull() &&
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 std::vector<base::SchedulerWorkerPoolParams>* params_vector, 1523 std::vector<base::SchedulerWorkerPoolParams>* params_vector,
1517 base::TaskScheduler::WorkerPoolIndexForTraitsCallback* 1524 base::TaskScheduler::WorkerPoolIndexForTraitsCallback*
1518 index_to_traits_callback) { 1525 index_to_traits_callback) {
1519 DCHECK(params_vector); 1526 DCHECK(params_vector);
1520 DCHECK(index_to_traits_callback); 1527 DCHECK(index_to_traits_callback);
1521 // If this call fails, content will fall back to the default params. 1528 // If this call fails, content will fall back to the default params.
1522 *params_vector = task_scheduler_util::GetRendererWorkerPoolParams(); 1529 *params_vector = task_scheduler_util::GetRendererWorkerPoolParams();
1523 *index_to_traits_callback = 1530 *index_to_traits_callback =
1524 base::Bind(&task_scheduler_util::RendererWorkerPoolIndexForTraits); 1531 base::Bind(&task_scheduler_util::RendererWorkerPoolIndexForTraits);
1525 } 1532 }
OLDNEW
« no previous file with comments | « chrome/gpu/chrome_content_gpu_client.cc ('k') | chrome/renderer/chrome_render_thread_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698