Chromium Code Reviews| 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..e5e92e136f4c4d7b099c433ad3fc5aa26a1e56c2 100644 |
| --- a/content/browser/storage_partition_impl.cc |
| +++ b/content/browser/storage_partition_impl.cc |
| @@ -10,7 +10,8 @@ |
| #include <vector> |
| #include "base/bind.h" |
| -#include "base/command_line.h" |
| +#include "base/command_line.h" |
| +#include "base/lazy_instance.h" |
| #include "base/location.h" |
| #include "base/sequenced_task_runner.h" |
| #include "base/single_thread_task_runner.h" |
| @@ -532,15 +533,18 @@ 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 base::LazyInstance<mojom::NetworkServicePtr>::Leaky |
|
Ken Rockot(use gerrit already)
2017/06/27 22:52:39
I'm pretty sure the fact that we now have thread-s
Ken Rockot(use gerrit already)
2017/06/27 22:52:39
Is there any reason to use LazyInstance now? Why n
jam
2017/06/27 23:42:18
Done.
|
| + g_network_service = LAZY_INSTANCE_INITIALIZER; |
| + if (!g_network_service.Get()) { |
| + ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface( |
| + mojom::kNetworkServiceName, &g_network_service.Get()); |
| + } |
| mojom::NetworkContextParamsPtr context_params = |
| mojom::NetworkContextParams::New(); |
| // TODO: fill this |
| // context_params->cache_dir = |
| // context_params->cookie_path = |
| - network_service->CreateNetworkContext( |
| + g_network_service.Get()->CreateNetworkContext( |
| MakeRequest(&partition->network_context_), std::move(context_params)); |
| BlobURLLoaderFactory::BlobContextGetter blob_getter = |