Commit 258cfcba authored by Matt Menke's avatar Matt Menke Committed by Commit Bot

HttpServerPropertiesManager: Remove use of two threads.

All consumers now use a single thread for prefs and the network stack,
so there's no need for it to have thread hopping logic.

This also makes HttpServerPropertiesManager better support the case
where prefs aren't loaded when it's created (Always the case in
consumers), and makes it flush to prefs on destruction, which can
now be done, since the net and prefs threads are the same.

This also fixes a crasher in the single-thread case, due to the use of
base::Unretained when calling from the prefs thread to the network
thread, which doesn't work when they're the same thread.

Bug: 768884, 770179
NOPRESUBMIT=true
(Unfortunately, the tests use banned APIs. This use predates this CL,
    and this CL doesn't introduce new uses of them. Fixing a crasher
    is more important than removing banned APIs).

Cq-Include-Trybots: master.tryserver.chromium.android:android_cronet_tester;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I2692e3c02ff6028b585416808b60cabcf9d2e2e6
Reviewed-on: https://chromium-review.googlesource.com/693054Reviewed-by: default avatarAndrei Kapishnikov <kapishnikov@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Reviewed-by: default avatarBence Béky <bnc@chromium.org>
Commit-Queue: Matt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506897}
parent 2892069a
...@@ -224,18 +224,19 @@ class CronetURLRequestContextAdapter ...@@ -224,18 +224,19 @@ class CronetURLRequestContextAdapter
// that weakly references |network_quality_estimator_|. // that weakly references |network_quality_estimator_|.
std::unique_ptr<net::NetworkQualityEstimator> network_quality_estimator_; std::unique_ptr<net::NetworkQualityEstimator> network_quality_estimator_;
std::unique_ptr<net::URLRequestContext> context_;
// Manages the PrefService and all associated persistence managers // Manages the PrefService and all associated persistence managers
// such as NetworkQualityPrefsManager, HostCachePersistenceManager, etc. // such as NetworkQualityPrefsManager, HostCachePersistenceManager, etc.
// It should be destroyed before |network_quality_estimator_| and // It should be destroyed before |network_quality_estimator_| and
// |context_|. // after |context_|.
std::unique_ptr<CronetPrefsManager> cronet_prefs_manager_; std::unique_ptr<CronetPrefsManager> cronet_prefs_manager_;
std::unique_ptr<net::ProxyConfigService> proxy_config_service_; std::unique_ptr<net::URLRequestContext> context_;
// Context config is only valid until context is initialized. // Context config is only valid until context is initialized.
std::unique_ptr<URLRequestContextConfig> context_config_; std::unique_ptr<URLRequestContextConfig> context_config_;
// As is the proxy config service, as ownership is passed to the
// URLRequestContextBuilder.
std::unique_ptr<net::ProxyConfigService> proxy_config_service_;
// Effective experimental options. Kept for NetLog. // Effective experimental options. Kept for NetLog.
std::unique_ptr<base::DictionaryValue> effective_experimental_options_; std::unique_ptr<base::DictionaryValue> effective_experimental_options_;
......
...@@ -6,7 +6,9 @@ ...@@ -6,7 +6,9 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/location.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "components/cronet/host_cache_persistence_manager.h" #include "components/cronet/host_cache_persistence_manager.h"
#include "components/prefs/json_pref_store.h" #include "components/prefs/json_pref_store.h"
...@@ -101,14 +103,8 @@ class PrefServiceAdapter ...@@ -101,14 +103,8 @@ class PrefServiceAdapter
~PrefServiceAdapter() override {} ~PrefServiceAdapter() override {}
// PrefDelegate implementation. // PrefDelegate implementation.
bool HasServerProperties() override { const base::DictionaryValue* GetServerProperties() const override {
return pref_service_->HasPrefPath(path_); return pref_service_->GetDictionary(path_);
}
const base::DictionaryValue& GetServerProperties() const override {
// Guaranteed not to return null when the pref is registered
// (RegisterProfilePrefs was called).
return *pref_service_->GetDictionary(path_);
} }
void SetServerProperties(const base::DictionaryValue& value) override { void SetServerProperties(const base::DictionaryValue& value) override {
...@@ -117,10 +113,9 @@ class PrefServiceAdapter ...@@ -117,10 +113,9 @@ class PrefServiceAdapter
void StartListeningForUpdates(const base::Closure& callback) override { void StartListeningForUpdates(const base::Closure& callback) override {
pref_change_registrar_.Add(path_, callback); pref_change_registrar_.Add(path_, callback);
} // Notify the pref manager that settings are already loaded, as a result
// of initializing the pref store synchornously.
void StopListeningForUpdates() override { base::SequencedTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback);
pref_change_registrar_.RemoveAll();
} }
private: private:
...@@ -245,9 +240,7 @@ CronetPrefsManager::CronetPrefsManager( ...@@ -245,9 +240,7 @@ CronetPrefsManager::CronetPrefsManager(
} }
http_server_properties_manager_ = new net::HttpServerPropertiesManager( http_server_properties_manager_ = new net::HttpServerPropertiesManager(
new PrefServiceAdapter(pref_service_.get()), network_task_runner, std::make_unique<PrefServiceAdapter>(pref_service_.get()), net_log);
network_task_runner, net_log);
http_server_properties_manager_->InitializeOnNetworkSequence();
// Passes |http_server_properties_manager_| ownership to |context_builder|. // Passes |http_server_properties_manager_| ownership to |context_builder|.
// The ownership will be subsequently passed to UrlRequestContext. // The ownership will be subsequently passed to UrlRequestContext.
...@@ -289,9 +282,10 @@ void CronetPrefsManager::PrepareForShutdown() { ...@@ -289,9 +282,10 @@ void CronetPrefsManager::PrepareForShutdown() {
pref_service_->CommitPendingWrite(); pref_service_->CommitPendingWrite();
// Shutdown managers on the Pref sequence. // Shutdown managers on the Pref sequence.
http_server_properties_manager_->ShutdownOnPrefSequence();
if (network_qualities_prefs_manager_) if (network_qualities_prefs_manager_)
network_qualities_prefs_manager_->ShutdownOnPrefSequence(); network_qualities_prefs_manager_->ShutdownOnPrefSequence();
host_cache_persistence_manager_.reset();
} }
} // namespace cronet } // namespace cronet
...@@ -272,14 +272,14 @@ void CronetEnvironment::CleanUpOnNetworkThread() { ...@@ -272,14 +272,14 @@ void CronetEnvironment::CleanUpOnNetworkThread() {
cronet_prefs_manager_->PrepareForShutdown(); cronet_prefs_manager_->PrepareForShutdown();
} }
// TODO(lilyhoughton) this should be smarter about making sure there are no
// pending requests, etc.
main_context_.reset();
// cronet_prefs_manager_ should be deleted on the network thread. // cronet_prefs_manager_ should be deleted on the network thread.
cronet_prefs_manager_.reset(); cronet_prefs_manager_.reset();
file_thread_.reset(); file_thread_.reset();
// TODO(lilyhoughton) this should be smarter about making sure there are no
// pending requests, etc.
main_context_.reset();
} }
CronetEnvironment::~CronetEnvironment() { CronetEnvironment::~CronetEnvironment() {
......
...@@ -26,15 +26,9 @@ void HttpServerPropertiesPrefDelegate::RegisterPrefs( ...@@ -26,15 +26,9 @@ void HttpServerPropertiesPrefDelegate::RegisterPrefs(
pref_registry->RegisterDictionaryPref(kPrefPath); pref_registry->RegisterDictionaryPref(kPrefPath);
} }
bool HttpServerPropertiesPrefDelegate::HasServerProperties() { const base::DictionaryValue*
return pref_service_->HasPrefPath(kPrefPath);
}
const base::DictionaryValue&
HttpServerPropertiesPrefDelegate::GetServerProperties() const { HttpServerPropertiesPrefDelegate::GetServerProperties() const {
// Guaranteed not to return null when the pref is registered return pref_service_->GetDictionary(kPrefPath);
// (RegisterProfilePrefs was called).
return *pref_service_->GetDictionary(kPrefPath);
} }
void HttpServerPropertiesPrefDelegate::SetServerProperties( void HttpServerPropertiesPrefDelegate::SetServerProperties(
...@@ -54,8 +48,4 @@ void HttpServerPropertiesPrefDelegate::StartListeningForUpdates( ...@@ -54,8 +48,4 @@ void HttpServerPropertiesPrefDelegate::StartListeningForUpdates(
} }
} }
void HttpServerPropertiesPrefDelegate::StopListeningForUpdates() {
pref_change_registrar_.RemoveAll();
}
} // namespace content } // namespace content
...@@ -25,11 +25,9 @@ class HttpServerPropertiesPrefDelegate ...@@ -25,11 +25,9 @@ class HttpServerPropertiesPrefDelegate
static void RegisterPrefs(PrefRegistrySimple* pref_registry); static void RegisterPrefs(PrefRegistrySimple* pref_registry);
// net::HttpServerPropertiesManager::PrefDelegate implementation. // net::HttpServerPropertiesManager::PrefDelegate implementation.
bool HasServerProperties() override; const base::DictionaryValue* GetServerProperties() const override;
const base::DictionaryValue& GetServerProperties() const override;
void SetServerProperties(const base::DictionaryValue& value) override; void SetServerProperties(const base::DictionaryValue& value) override;
void StartListeningForUpdates(const base::Closure& callback) override; void StartListeningForUpdates(const base::Closure& callback) override;
void StopListeningForUpdates() override;
private: private:
PrefService* pref_service_; PrefService* pref_service_;
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/task_scheduler/post_task.h" #include "base/task_scheduler/post_task.h"
#include "base/task_scheduler/task_traits.h" #include "base/task_scheduler/task_traits.h"
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "components/network_session_configurator/browser/network_session_configurator.h" #include "components/network_session_configurator/browser/network_session_configurator.h"
#include "components/network_session_configurator/common/network_switches.h" #include "components/network_session_configurator/common/network_switches.h"
...@@ -97,9 +96,6 @@ NetworkContext::~NetworkContext() { ...@@ -97,9 +96,6 @@ NetworkContext::~NetworkContext() {
while (!url_loaders_.empty()) while (!url_loaders_.empty())
(*url_loaders_.begin())->Cleanup(); (*url_loaders_.begin())->Cleanup();
if (http_server_properties_manager_)
http_server_properties_manager_->ShutdownOnPrefSequence();
// May be nullptr in tests. // May be nullptr in tests.
if (network_service_) if (network_service_)
network_service_->DeregisterNetworkContext(this); network_service_->DeregisterNetworkContext(this);
...@@ -260,17 +256,11 @@ void NetworkContext::ApplyContextParamsToBuilder( ...@@ -260,17 +256,11 @@ void NetworkContext::ApplyContextParamsToBuilder(
HttpServerPropertiesPrefDelegate::RegisterPrefs(pref_registry.get()); HttpServerPropertiesPrefDelegate::RegisterPrefs(pref_registry.get());
pref_service_ = pref_service_factory.Create(pref_registry.get()); pref_service_ = pref_service_factory.Create(pref_registry.get());
std::unique_ptr<net::HttpServerPropertiesManager> http_server_properties = builder->SetHttpServerProperties(
std::make_unique<net::HttpServerPropertiesManager>( std::make_unique<net::HttpServerPropertiesManager>(
// HttpServerPropertiesManager implicitly takes ownership of the std::make_unique<HttpServerPropertiesPrefDelegate>(
// PrefDelegate. pref_service_.get()),
new HttpServerPropertiesPrefDelegate(pref_service_.get()), builder->net_log()));
base::ThreadTaskRunnerHandle::Get(),
base::ThreadTaskRunnerHandle::Get(), builder->net_log());
http_server_properties_manager_ = http_server_properties.get();
http_server_properties_manager_->InitializeOnNetworkSequence();
builder->SetHttpServerProperties(std::move(http_server_properties));
} }
builder->set_data_enabled(network_context_params->enable_data_url_support); builder->set_data_enabled(network_context_params->enable_data_url_support);
...@@ -311,12 +301,8 @@ void NetworkContext::ClearNetworkingHistorySince( ...@@ -311,12 +301,8 @@ void NetworkContext::ClearNetworkingHistorySince(
url_request_context_->transport_security_state()->DeleteAllDynamicDataSince( url_request_context_->transport_security_state()->DeleteAllDynamicDataSince(
time); time);
if (http_server_properties_manager_) { url_request_context_->http_server_properties()->Clear();
http_server_properties_manager_->Clear(std::move(completion_callback)); std::move(completion_callback).Run();
} else {
url_request_context_->http_server_properties()->Clear();
std::move(completion_callback).Run();
}
} }
} // namespace content } // namespace content
...@@ -96,11 +96,6 @@ class CONTENT_EXPORT NetworkContext : public mojom::NetworkContext { ...@@ -96,11 +96,6 @@ class CONTENT_EXPORT NetworkContext : public mojom::NetworkContext {
// Disables use of QUIC by the NetworkContext. // Disables use of QUIC by the NetworkContext.
void DisableQuic(); void DisableQuic();
net::HttpServerPropertiesManager* http_server_properties_manager_for_testing()
const {
return http_server_properties_manager_;
}
private: private:
NetworkContext(); NetworkContext();
...@@ -142,9 +137,6 @@ class CONTENT_EXPORT NetworkContext : public mojom::NetworkContext { ...@@ -142,9 +137,6 @@ class CONTENT_EXPORT NetworkContext : public mojom::NetworkContext {
std::unique_ptr<CookieManagerImpl> cookie_manager_; std::unique_ptr<CookieManagerImpl> cookie_manager_;
// Owned by |owned_url_request_context_|. May be nullptr.
net::HttpServerPropertiesManager* http_server_properties_manager_ = nullptr;
// Temporary class to help diagnose the impact of https://crbug.com/711579. // Temporary class to help diagnose the impact of https://crbug.com/711579.
// Every 24-hours, measures the size of the network cache and emits an UMA // Every 24-hours, measures the size of the network cache and emits an UMA
// metric. // metric.
......
...@@ -428,15 +428,10 @@ TEST_F(NetworkContextTest, HttpServerPropertiesToDisk) { ...@@ -428,15 +428,10 @@ TEST_F(NetworkContextTest, HttpServerPropertiesToDisk) {
network_context->url_request_context() network_context->url_request_context()
->http_server_properties() ->http_server_properties()
->SetSupportsSpdy(kSchemeHostPort, true); ->SetSupportsSpdy(kSchemeHostPort, true);
network_context->http_server_properties_manager_for_testing() // Deleting the context will cause it to flush state. Wait for the pref
->UpdatePrefsForTesting(); // service to flush to disk.
// Wait HttpServerProperties manager to flush to the pref service.
scoped_task_environment_.RunUntilIdle();
// Delete the NetworkContext and wait for its JsonPrefStore to flush to disk.
network_context.reset(); network_context.reset();
scoped_task_environment_.RunUntilIdle(); scoped_task_environment_.RunUntilIdle();
EXPECT_TRUE(base::PathExists(file_path));
// Create a new NetworkContext using the same path for HTTP server properties. // Create a new NetworkContext using the same path for HTTP server properties.
context_params = mojom::NetworkContextParams::New(); context_params = mojom::NetworkContextParams::New();
...@@ -446,18 +441,6 @@ TEST_F(NetworkContextTest, HttpServerPropertiesToDisk) { ...@@ -446,18 +441,6 @@ TEST_F(NetworkContextTest, HttpServerPropertiesToDisk) {
// Wait for properties to load from disk. // Wait for properties to load from disk.
scoped_task_environment_.RunUntilIdle(); scoped_task_environment_.RunUntilIdle();
// Wait for net::HttpServerPropertiesManager to decide to read the prefs again
// from the pref file, now that it's been read.
base::RunLoop run_loop;
base::SequencedTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE, run_loop.QuitClosure(),
net::HttpServerPropertiesManager::GetUpdateCacheDelayForTesting());
run_loop.Run();
// Wait for the net::HttpServerPropertiesManager to actually read the prefs.
// TODO(mmenke): All this waiting is rather silly. Fix it.
scoped_task_environment_.RunUntilIdle();
EXPECT_TRUE(network_context->url_request_context() EXPECT_TRUE(network_context->url_request_context()
->http_server_properties() ->http_server_properties()
->GetSupportsSpdy(kSchemeHostPort)); ->GetSupportsSpdy(kSchemeHostPort));
......
...@@ -21,7 +21,6 @@ class ChromeBrowserState; ...@@ -21,7 +21,6 @@ class ChromeBrowserState;
namespace net { namespace net {
class CookieStore; class CookieStore;
class HttpNetworkSession; class HttpNetworkSession;
class HttpServerPropertiesManager;
class HttpTransactionFactory; class HttpTransactionFactory;
} // namespace net } // namespace net
...@@ -137,10 +136,6 @@ class ChromeBrowserStateImplIOData : public ChromeBrowserStateIOData { ...@@ -137,10 +136,6 @@ class ChromeBrowserStateImplIOData : public ChromeBrowserStateIOData {
mutable std::unique_ptr<net::HttpNetworkSession> http_network_session_; mutable std::unique_ptr<net::HttpNetworkSession> http_network_session_;
mutable std::unique_ptr<net::HttpTransactionFactory> main_http_factory_; mutable std::unique_ptr<net::HttpTransactionFactory> main_http_factory_;
// Same as |ChromeBrowserState::http_server_properties_|, owned there to
// maintain destruction ordering.
mutable net::HttpServerPropertiesManager* http_server_properties_manager_;
mutable std::unique_ptr<net::CookieStore> main_cookie_store_; mutable std::unique_ptr<net::CookieStore> main_cookie_store_;
mutable std::unique_ptr<net::URLRequestJobFactory> main_job_factory_; mutable std::unique_ptr<net::URLRequestJobFactory> main_job_factory_;
......
...@@ -176,13 +176,9 @@ ChromeBrowserStateImplIOData::LazyParams::~LazyParams() {} ...@@ -176,13 +176,9 @@ ChromeBrowserStateImplIOData::LazyParams::~LazyParams() {}
ChromeBrowserStateImplIOData::ChromeBrowserStateImplIOData() ChromeBrowserStateImplIOData::ChromeBrowserStateImplIOData()
: ChromeBrowserStateIOData( : ChromeBrowserStateIOData(
ios::ChromeBrowserStateType::REGULAR_BROWSER_STATE), ios::ChromeBrowserStateType::REGULAR_BROWSER_STATE),
http_server_properties_manager_(nullptr),
app_cache_max_size_(0) {} app_cache_max_size_(0) {}
ChromeBrowserStateImplIOData::~ChromeBrowserStateImplIOData() { ChromeBrowserStateImplIOData::~ChromeBrowserStateImplIOData() {}
if (http_server_properties_manager_)
http_server_properties_manager_->ShutdownOnPrefSequence();
}
void ChromeBrowserStateImplIOData::InitializeInternal( void ChromeBrowserStateImplIOData::InitializeInternal(
std::unique_ptr<IOSChromeNetworkDelegate> chrome_network_delegate, std::unique_ptr<IOSChromeNetworkDelegate> chrome_network_delegate,
...@@ -206,11 +202,8 @@ void ChromeBrowserStateImplIOData::InitializeInternal( ...@@ -206,11 +202,8 @@ void ChromeBrowserStateImplIOData::InitializeInternal(
ApplyProfileParamsToContext(main_context); ApplyProfileParamsToContext(main_context);
http_server_properties_manager_ = set_http_server_properties(HttpServerPropertiesManagerFactory::CreateManager(
HttpServerPropertiesManagerFactory::CreateManager(network_json_store_, network_json_store_, io_thread->net_log()));
io_thread->net_log());
set_http_server_properties(base::WrapUnique(http_server_properties_manager_));
http_server_properties_manager_->InitializeOnNetworkSequence();
main_context->set_transport_security_state(transport_security_state()); main_context->set_transport_security_state(transport_security_state());
...@@ -353,8 +346,6 @@ void ChromeBrowserStateImplIOData::ClearNetworkingHistorySinceOnIOThread( ...@@ -353,8 +346,6 @@ void ChromeBrowserStateImplIOData::ClearNetworkingHistorySinceOnIOThread(
DCHECK(transport_security_state()); DCHECK(transport_security_state());
// Completes synchronously. // Completes synchronously.
transport_security_state()->DeleteAllDynamicDataSince(time); transport_security_state()->DeleteAllDynamicDataSince(time);
DCHECK(http_server_properties_manager_); http_server_properties()->Clear();
http_server_properties_manager_->Clear( web::WebThread::PostTask(web::WebThread::UI, FROM_HERE, completion);
base::BindOnce(base::IgnoreResult(&web::WebThread::PostTask),
web::WebThread::UI, FROM_HERE, completion));
} }
...@@ -27,18 +27,15 @@ class PrefServiceAdapter ...@@ -27,18 +27,15 @@ class PrefServiceAdapter
~PrefServiceAdapter() override { pref_store_->RemoveObserver(this); } ~PrefServiceAdapter() override { pref_store_->RemoveObserver(this); }
// PrefDelegate implementation. // PrefDelegate implementation.
bool HasServerProperties() override { const base::DictionaryValue* GetServerProperties() const override {
return pref_store_->GetValue(path_, nullptr);
}
const base::DictionaryValue& GetServerProperties() const override {
const base::Value* value; const base::Value* value;
if (pref_store_->GetValue(path_, &value)) { if (pref_store_->GetValue(path_, &value)) {
const base::DictionaryValue* dict; const base::DictionaryValue* dict;
if (value->GetAsDictionary(&dict)) if (value->GetAsDictionary(&dict))
return *dict; return dict;
} }
return empty_dictionary_; return nullptr;
} }
void SetServerProperties(const base::DictionaryValue& value) override { void SetServerProperties(const base::DictionaryValue& value) override {
return pref_store_->SetValue(path_, value.CreateDeepCopy(), return pref_store_->SetValue(path_, value.CreateDeepCopy(),
...@@ -47,9 +44,6 @@ class PrefServiceAdapter ...@@ -47,9 +44,6 @@ class PrefServiceAdapter
void StartListeningForUpdates(const base::Closure& callback) override { void StartListeningForUpdates(const base::Closure& callback) override {
on_changed_callback_ = callback; on_changed_callback_ = callback;
} }
void StopListeningForUpdates() override {
on_changed_callback_ = base::Closure();
}
// PrefStore::Observer implementation. // PrefStore::Observer implementation.
void OnPrefValueChanged(const std::string& key) override { void OnPrefValueChanged(const std::string& key) override {
...@@ -57,7 +51,7 @@ class PrefServiceAdapter ...@@ -57,7 +51,7 @@ class PrefServiceAdapter
on_changed_callback_.Run(); on_changed_callback_.Run();
} }
void OnInitializationCompleted(bool succeeded) override { void OnInitializationCompleted(bool succeeded) override {
if (succeeded && on_changed_callback_ && HasServerProperties()) if (succeeded && on_changed_callback_)
on_changed_callback_.Run(); on_changed_callback_.Run();
} }
...@@ -65,10 +59,6 @@ class PrefServiceAdapter ...@@ -65,10 +59,6 @@ class PrefServiceAdapter
scoped_refptr<WriteablePrefStore> pref_store_; scoped_refptr<WriteablePrefStore> pref_store_;
const std::string path_; const std::string path_;
// Returned when the pref is not set. Since the method returns a const
// net::DictionaryValue&, can't just create one on the stack.
base::DictionaryValue empty_dictionary_;
base::Closure on_changed_callback_; base::Closure on_changed_callback_;
DISALLOW_COPY_AND_ASSIGN(PrefServiceAdapter); DISALLOW_COPY_AND_ASSIGN(PrefServiceAdapter);
...@@ -77,13 +67,11 @@ class PrefServiceAdapter ...@@ -77,13 +67,11 @@ class PrefServiceAdapter
} // namespace } // namespace
// static // static
net::HttpServerPropertiesManager* std::unique_ptr<net::HttpServerPropertiesManager>
HttpServerPropertiesManagerFactory::CreateManager( HttpServerPropertiesManagerFactory::CreateManager(
scoped_refptr<WriteablePrefStore> pref_store, scoped_refptr<WriteablePrefStore> pref_store,
net::NetLog* net_log) { net::NetLog* net_log) {
DCHECK_CURRENTLY_ON(web::WebThread::IO); DCHECK_CURRENTLY_ON(web::WebThread::IO);
return new net::HttpServerPropertiesManager( return std::make_unique<net::HttpServerPropertiesManager>(
new PrefServiceAdapter(std::move(pref_store)), std::make_unique<PrefServiceAdapter>(std::move(pref_store)), net_log);
web::WebThread::GetTaskRunnerForThread(web::WebThread::IO),
web::WebThread::GetTaskRunnerForThread(web::WebThread::IO), net_log);
} }
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#ifndef IOS_CHROME_BROWSER_NET_HTTP_SERVER_PROPERTIES_MANAGER_FACTORY_H_ #ifndef IOS_CHROME_BROWSER_NET_HTTP_SERVER_PROPERTIES_MANAGER_FACTORY_H_
#define IOS_CHROME_BROWSER_NET_HTTP_SERVER_PROPERTIES_MANAGER_FACTORY_H_ #define IOS_CHROME_BROWSER_NET_HTTP_SERVER_PROPERTIES_MANAGER_FACTORY_H_
#include <memory>
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "components/prefs/writeable_pref_store.h" #include "components/prefs/writeable_pref_store.h"
...@@ -18,7 +20,7 @@ class NetLog; ...@@ -18,7 +20,7 @@ class NetLog;
class HttpServerPropertiesManagerFactory { class HttpServerPropertiesManagerFactory {
public: public:
// Create an instance of HttpServerPropertiesManager. // Create an instance of HttpServerPropertiesManager.
static net::HttpServerPropertiesManager* CreateManager( static std::unique_ptr<net::HttpServerPropertiesManager> CreateManager(
scoped_refptr<WriteablePrefStore> pref_store, scoped_refptr<WriteablePrefStore> pref_store,
net::NetLog* net_log); net::NetLog* net_log);
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment