Skip to content

Commit

Permalink
Rewrite scoped_ptr<T>(NULL) to use the default ctor in net/.
Browse files Browse the repository at this point in the history
This is the result of running the rewrite_scoped_ptr_ctor_null tool
across all files built on Linux in the net/ directory.

BUG=173286

Review URL: https://chromiumcodereview.appspot.com/16434016

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205961 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
dcheng@chromium.org committed Jun 12, 2013
1 parent bde236e commit dd946bb
Show file tree
Hide file tree
Showing 22 changed files with 36 additions and 68 deletions.
4 changes: 1 addition & 3 deletions net/base/filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,7 @@ Filter::Filter()
stream_buffer_size_(0),
next_stream_data_(NULL),
stream_data_len_(0),
next_filter_(NULL),
last_status_(FILTER_NEED_MORE_DATA) {
}
last_status_(FILTER_NEED_MORE_DATA) {}

Filter::FilterStatus Filter::CopyOut(char* dest_buffer, int* dest_len) {
int out_len;
Expand Down
1 change: 0 additions & 1 deletion net/base/sdch_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ namespace net {
SdchFilter::SdchFilter(const FilterContext& filter_context)
: filter_context_(filter_context),
decoding_status_(DECODING_UNINITIALIZED),
vcdiff_streaming_decoder_(NULL),
dictionary_hash_(),
dictionary_hash_is_plausible_(false),
dictionary_(NULL),
Expand Down
12 changes: 6 additions & 6 deletions net/disk_cache/simple/simple_index_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ scoped_ptr<SimpleIndex::EntrySet> SimpleIndexFile::LoadFromDisk(
std::string contents;
if(!file_util::ReadFileToString(index_filename, &contents)) {
LOG(WARNING) << "Could not read Simple Index file.";
return scoped_ptr<SimpleIndex::EntrySet>(NULL);
return scoped_ptr<SimpleIndex::EntrySet>();
}

return SimpleIndexFile::Deserialize(contents.data(), contents.size());
Expand All @@ -186,7 +186,7 @@ scoped_ptr<SimpleIndex::EntrySet> SimpleIndexFile::Deserialize(const char* data,
Pickle pickle(data, data_len);
if (!pickle.data()) {
LOG(WARNING) << "Corrupt Simple Index File.";
return scoped_ptr<SimpleIndex::EntrySet>(NULL);
return scoped_ptr<SimpleIndex::EntrySet>();
}

PickleIterator pickle_it(pickle);
Expand All @@ -198,18 +198,18 @@ scoped_ptr<SimpleIndex::EntrySet> SimpleIndexFile::Deserialize(const char* data,

if (crc_read != crc_calculated) {
LOG(WARNING) << "Invalid CRC in Simple Index file.";
return scoped_ptr<SimpleIndex::EntrySet>(NULL);
return scoped_ptr<SimpleIndex::EntrySet>();
}

SimpleIndexFile::IndexMetadata index_metadata;
if (!index_metadata.Deserialize(&pickle_it)) {
LOG(ERROR) << "Invalid index_metadata on Simple Cache Index.";
return scoped_ptr<SimpleIndex::EntrySet>(NULL);
return scoped_ptr<SimpleIndex::EntrySet>();
}

if (!index_metadata.CheckIndexMetadata()) {
LOG(ERROR) << "Invalid index_metadata on Simple Cache Index.";
return scoped_ptr<SimpleIndex::EntrySet>(NULL);
return scoped_ptr<SimpleIndex::EntrySet>();
}

scoped_ptr<SimpleIndex::EntrySet> index_file_entries(
Expand All @@ -220,7 +220,7 @@ scoped_ptr<SimpleIndex::EntrySet> SimpleIndexFile::Deserialize(const char* data,
if (!pickle_it.ReadUInt64(&hash_key) ||
!entry_metadata.Deserialize(&pickle_it)) {
LOG(WARNING) << "Invalid EntryMetadata in Simple Index file.";
return scoped_ptr<SimpleIndex::EntrySet>(NULL);
return scoped_ptr<SimpleIndex::EntrySet>();
}
SimpleIndex::InsertInEntrySet(
hash_key, entry_metadata, index_file_entries.get());
Expand Down
3 changes: 2 additions & 1 deletion net/dns/dns_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ scoped_ptr<DnsSession::SocketLease> DnsSession::AllocateSocket(
scoped_ptr<DatagramClientSocket> socket;

socket = socket_pool_->AllocateSocket(server_index);
if (!socket.get()) return scoped_ptr<SocketLease>(NULL);
if (!socket.get())
return scoped_ptr<SocketLease>();

socket->NetLog().BeginEvent(NetLog::TYPE_SOCKET_IN_USE,
source.ToEventParametersCallback());
Expand Down
2 changes: 1 addition & 1 deletion net/dns/dns_socket_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ scoped_ptr<DatagramClientSocket> DefaultDnsSocketPool::AllocateSocket(
FillPool(server_index, kAllocateMinSize);
if (pool.size() == 0) {
LOG(WARNING) << "No DNS sockets available in pool " << server_index << "!";
return scoped_ptr<DatagramClientSocket>(NULL);
return scoped_ptr<DatagramClientSocket>();
}

if (pool.size() < kAllocateMinSize) {
Expand Down
2 changes: 1 addition & 1 deletion net/dns/dns_transaction_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ class TransactionHelper {

class DnsTransactionTest : public testing::Test {
public:
DnsTransactionTest() : socket_factory_(NULL) {}
DnsTransactionTest() {}

// Generates |nameservers| for DnsConfig.
void ConfigureNumServers(unsigned num_servers) {
Expand Down
4 changes: 1 addition & 3 deletions net/ftp/ftp_network_transaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ FtpNetworkTransaction::FtpNetworkTransaction(
request_(NULL),
resolver_(session->host_resolver()),
read_ctrl_buf_(new IOBuffer(kCtrlBufLen)),
ctrl_response_buffer_(NULL),
read_data_buf_len_(0),
last_error_(OK),
system_type_(SYSTEM_TYPE_UNKNOWN),
Expand All @@ -224,8 +223,7 @@ FtpNetworkTransaction::FtpNetworkTransaction(
data_connection_port_(0),
socket_factory_(socket_factory),
next_state_(STATE_NONE),
state_after_data_connect_complete_(STATE_CTRL_WRITE_SIZE) {
}
state_after_data_connect_complete_(STATE_CTRL_WRITE_SIZE) {}

FtpNetworkTransaction::~FtpNetworkTransaction() {
}
Expand Down
3 changes: 1 addition & 2 deletions net/http/http_auth_handler_negotiate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ HttpAuthHandlerNegotiate::Factory::Factory()
max_token_length_(0),
first_creation_(true),
#endif
is_unsupported_(false),
auth_library_(NULL) {
is_unsupported_(false) {
}

HttpAuthHandlerNegotiate::Factory::~Factory() {
Expand Down
5 changes: 2 additions & 3 deletions net/http/http_cache_transaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ HttpCache::Transaction::Transaction(
cache_(cache->AsWeakPtr()),
entry_(NULL),
new_entry_(NULL),
network_trans_(NULL),
new_response_(NULL),
mode_(NONE),
target_state_(STATE_NONE),
Expand All @@ -194,8 +193,8 @@ HttpCache::Transaction::Transaction(
effective_load_flags_(0),
write_len_(0),
weak_factory_(this),
io_callback_(base::Bind(
&Transaction::OnIOComplete, weak_factory_.GetWeakPtr())),
io_callback_(base::Bind(&Transaction::OnIOComplete,
weak_factory_.GetWeakPtr())),
transaction_pattern_(PATTERN_UNDEFINED),
defer_cache_sensitivity_delay_(false),
transaction_delegate_(transaction_delegate) {
Expand Down
5 changes: 1 addition & 4 deletions net/http/http_proxy_client_socket_pool_spdy2_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,13 @@ class HttpProxyClientSocketPoolSpdy2Test : public TestWithHttpParam {
session_(CreateNetworkSession()),
http_proxy_histograms_("HttpProxyUnitTest"),
spdy_util_(kProtoSPDY2),
ssl_data_(NULL),
data_(NULL),
pool_(kMaxSockets,
kMaxSocketsPerGroup,
&http_proxy_histograms_,
NULL,
&transport_socket_pool_,
&ssl_socket_pool_,
NULL) {
}
NULL) {}

virtual ~HttpProxyClientSocketPoolSpdy2Test() {
}
Expand Down
5 changes: 1 addition & 4 deletions net/http/http_proxy_client_socket_pool_spdy3_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,13 @@ class HttpProxyClientSocketPoolSpdy3Test : public TestWithHttpParam {
session_(CreateNetworkSession()),
http_proxy_histograms_("HttpProxyUnitTest"),
spdy_util_(kProtoSPDY3),
ssl_data_(NULL),
data_(NULL),
pool_(kMaxSockets,
kMaxSocketsPerGroup,
&http_proxy_histograms_,
NULL,
&transport_socket_pool_,
&ssl_socket_pool_,
NULL) {
}
NULL) {}

virtual ~HttpProxyClientSocketPoolSpdy3Test() {
}
Expand Down
1 change: 0 additions & 1 deletion net/http/http_stream_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ HttpStreamParser::HttpStreamParser(ClientSocketHandle* connection,
response_header_start_offset_(-1),
response_body_length_(-1),
response_body_read_(0),
chunked_decoder_(NULL),
user_read_buf_(NULL),
user_read_buf_len_(0),
connection_(connection),
Expand Down
4 changes: 1 addition & 3 deletions net/http/http_transaction_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,7 @@ int TestTransactionConsumer::quit_counter_ = 0;
TestTransactionConsumer::TestTransactionConsumer(
net::RequestPriority priority,
net::HttpTransactionFactory* factory)
: state_(IDLE),
trans_(NULL),
error_(net::OK) {
: state_(IDLE), error_(net::OK) {
// Disregard the error code.
factory->CreateTransaction(priority, &trans_, NULL);
++quit_counter_;
Expand Down
1 change: 0 additions & 1 deletion net/proxy/proxy_script_fetcher_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ ProxyScriptFetcherImpl::ProxyScriptFetcherImpl(
url_request_context_(url_request_context),
buf_(new IOBuffer(kBufSize)),
next_id_(0),
cur_request_(NULL),
cur_request_id_(0),
result_code_(OK),
result_text_(NULL),
Expand Down
6 changes: 2 additions & 4 deletions net/quic/quic_stream_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@ int QuicStreamFactory::Job::DoResolveHostComplete(int rv) {
}

QuicStreamRequest::QuicStreamRequest(QuicStreamFactory* factory)
: factory_(factory),
stream_(NULL){
}
: factory_(factory) {}

QuicStreamRequest::~QuicStreamRequest() {
if (factory_ && !callback_.is_null())
Expand Down Expand Up @@ -299,7 +297,7 @@ scoped_ptr<QuicHttpStream> QuicStreamFactory::CreateIfSessionExists(
const HostPortProxyPair& host_port_proxy_pair,
const BoundNetLog& net_log) {
if (!HasActiveSession(host_port_proxy_pair)) {
return scoped_ptr<QuicHttpStream>(NULL);
return scoped_ptr<QuicHttpStream>();
}

QuicClientSession* session = active_sessions_[host_port_proxy_pair];
Expand Down
1 change: 0 additions & 1 deletion net/socket/deterministic_socket_data_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class DeterministicSocketDataTest : public PlatformTest {

DeterministicSocketDataTest::DeterministicSocketDataTest()
: sock_(NULL),
data_(NULL),
read_buf_(NULL),
connect_data_(SYNCHRONOUS, OK),
endpoint_("www.google.com", 443),
Expand Down
7 changes: 1 addition & 6 deletions net/socket/tcp_listen_socket_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ static const char kLoopback[] = "127.0.0.1";
static const int kDefaultTimeoutMs = 5000;

TCPListenSocketTester::TCPListenSocketTester()
: thread_(NULL),
loop_(NULL),
server_(NULL),
connection_(NULL),
cv_(&lock_) {
}
: loop_(NULL), server_(NULL), connection_(NULL), cv_(&lock_) {}

void TCPListenSocketTester::SetUp() {
base::Thread::Options options;
Expand Down
5 changes: 2 additions & 3 deletions net/spdy/spdy_proxy_client_socket_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ INSTANTIATE_TEST_CASE_P(NextProto,

SpdyProxyClientSocketTest::SpdyProxyClientSocketTest()
: spdy_util_(GetParam()),
sock_(NULL),
data_(NULL),
session_(NULL),
read_buf_(NULL),
session_deps_(GetParam()),
Expand All @@ -153,7 +151,8 @@ SpdyProxyClientSocketTest::SpdyProxyClientSocketTest()
proxy_host_port_(kProxyHost, kProxyPort),
endpoint_host_port_pair_(kOriginHost, kOriginPort),
proxy_(ProxyServer::SCHEME_HTTPS, proxy_host_port_),
endpoint_spdy_session_key_(endpoint_host_port_pair_, proxy_,
endpoint_spdy_session_key_(endpoint_host_port_pair_,
proxy_,
kPrivacyModeDisabled),
transport_params_(new TransportSocketParams(proxy_host_port_,
LOWEST,
Expand Down
2 changes: 1 addition & 1 deletion net/test/embedded_test_server/embedded_test_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ scoped_ptr<HttpResponse> HandleFileRequest(
std::string file_contents;
if (!file_util::ReadFileToString(
server_root.AppendASCII(request_path), &file_contents)) {
return scoped_ptr<HttpResponse>(NULL);
return scoped_ptr<HttpResponse>();
}

scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse);
Expand Down
4 changes: 1 addition & 3 deletions net/url_request/url_fetcher_core.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ URLFetcherCore::URLFetcherCore(URLFetcher* fetcher,
original_url_(original_url),
request_type_(request_type),
delegate_(d),
delegate_task_runner_(
base::ThreadTaskRunnerHandle::Get()),
request_(NULL),
delegate_task_runner_(base::ThreadTaskRunnerHandle::Get()),
load_flags_(LOAD_NORMAL),
response_code_(URLFetcher::RESPONSE_CODE_INVALID),
buffer_(new IOBuffer(kBufferSize)),
Expand Down
5 changes: 1 addition & 4 deletions net/url_request/url_fetcher_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,7 @@ class ThrottlingTestURLRequestContextGetter
class URLFetcherTest : public testing::Test,
public URLFetcherDelegate {
public:
URLFetcherTest()
: fetcher_(NULL),
context_(NULL) {
}
URLFetcherTest() : fetcher_(NULL) {}

static int GetNumFetcherCores() {
return URLFetcherImpl::GetNumFetcherCores();
Expand Down
22 changes: 10 additions & 12 deletions net/url_request/url_request_http_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ URLRequestJob* URLRequestHttpJob::Factory(URLRequest* request,
request->context()->http_user_agent_settings());
}


URLRequestHttpJob::URLRequestHttpJob(
URLRequest* request,
NetworkDelegate* network_delegate,
Expand All @@ -233,13 +232,12 @@ URLRequestHttpJob::URLRequestHttpJob(
response_cookies_save_index_(0),
proxy_auth_state_(AUTH_STATE_DONT_NEED_AUTH),
server_auth_state_(AUTH_STATE_DONT_NEED_AUTH),
start_callback_(base::Bind(
&URLRequestHttpJob::OnStartCompleted, base::Unretained(this))),
notify_before_headers_sent_callback_(base::Bind(
&URLRequestHttpJob::NotifyBeforeSendHeadersCallback,
base::Unretained(this))),
start_callback_(base::Bind(&URLRequestHttpJob::OnStartCompleted,
base::Unretained(this))),
notify_before_headers_sent_callback_(
base::Bind(&URLRequestHttpJob::NotifyBeforeSendHeadersCallback,
base::Unretained(this))),
read_in_progress_(false),
transaction_(NULL),
throttling_entry_(NULL),
sdch_dictionary_advertised_(false),
sdch_test_activated_(false),
Expand All @@ -253,12 +251,12 @@ URLRequestHttpJob::URLRequestHttpJob(
final_packet_time_(),
filter_context_(new HttpFilterContext(this)),
weak_factory_(this),
on_headers_received_callback_(base::Bind(
&URLRequestHttpJob::OnHeadersReceivedCallback,
base::Unretained(this))),
on_headers_received_callback_(
base::Bind(&URLRequestHttpJob::OnHeadersReceivedCallback,
base::Unretained(this))),
awaiting_callback_(false),
http_transaction_delegate_(new HttpTransactionDelegateImpl(
request, network_delegate)),
http_transaction_delegate_(
new HttpTransactionDelegateImpl(request, network_delegate)),
http_user_agent_settings_(http_user_agent_settings) {
URLRequestThrottlerManager* manager = request->context()->throttler_manager();
if (manager)
Expand Down

0 comments on commit dd946bb

Please sign in to comment.