refactor: use C++11 class member variable initialization (#27477)

This commit is contained in:
Milan Burda
2021-01-26 19:16:21 +01:00
committed by GitHub
parent f083380c38
commit ddf3ef0a5f
93 changed files with 130 additions and 163 deletions

View File

@@ -21,8 +21,7 @@ NodeStreamLoader::NodeStreamLoader(
: binding_(this, std::move(loader)),
client_(std::move(client)),
isolate_(isolate),
emitter_(isolate, emitter),
weak_factory_(this) {
emitter_(isolate, emitter) {
binding_.set_connection_error_handler(
base::BindOnce(&NodeStreamLoader::NotifyComplete,
weak_factory_.GetWeakPtr(), net::ERR_FAILED));

View File

@@ -95,7 +95,7 @@ class NodeStreamLoader : public network::mojom::URLLoader {
// Store the V8 callbacks to unsubscribe them later.
std::map<std::string, v8::Global<v8::Value>> handlers_;
base::WeakPtrFactory<NodeStreamLoader> weak_factory_;
base::WeakPtrFactory<NodeStreamLoader> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(NodeStreamLoader);
};

View File

@@ -19,9 +19,7 @@ URLPipeLoader::URLPipeLoader(
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
const net::NetworkTrafficAnnotationTag& annotation,
base::DictionaryValue upload_data)
: binding_(this, std::move(loader)),
client_(std::move(client)),
weak_factory_(this) {
: binding_(this, std::move(loader)), client_(std::move(client)) {
binding_.set_connection_error_handler(base::BindOnce(
&URLPipeLoader::NotifyComplete, base::Unretained(this), net::ERR_FAILED));

View File

@@ -75,7 +75,7 @@ class URLPipeLoader : public network::mojom::URLLoader,
std::unique_ptr<mojo::DataPipeProducer> producer_;
std::unique_ptr<network::SimpleURLLoader> loader_;
base::WeakPtrFactory<URLPipeLoader> weak_factory_;
base::WeakPtrFactory<URLPipeLoader> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(URLPipeLoader);
};