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

Side by Side 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, 5 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 | « no previous file | no next file » | 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/browser/storage_partition_impl.h" 5 #include "content/browser/storage_partition_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 525
526 partition->broadcast_channel_provider_ = new BroadcastChannelProvider(); 526 partition->broadcast_channel_provider_ = new BroadcastChannelProvider();
527 527
528 partition->bluetooth_allowed_devices_map_ = new BluetoothAllowedDevicesMap(); 528 partition->bluetooth_allowed_devices_map_ = new BluetoothAllowedDevicesMap();
529 529
530 scoped_refptr<ChromeBlobStorageContext> blob_context = 530 scoped_refptr<ChromeBlobStorageContext> blob_context =
531 ChromeBlobStorageContext::GetFor(context); 531 ChromeBlobStorageContext::GetFor(context);
532 532
533 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 533 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
534 switches::kEnableNetworkService)) { 534 switches::kEnableNetworkService)) {
535 mojom::NetworkServicePtr network_service; 535 static mojom::NetworkServicePtr* g_network_service =
536 ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface( 536 new mojom::NetworkServicePtr;
537 mojom::kNetworkServiceName, &network_service); 537 if (!g_network_service->is_bound()) {
538 ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface(
539 mojom::kNetworkServiceName, g_network_service);
540 }
538 mojom::NetworkContextParamsPtr context_params = 541 mojom::NetworkContextParamsPtr context_params =
539 mojom::NetworkContextParams::New(); 542 mojom::NetworkContextParams::New();
540 // TODO: fill this 543 // TODO: fill this
541 // context_params->cache_dir = 544 // context_params->cache_dir =
542 // context_params->cookie_path = 545 // context_params->cookie_path =
543 network_service->CreateNetworkContext( 546 (*g_network_service)
544 MakeRequest(&partition->network_context_), std::move(context_params)); 547 ->CreateNetworkContext(MakeRequest(&partition->network_context_),
548 std::move(context_params));
545 549
546 BlobURLLoaderFactory::BlobContextGetter blob_getter = 550 BlobURLLoaderFactory::BlobContextGetter blob_getter =
547 base::BindOnce(&BlobStorageContextGetter, blob_context); 551 base::BindOnce(&BlobStorageContextGetter, blob_context);
548 partition->blob_url_loader_factory_ = new BlobURLLoaderFactory( 552 partition->blob_url_loader_factory_ = new BlobURLLoaderFactory(
549 std::move(blob_getter), partition->filesystem_context_); 553 std::move(blob_getter), partition->filesystem_context_);
550 554
551 partition->url_loader_factory_getter_ = new URLLoaderFactoryGetter(); 555 partition->url_loader_factory_getter_ = new URLLoaderFactoryGetter();
552 partition->url_loader_factory_getter_->Initialize(partition.get()); 556 partition->url_loader_factory_getter_->Initialize(partition.get());
553 } 557 }
554 558
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 media_url_request_context_ = media_url_request_context; 993 media_url_request_context_ = media_url_request_context;
990 } 994 }
991 995
992 void StoragePartitionImpl::GetQuotaSettings( 996 void StoragePartitionImpl::GetQuotaSettings(
993 storage::OptionalQuotaSettingsCallback callback) { 997 storage::OptionalQuotaSettingsCallback callback) {
994 GetContentClient()->browser()->GetQuotaSettings(browser_context_, this, 998 GetContentClient()->browser()->GetQuotaSettings(browser_context_, this,
995 std::move(callback)); 999 std::move(callback));
996 } 1000 }
997 1001
998 } // namespace content 1002 } // namespace content
OLDNEW
« 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