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

Unified Diff: content/browser/storage_partition_impl.cc

Issue 2958173002: Cache the NetworkService interface pointer in the browser. (Closed)
Patch Set: review comments Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/storage_partition_impl.cc
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc
index 446cce06e957d73ade8de5468e585514d448511f..5f18fef80baa5ce687df57ad2c35eabba059e7da 100644
--- a/content/browser/storage_partition_impl.cc
+++ b/content/browser/storage_partition_impl.cc
@@ -532,16 +532,20 @@ std::unique_ptr<StoragePartitionImpl> StoragePartitionImpl::Create(
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableNetworkService)) {
- mojom::NetworkServicePtr network_service;
- ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface(
- mojom::kNetworkServiceName, &network_service);
+ static mojom::NetworkServicePtr* g_network_service =
+ new mojom::NetworkServicePtr;
+ if (!g_network_service->is_bound()) {
+ ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface(
+ mojom::kNetworkServiceName, g_network_service);
+ }
mojom::NetworkContextParamsPtr context_params =
mojom::NetworkContextParams::New();
// TODO: fill this
// context_params->cache_dir =
// context_params->cookie_path =
- network_service->CreateNetworkContext(
- MakeRequest(&partition->network_context_), std::move(context_params));
+ (*g_network_service)
+ ->CreateNetworkContext(MakeRequest(&partition->network_context_),
+ std::move(context_params));
BlobURLLoaderFactory::BlobContextGetter blob_getter =
base::BindOnce(&BlobStorageContextGetter, blob_context);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698