Refactoring: use C++11 class member variable initialization
This commit is contained in:
parent
ee57c95aa6
commit
2337237d58
94 changed files with 218 additions and 377 deletions
|
@ -32,20 +32,9 @@
|
|||
|
||||
namespace asar {
|
||||
|
||||
URLRequestAsarJob::FileMetaInfo::FileMetaInfo()
|
||||
: file_size(0),
|
||||
mime_type_result(false),
|
||||
file_exists(false),
|
||||
is_directory(false) {}
|
||||
|
||||
URLRequestAsarJob::URLRequestAsarJob(net::URLRequest* request,
|
||||
net::NetworkDelegate* network_delegate)
|
||||
: net::URLRequestJob(request, network_delegate),
|
||||
type_(TYPE_ERROR),
|
||||
remaining_bytes_(0),
|
||||
seek_offset_(0),
|
||||
range_parse_result_(net::OK),
|
||||
weak_ptr_factory_(this) {}
|
||||
: net::URLRequestJob(request, network_delegate), weak_ptr_factory_(this) {}
|
||||
|
||||
URLRequestAsarJob::~URLRequestAsarJob() {}
|
||||
|
||||
|
|
|
@ -74,19 +74,17 @@ class URLRequestAsarJob : public net::URLRequestJob {
|
|||
// URLRequestFileJob and also passed between threads because disk access is
|
||||
// necessary to obtain it.
|
||||
struct FileMetaInfo {
|
||||
FileMetaInfo();
|
||||
|
||||
// Size of the file.
|
||||
int64_t file_size;
|
||||
int64_t file_size = 0;
|
||||
// Mime type associated with the file.
|
||||
std::string mime_type;
|
||||
// Result returned from GetMimeTypeFromFile(), i.e. flag showing whether
|
||||
// obtaining of the mime type was successful.
|
||||
bool mime_type_result;
|
||||
bool mime_type_result = false;
|
||||
// Flag showing whether the file exists.
|
||||
bool file_exists;
|
||||
bool file_exists = false;
|
||||
// Flag showing whether the file name actually refers to a directory.
|
||||
bool is_directory;
|
||||
bool is_directory = false;
|
||||
// Path to the file.
|
||||
base::FilePath file_path;
|
||||
};
|
||||
|
@ -109,7 +107,7 @@ class URLRequestAsarJob : public net::URLRequestJob {
|
|||
// Callback after data is asynchronously read from the file into |buf|.
|
||||
void DidRead(scoped_refptr<net::IOBuffer> buf, int result);
|
||||
|
||||
JobType type_;
|
||||
JobType type_ = TYPE_ERROR;
|
||||
|
||||
std::shared_ptr<Archive> archive_;
|
||||
base::FilePath file_path_;
|
||||
|
@ -120,10 +118,10 @@ class URLRequestAsarJob : public net::URLRequestJob {
|
|||
scoped_refptr<base::TaskRunner> file_task_runner_;
|
||||
|
||||
net::HttpByteRange byte_range_;
|
||||
int64_t remaining_bytes_;
|
||||
int64_t seek_offset_;
|
||||
int64_t remaining_bytes_ = 0;
|
||||
int64_t seek_offset_ = 0;
|
||||
|
||||
net::Error range_parse_result_;
|
||||
net::Error range_parse_result_ = net::OK;
|
||||
|
||||
base::WeakPtrFactory<URLRequestAsarJob> weak_ptr_factory_;
|
||||
|
||||
|
|
|
@ -48,9 +48,6 @@ class CertVerifierRequest : public AtomCertVerifier::Request {
|
|||
AtomCertVerifier* cert_verifier)
|
||||
: params_(params),
|
||||
cert_verifier_(cert_verifier),
|
||||
error_(net::ERR_IO_PENDING),
|
||||
custom_response_(net::ERR_IO_PENDING),
|
||||
first_response_(true),
|
||||
weak_ptr_factory_(this) {}
|
||||
|
||||
~CertVerifierRequest() override {
|
||||
|
@ -142,9 +139,9 @@ class CertVerifierRequest : public AtomCertVerifier::Request {
|
|||
|
||||
const AtomCertVerifier::RequestParams params_;
|
||||
AtomCertVerifier* cert_verifier_;
|
||||
int error_;
|
||||
int custom_response_;
|
||||
bool first_response_;
|
||||
int error_ = net::ERR_IO_PENDING;
|
||||
int custom_response_ = net::ERR_IO_PENDING;
|
||||
bool first_response_ = true;
|
||||
ResponseList response_list_;
|
||||
net::CertVerifyResult result_;
|
||||
std::unique_ptr<AtomCertVerifier::Request> default_verifier_request_;
|
||||
|
|
|
@ -48,7 +48,6 @@ class UploadOwnedIOBufferElementReader : public net::UploadBytesElementReader {
|
|||
|
||||
AtomURLRequest::AtomURLRequest(api::URLRequest* delegate)
|
||||
: delegate_(delegate),
|
||||
is_chunked_upload_(false),
|
||||
response_read_buffer_(new net::IOBuffer(kBufferSize)) {}
|
||||
|
||||
AtomURLRequest::~AtomURLRequest() {
|
||||
|
|
|
@ -103,7 +103,7 @@ class AtomURLRequest : public base::RefCountedThreadSafe<AtomURLRequest>,
|
|||
std::unique_ptr<net::URLRequest> request_;
|
||||
scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
|
||||
|
||||
bool is_chunked_upload_;
|
||||
bool is_chunked_upload_ = false;
|
||||
std::string redirect_policy_;
|
||||
std::unique_ptr<net::ChunkedUploadDataStream> chunked_stream_;
|
||||
std::unique_ptr<net::ChunkedUploadDataStream::Writer> chunked_stream_writer_;
|
||||
|
|
|
@ -46,8 +46,7 @@ net::URLFetcher::RequestType GetRequestType(const std::string& raw) {
|
|||
// Pipe the response writer back to URLRequestFetchJob.
|
||||
class ResponsePiper : public net::URLFetcherResponseWriter {
|
||||
public:
|
||||
explicit ResponsePiper(URLRequestFetchJob* job)
|
||||
: first_write_(true), job_(job) {}
|
||||
explicit ResponsePiper(URLRequestFetchJob* job) : job_(job) {}
|
||||
|
||||
// net::URLFetcherResponseWriter:
|
||||
int Initialize(const net::CompletionCallback& callback) override {
|
||||
|
@ -69,7 +68,7 @@ class ResponsePiper : public net::URLFetcherResponseWriter {
|
|||
}
|
||||
|
||||
private:
|
||||
bool first_write_;
|
||||
bool first_write_ = true;
|
||||
URLRequestFetchJob* job_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ResponsePiper);
|
||||
|
@ -79,9 +78,7 @@ class ResponsePiper : public net::URLFetcherResponseWriter {
|
|||
|
||||
URLRequestFetchJob::URLRequestFetchJob(net::URLRequest* request,
|
||||
net::NetworkDelegate* network_delegate)
|
||||
: JsAsker<net::URLRequestJob>(request, network_delegate),
|
||||
pending_buffer_size_(0),
|
||||
write_num_bytes_(0) {}
|
||||
: JsAsker<net::URLRequestJob>(request, network_delegate) {}
|
||||
|
||||
URLRequestFetchJob::~URLRequestFetchJob() = default;
|
||||
|
||||
|
|
|
@ -57,11 +57,11 @@ class URLRequestFetchJob : public JsAsker<net::URLRequestJob>,
|
|||
|
||||
// Saved arguments passed to ReadRawData.
|
||||
scoped_refptr<net::IOBuffer> pending_buffer_;
|
||||
int pending_buffer_size_;
|
||||
int pending_buffer_size_ = 0;
|
||||
|
||||
// Saved arguments passed to DataAvailable.
|
||||
scoped_refptr<net::IOBuffer> write_buffer_;
|
||||
int write_num_bytes_;
|
||||
int write_num_bytes_ = 0;
|
||||
net::CompletionCallback write_callback_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(URLRequestFetchJob);
|
||||
|
|
|
@ -21,11 +21,6 @@ namespace atom {
|
|||
URLRequestStreamJob::URLRequestStreamJob(net::URLRequest* request,
|
||||
net::NetworkDelegate* network_delegate)
|
||||
: JsAsker<net::URLRequestJob>(request, network_delegate),
|
||||
ended_(false),
|
||||
errored_(false),
|
||||
pending_io_buf_(nullptr),
|
||||
pending_io_buf_size_(0),
|
||||
response_headers_(nullptr),
|
||||
weak_factory_(this) {}
|
||||
|
||||
URLRequestStreamJob::~URLRequestStreamJob() = default;
|
||||
|
|
|
@ -52,10 +52,10 @@ class URLRequestStreamJob : public JsAsker<net::URLRequestJob> {
|
|||
void CopyMoreDataDone(scoped_refptr<net::IOBuffer> io_buf, int read_count);
|
||||
|
||||
std::deque<char> buffer_;
|
||||
bool ended_;
|
||||
bool errored_;
|
||||
bool ended_ = false;
|
||||
bool errored_ = false;
|
||||
scoped_refptr<net::IOBuffer> pending_io_buf_;
|
||||
int pending_io_buf_size_;
|
||||
int pending_io_buf_size_ = 0;
|
||||
scoped_refptr<net::HttpResponseHeaders> response_headers_;
|
||||
mate::EventSubscriber<URLRequestStreamJob>::SafePtr subscriber_;
|
||||
base::WeakPtrFactory<URLRequestStreamJob> weak_factory_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue