diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-02 20:15:57 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-02 20:15:57 +0000 |
commit | 00cd9c4e71d1e6dd6cc3a2fff60505479304c9d1 (patch) | |
tree | eb61d6402a5e967e5eb1d41dfde730af48dfa55f /net | |
parent | d9b888cdf9ad654a3f2e5c22b935e68db77a71ef (diff) | |
download | chromium_src-00cd9c4e71d1e6dd6cc3a2fff60505479304c9d1.zip chromium_src-00cd9c4e71d1e6dd6cc3a2fff60505479304c9d1.tar.gz chromium_src-00cd9c4e71d1e6dd6cc3a2fff60505479304c9d1.tar.bz2 |
Convert implicit scoped_refptr constructor calls to explicit ones, part 2
This CL was created automatically by this clang rewriter: http://codereview.appspot.com/2826041
I then did quite a bit of manual editing to fix style issues.
BUG=28083
TEST=None
Review URL: http://codereview.chromium.org/4291001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64798 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
26 files changed, 204 insertions, 157 deletions
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc index ea1788e..e9e137f 100644 --- a/net/base/host_resolver_impl.cc +++ b/net/base/host_resolver_impl.cc @@ -356,9 +356,10 @@ class HostResolverImpl::Job had_non_speculative_request_(false), net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_HOST_RESOLVER_IMPL_JOB)) { - net_log_.BeginEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_JOB, - new JobCreationParameters(key.hostname, - source_net_log.source())); + net_log_.BeginEvent( + NetLog::TYPE_HOST_RESOLVER_IMPL_JOB, + make_scoped_refptr( + new JobCreationParameters(key.hostname, source_net_log.source()))); } // Attaches a request to this job. The job takes ownership of |req| and will @@ -366,7 +367,8 @@ class HostResolverImpl::Job void AddRequest(Request* req) { req->request_net_log().BeginEvent( NetLog::TYPE_HOST_RESOLVER_IMPL_JOB_ATTACH, - new NetLogSourceParameter("source_dependency", net_log_.source())); + make_scoped_refptr(new NetLogSourceParameter( + "source_dependency", net_log_.source()))); req->set_job(this); requests_.push_back(req); @@ -1238,11 +1240,13 @@ void HostResolverImpl::OnStartRequest(const BoundNetLog& source_net_log, const RequestInfo& info) { source_net_log.BeginEvent( NetLog::TYPE_HOST_RESOLVER_IMPL, - new NetLogSourceParameter("source_dependency", request_net_log.source())); + make_scoped_refptr(new NetLogSourceParameter( + "source_dependency", request_net_log.source()))); request_net_log.BeginEvent( NetLog::TYPE_HOST_RESOLVER_IMPL_REQUEST, - new RequestInfoParameters(info, source_net_log.source())); + make_scoped_refptr(new RequestInfoParameters( + info, source_net_log.source()))); // Notify the observers of the start. if (!observers_.empty()) { diff --git a/net/disk_cache/file_posix.cc b/net/disk_cache/file_posix.cc index bade848..a8d74ae 100644 --- a/net/disk_cache/file_posix.cc +++ b/net/disk_cache/file_posix.cc @@ -184,7 +184,7 @@ void InFlightIO::PostRead(disk_cache::File *file, void* buf, size_t buf_len, size_t offset, disk_cache::FileIOCallback *callback) { scoped_refptr<BackgroundIO> operation( new BackgroundIO(file, buf, buf_len, offset, callback, this)); - io_list_.insert(operation.get()); + io_list_.insert(operation); file->AddRef(); // Balanced on InvokeCallback() if (!callback_thread_) @@ -200,7 +200,7 @@ void InFlightIO::PostWrite(disk_cache::File* file, const void* buf, disk_cache::FileIOCallback* callback) { scoped_refptr<BackgroundIO> operation( new BackgroundIO(file, buf, buf_len, offset, callback, this)); - io_list_.insert(operation.get()); + io_list_.insert(operation); file->AddRef(); // Balanced on InvokeCallback() if (!callback_thread_) @@ -241,7 +241,7 @@ void InFlightIO::InvokeCallback(BackgroundIO* operation, bool cancel_task) { // Release the references acquired in PostRead / PostWrite. operation->file()->Release(); - io_list_.erase(operation); + io_list_.erase(make_scoped_refptr(operation)); callback->OnFileIOComplete(bytes); } diff --git a/net/disk_cache/in_flight_backend_io.cc b/net/disk_cache/in_flight_backend_io.cc index 8fafa4d..c4caed3 100644 --- a/net/disk_cache/in_flight_backend_io.cc +++ b/net/disk_cache/in_flight_backend_io.cc @@ -513,7 +513,7 @@ void InFlightBackendIO::QueueOperationToList(BackendIO* operation, if (list->empty()) return PostOperation(operation); - list->push_back(operation); + list->push_back(make_scoped_refptr(operation)); } } // namespace diff --git a/net/disk_cache/in_flight_io.cc b/net/disk_cache/in_flight_io.cc index 5c859af..ba24d61 100644 --- a/net/disk_cache/in_flight_io.cc +++ b/net/disk_cache/in_flight_io.cc @@ -74,14 +74,14 @@ void InFlightIO::InvokeCallback(BackgroundIO* operation, bool cancel_task) { // Make sure that we remove the operation from the list before invoking the // callback (so that a subsequent cancel does not invoke the callback again). DCHECK(io_list_.find(operation) != io_list_.end()); - io_list_.erase(operation); + io_list_.erase(make_scoped_refptr(operation)); OnOperationComplete(operation, cancel_task); } // Runs on the primary thread. void InFlightIO::OnOperationPosted(BackgroundIO* operation) { DCHECK(callback_thread_->BelongsToCurrentThread()); - io_list_.insert(operation); + io_list_.insert(make_scoped_refptr(operation)); } } // namespace disk_cache diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index 16d9171..de9529e 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -638,8 +638,8 @@ int HttpNetworkTransaction::DoSendRequest() { if (net_log_.IsLoggingAllEvents()) { net_log_.AddEvent( NetLog::TYPE_HTTP_TRANSACTION_SEND_REQUEST_HEADERS, - new NetLogHttpRequestParameter(request_->url.spec(), - request_->extra_headers)); + make_scoped_refptr(new NetLogHttpRequestParameter( + request_->url.spec(), request_->extra_headers))); } headers_valid_ = false; @@ -732,7 +732,7 @@ int HttpNetworkTransaction::DoReadHeadersComplete(int result) { if (net_log_.IsLoggingAllEvents()) { net_log_.AddEvent( NetLog::TYPE_HTTP_TRANSACTION_READ_RESPONSE_HEADERS, - new NetLogHttpResponseParameter(response_.headers)); + make_scoped_refptr(new NetLogHttpResponseParameter(response_.headers))); } if (response_.headers->GetParsedHttpVersion() < HttpVersion(1, 0)) { diff --git a/net/http/http_proxy_client_socket.cc b/net/http/http_proxy_client_socket.cc index 8c1548c..186b459 100644 --- a/net/http/http_proxy_client_socket.cc +++ b/net/http/http_proxy_client_socket.cc @@ -343,8 +343,8 @@ int HttpProxyClientSocket::DoSendRequest() { if (net_log_.IsLoggingAllEvents()) { net_log_.AddEvent( NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, - new NetLogHttpRequestParameter( - request_line, request_headers)); + make_scoped_refptr(new NetLogHttpRequestParameter( + request_line, request_headers))); } request_headers_ = request_line + request_headers.ToString(); } @@ -381,7 +381,7 @@ int HttpProxyClientSocket::DoReadHeadersComplete(int result) { if (net_log_.IsLoggingAllEvents()) { net_log_.AddEvent( NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, - new NetLogHttpResponseParameter(response_.headers)); + make_scoped_refptr(new NetLogHttpResponseParameter(response_.headers))); } switch (response_.headers->response_code()) { diff --git a/net/proxy/init_proxy_resolver.cc b/net/proxy/init_proxy_resolver.cc index 368fcf0..4bf250e 100644 --- a/net/proxy/init_proxy_resolver.cc +++ b/net/proxy/init_proxy_resolver.cc @@ -169,8 +169,8 @@ int InitProxyResolver::DoFetchPacScript() { net_log_.BeginEvent( NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT, - new NetLogStringParameter("url", - effective_pac_url.possibly_invalid_spec())); + make_scoped_refptr(new NetLogStringParameter( + "url", effective_pac_url.possibly_invalid_spec()))); if (!proxy_script_fetcher_) { net_log_.AddEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_HAS_NO_FETCHER, NULL); @@ -190,7 +190,7 @@ int InitProxyResolver::DoFetchPacScriptComplete(int result) { } else { net_log_.EndEvent( NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT, - new NetLogIntegerParameter("net_error", result)); + make_scoped_refptr(new NetLogIntegerParameter("net_error", result))); return TryToFallbackPacUrl(result); } @@ -222,7 +222,7 @@ int InitProxyResolver::DoSetPacScriptComplete(int result) { if (result != OK) { net_log_.EndEvent( NetLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT, - new NetLogIntegerParameter("net_error", result)); + make_scoped_refptr(new NetLogIntegerParameter("net_error", result))); return TryToFallbackPacUrl(result); } diff --git a/net/proxy/multi_threaded_proxy_resolver.cc b/net/proxy/multi_threaded_proxy_resolver.cc index 22fe5e4..d696438a1 100644 --- a/net/proxy/multi_threaded_proxy_resolver.cc +++ b/net/proxy/multi_threaded_proxy_resolver.cc @@ -247,8 +247,8 @@ class MultiThreadedProxyResolver::GetProxyForURLJob net_log_.AddEvent( NetLog::TYPE_SUBMITTED_TO_RESOLVER_THREAD, - new NetLogIntegerParameter( - "thread_number", executor()->thread_number())); + make_scoped_refptr(new NetLogIntegerParameter( + "thread_number", executor()->thread_number()))); } // Runs on the worker thread. @@ -557,7 +557,7 @@ MultiThreadedProxyResolver::AddNewExecutor() { ProxyResolver* resolver = resolver_factory_->CreateProxyResolver(); Executor* executor = new Executor( this, resolver, thread_number); - executors_.push_back(executor); + executors_.push_back(make_scoped_refptr(executor)); return executor; } diff --git a/net/proxy/proxy_bypass_rules.cc b/net/proxy/proxy_bypass_rules.cc index 67b147a..d80e6f1 100644 --- a/net/proxy/proxy_bypass_rules.cc +++ b/net/proxy/proxy_bypass_rules.cc @@ -171,14 +171,14 @@ bool ProxyBypassRules::AddRuleForHostname(const std::string& optional_scheme, if (hostname_pattern.empty()) return false; - rules_.push_back(new HostnamePatternRule(optional_scheme, - hostname_pattern, - optional_port)); + rules_.push_back(make_scoped_refptr(new HostnamePatternRule(optional_scheme, + hostname_pattern, + optional_port))); return true; } void ProxyBypassRules::AddRuleToBypassLocal() { - rules_.push_back(new BypassLocalRule); + rules_.push_back(make_scoped_refptr(new BypassLocalRule)); } bool ProxyBypassRules::AddRuleFromString(const std::string& raw) { @@ -241,8 +241,8 @@ bool ProxyBypassRules::AddRuleFromStringInternal( if (!ParseCIDRBlock(raw, &ip_prefix, &prefix_length_in_bits)) return false; - rules_.push_back( - new BypassIPBlockRule(raw, scheme, ip_prefix, prefix_length_in_bits)); + rules_.push_back(make_scoped_refptr( + new BypassIPBlockRule(raw, scheme, ip_prefix, prefix_length_in_bits))); return true; } diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc index e28e325..beeab51 100644 --- a/net/proxy/proxy_service.cc +++ b/net/proxy/proxy_service.cc @@ -702,13 +702,15 @@ int ProxyService::DidFinishResolvingProxy(ProxyInfo* result, if (net_log.IsLoggingAllEvents()) { net_log.AddEvent( NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, - new NetLogStringParameter("pac_string", result->ToPacString())); + make_scoped_refptr(new NetLogStringParameter( + "pac_string", result->ToPacString()))); } result->DeprioritizeBadProxies(proxy_retry_info_); } else { net_log.AddEvent( NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, - new NetLogIntegerParameter("net_error", result_code)); + make_scoped_refptr(new NetLogIntegerParameter( + "net_error", result_code))); // Fall-back to direct when the proxy resolver fails. This corresponds // with a javascript runtime error in the PAC script. diff --git a/net/socket/client_socket_handle.cc b/net/socket/client_socket_handle.cc index 6184905..29b5bd3 100644 --- a/net/socket/client_socket_handle.cc +++ b/net/socket/client_socket_handle.cc @@ -116,7 +116,8 @@ void ClientSocketHandle::HandleInitCompletion(int result) { DCHECK(socket_.get()); socket_->NetLog().BeginEvent( NetLog::TYPE_SOCKET_IN_USE, - new NetLogSourceParameter("source_dependency", requesting_source_)); + make_scoped_refptr(new NetLogSourceParameter( + "source_dependency", requesting_source_))); } } // namespace net diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc index 75abae6d..2228729 100644 --- a/net/socket/client_socket_pool_base.cc +++ b/net/socket/client_socket_pool_base.cc @@ -87,9 +87,9 @@ void ConnectJob::UseForNormalRequest() { void ConnectJob::set_socket(ClientSocket* socket) { if (socket) { - net_log().AddEvent(NetLog::TYPE_CONNECT_JOB_SET_SOCKET, - new NetLogSourceParameter("source_dependency", - socket->NetLog().source())); + net_log().AddEvent(NetLog::TYPE_CONNECT_JOB_SET_SOCKET, make_scoped_refptr( + new NetLogSourceParameter("source_dependency", + socket->NetLog().source()))); } socket_.reset(socket); } @@ -110,7 +110,7 @@ void ConnectJob::ResetTimer(base::TimeDelta remaining_time) { void ConnectJob::LogConnectStart() { net_log().BeginEvent(NetLog::TYPE_SOCKET_POOL_CONNECT_JOB_CONNECT, - new NetLogStringParameter("group_name", group_name_)); + make_scoped_refptr(new NetLogStringParameter("group_name", group_name_))); } void ConnectJob::LogConnectCompletion(int net_error) { @@ -239,7 +239,8 @@ void ClientSocketPoolBaseHelper::RequestSockets( request.net_log().BeginEvent( NetLog::TYPE_SOCKET_POOL_CONNECTING_N_SOCKETS, - new NetLogIntegerParameter("num_sockets", num_sockets)); + make_scoped_refptr(new NetLogIntegerParameter( + "num_sockets", num_sockets))); Group* group = GetOrCreateGroup(group_name); @@ -394,7 +395,8 @@ void ClientSocketPoolBaseHelper::LogBoundConnectJobToRequest( const NetLog::Source& connect_job_source, const Request* request) { request->net_log().AddEvent( NetLog::TYPE_SOCKET_POOL_BOUND_TO_CONNECT_JOB, - new NetLogSourceParameter("source_dependency", connect_job_source)); + make_scoped_refptr(new NetLogSourceParameter( + "source_dependency", connect_job_source))); } void ClientSocketPoolBaseHelper::CancelRequest( @@ -763,8 +765,8 @@ void ClientSocketPoolBaseHelper::OnConnectJobComplete( HandOutSocket(socket.release(), false /* unused socket */, r->handle(), base::TimeDelta(), group, r->net_log()); } - r->net_log().EndEvent(NetLog::TYPE_SOCKET_POOL, - new NetLogIntegerParameter("net_error", result)); + r->net_log().EndEvent(NetLog::TYPE_SOCKET_POOL, make_scoped_refptr( + new NetLogIntegerParameter("net_error", result))); InvokeUserCallbackLater(r->handle(), r->callback(), result); } else { RemoveConnectJob(job, group); @@ -849,13 +851,13 @@ void ClientSocketPoolBaseHelper::HandOutSocket( if (reused) { net_log.AddEvent( NetLog::TYPE_SOCKET_POOL_REUSED_AN_EXISTING_SOCKET, - new NetLogIntegerParameter( - "idle_ms", static_cast<int>(idle_time.InMilliseconds()))); + make_scoped_refptr(new NetLogIntegerParameter( + "idle_ms", static_cast<int>(idle_time.InMilliseconds())))); } net_log.AddEvent(NetLog::TYPE_SOCKET_POOL_BOUND_TO_SOCKET, - new NetLogSourceParameter( - "source_dependency", socket->NetLog().source())); + make_scoped_refptr(new NetLogSourceParameter( + "source_dependency", socket->NetLog().source()))); handed_out_socket_count_++; group->IncrementActiveSocketCount(); diff --git a/net/socket/socks5_client_socket.cc b/net/socket/socks5_client_socket.cc index 6e28a490..f73b558 100644 --- a/net/socket/socks5_client_socket.cc +++ b/net/socket/socks5_client_socket.cc @@ -308,13 +308,15 @@ int SOCKS5ClientSocket::DoGreetReadComplete(int result) { // Got the greet data. if (buffer_[0] != kSOCKS5Version) { - net_log_.AddEvent(NetLog::TYPE_SOCKS_UNEXPECTED_VERSION, - new NetLogIntegerParameter("version", buffer_[0])); + net_log_.AddEvent( + NetLog::TYPE_SOCKS_UNEXPECTED_VERSION, + make_scoped_refptr(new NetLogIntegerParameter("version", buffer_[0]))); return ERR_SOCKS_CONNECTION_FAILED; } if (buffer_[1] != 0x00) { - net_log_.AddEvent(NetLog::TYPE_SOCKS_UNEXPECTED_AUTH, - new NetLogIntegerParameter("method", buffer_[1])); + net_log_.AddEvent( + NetLog::TYPE_SOCKS_UNEXPECTED_AUTH, + make_scoped_refptr(new NetLogIntegerParameter("method", buffer_[1]))); return ERR_SOCKS_CONNECTION_FAILED; } @@ -417,13 +419,17 @@ int SOCKS5ClientSocket::DoHandshakeReadComplete(int result) { // and accordingly increase them if (bytes_received_ == kReadHeaderSize) { if (buffer_[0] != kSOCKS5Version || buffer_[2] != kNullByte) { - net_log_.AddEvent(NetLog::TYPE_SOCKS_UNEXPECTED_VERSION, - new NetLogIntegerParameter("version", buffer_[0])); + net_log_.AddEvent( + NetLog::TYPE_SOCKS_UNEXPECTED_VERSION, + make_scoped_refptr( + new NetLogIntegerParameter("version", buffer_[0]))); return ERR_SOCKS_CONNECTION_FAILED; } if (buffer_[1] != 0x00) { - net_log_.AddEvent(NetLog::TYPE_SOCKS_SERVER_ERROR, - new NetLogIntegerParameter("error_code", buffer_[1])); + net_log_.AddEvent( + NetLog::TYPE_SOCKS_SERVER_ERROR, + make_scoped_refptr( + new NetLogIntegerParameter("error_code", buffer_[1]))); return ERR_SOCKS_CONNECTION_FAILED; } @@ -441,8 +447,10 @@ int SOCKS5ClientSocket::DoHandshakeReadComplete(int result) { else if (address_type == kEndPointResolvedIPv6) read_header_size += sizeof(struct in6_addr) - 1; else { - net_log_.AddEvent(NetLog::TYPE_SOCKS_UNKNOWN_ADDRESS_TYPE, - new NetLogIntegerParameter("address_type", buffer_[3])); + net_log_.AddEvent( + NetLog::TYPE_SOCKS_UNKNOWN_ADDRESS_TYPE, + make_scoped_refptr( + new NetLogIntegerParameter("address_type", buffer_[3]))); return ERR_SOCKS_CONNECTION_FAILED; } diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc index 5e60778..3a1e3c78 100644 --- a/net/socket/ssl_client_socket_nss.cc +++ b/net/socket/ssl_client_socket_nss.cc @@ -317,8 +317,9 @@ class SSLFailedNSSFunctionParams : public NetLog::EventParameters { void LogFailedNSSFunction(const BoundNetLog& net_log, const char* function, const char* param) { - net_log.AddEvent(NetLog::TYPE_SSL_NSS_ERROR, - new SSLFailedNSSFunctionParams(function, param)); + net_log.AddEvent( + NetLog::TYPE_SSL_NSS_ERROR, + make_scoped_refptr(new SSLFailedNSSFunctionParams(function, param))); } #if defined(OS_WIN) @@ -1545,7 +1546,8 @@ int SSLClientSocketNSS::DoReadLoop(int result) { if (!nss_bufs_) { LOG(DFATAL) << "!nss_bufs_"; int rv = ERR_UNEXPECTED; - net_log_.AddEvent(NetLog::TYPE_SSL_READ_ERROR, new SSLErrorParams(rv, 0)); + net_log_.AddEvent(NetLog::TYPE_SSL_READ_ERROR, + make_scoped_refptr(new SSLErrorParams(rv, 0))); return rv; } @@ -1571,7 +1573,8 @@ int SSLClientSocketNSS::DoWriteLoop(int result) { if (!nss_bufs_) { LOG(DFATAL) << "!nss_bufs_"; int rv = ERR_UNEXPECTED; - net_log_.AddEvent(NetLog::TYPE_SSL_WRITE_ERROR, new SSLErrorParams(rv, 0)); + net_log_.AddEvent(NetLog::TYPE_SSL_WRITE_ERROR, + make_scoped_refptr(new SSLErrorParams(rv, 0))); return rv; } @@ -1900,7 +1903,7 @@ int SSLClientSocketNSS::DoHandshake() { if (client_auth_cert_needed_) { net_error = ERR_SSL_CLIENT_AUTH_CERT_NEEDED; net_log_.AddEvent(NetLog::TYPE_SSL_HANDSHAKE_ERROR, - new SSLErrorParams(net_error, 0)); + make_scoped_refptr(new SSLErrorParams(net_error, 0))); // If the handshake already succeeded (because the server requests but // doesn't require a client cert), we need to invalidate the SSL session // so that we won't try to resume the non-client-authenticated session in @@ -1957,7 +1960,7 @@ int SSLClientSocketNSS::DoHandshake() { rv = SECFailure; net_error = ERR_SSL_PROTOCOL_ERROR; net_log_.AddEvent(NetLog::TYPE_SSL_HANDSHAKE_ERROR, - new SSLErrorParams(net_error, 0)); + make_scoped_refptr(new SSLErrorParams(net_error, 0))); } } else { PRErrorCode prerr = PR_GetError(); @@ -1969,8 +1972,9 @@ int SSLClientSocketNSS::DoHandshake() { } else { LOG(ERROR) << "handshake failed; NSS error code " << prerr << ", net_error " << net_error; - net_log_.AddEvent(NetLog::TYPE_SSL_HANDSHAKE_ERROR, - new SSLErrorParams(net_error, prerr)); + net_log_.AddEvent( + NetLog::TYPE_SSL_HANDSHAKE_ERROR, + make_scoped_refptr(new SSLErrorParams(net_error, prerr))); } } @@ -2288,7 +2292,7 @@ int SSLClientSocketNSS::DoPayloadRead() { LeaveFunction(""); rv = ERR_SSL_CLIENT_AUTH_CERT_NEEDED; net_log_.AddEvent(NetLog::TYPE_SSL_READ_ERROR, - new SSLErrorParams(rv, 0)); + make_scoped_refptr(new SSLErrorParams(rv, 0))); return rv; } if (rv >= 0) { @@ -2303,7 +2307,8 @@ int SSLClientSocketNSS::DoPayloadRead() { } LeaveFunction(""); rv = MapNSPRError(prerr); - net_log_.AddEvent(NetLog::TYPE_SSL_READ_ERROR, new SSLErrorParams(rv, prerr)); + net_log_.AddEvent(NetLog::TYPE_SSL_READ_ERROR, + make_scoped_refptr(new SSLErrorParams(rv, prerr))); return rv; } @@ -2324,7 +2329,7 @@ int SSLClientSocketNSS::DoPayloadWrite() { LeaveFunction(""); rv = MapNSPRError(prerr); net_log_.AddEvent(NetLog::TYPE_SSL_WRITE_ERROR, - new SSLErrorParams(rv, prerr)); + make_scoped_refptr(new SSLErrorParams(rv, prerr))); return rv; } diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc index 1367433..1bbe827 100644 --- a/net/socket/tcp_client_socket_libevent.cc +++ b/net/socket/tcp_client_socket_libevent.cc @@ -152,8 +152,9 @@ int TCPClientSocketLibevent::Connect(CompletionCallback* callback) { DCHECK(!waiting_connect()); - net_log_.BeginEvent(NetLog::TYPE_TCP_CONNECT, - new AddressListNetLogParam(addresses_)); + net_log_.BeginEvent( + NetLog::TYPE_TCP_CONNECT, + make_scoped_refptr(new AddressListNetLogParam(addresses_))); // We will try to connect to each address in addresses_. Start with the // first one in the list. @@ -208,8 +209,8 @@ int TCPClientSocketLibevent::DoConnect() { } net_log_.BeginEvent(NetLog::TYPE_TCP_CONNECT_ATTEMPT, - new NetLogStringParameter( - "address", NetAddressToStringWithPort(current_ai_))); + make_scoped_refptr(new NetLogStringParameter( + "address", NetAddressToStringWithPort(current_ai_)))); next_connect_state_ = CONNECT_STATE_CONNECT_COMPLETE; diff --git a/net/socket/tcp_client_socket_pool.cc b/net/socket/tcp_client_socket_pool.cc index 5f1f43f..8ec9cac 100644 --- a/net/socket/tcp_client_socket_pool.cc +++ b/net/socket/tcp_client_socket_pool.cc @@ -222,9 +222,9 @@ int TCPClientSocketPool::RequestSocket( // TODO(eroman): Split out the host and port parameters. net_log.AddEvent( NetLog::TYPE_TCP_CLIENT_SOCKET_POOL_REQUESTED_SOCKET, - new NetLogStringParameter( + make_scoped_refptr(new NetLogStringParameter( "host_and_port", - casted_params->get()->destination().host_port_pair().ToString())); + casted_params->get()->destination().host_port_pair().ToString()))); } return base_.RequestSocket(group_name, *casted_params, priority, handle, @@ -243,9 +243,9 @@ void TCPClientSocketPool::RequestSockets( // TODO(eroman): Split out the host and port parameters. net_log.AddEvent( NetLog::TYPE_TCP_CLIENT_SOCKET_POOL_REQUESTED_SOCKETS, - new NetLogStringParameter( + make_scoped_refptr(new NetLogStringParameter( "host_and_port", - casted_params->get()->destination().host_port_pair().ToString())); + casted_params->get()->destination().host_port_pair().ToString()))); } base_.RequestSockets(group_name, *casted_params, num_sockets, net_log); diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc index 7c3c5e9..6d6efbe 100644 --- a/net/socket_stream/socket_stream.cc +++ b/net/socket_stream/socket_stream.cc @@ -138,7 +138,8 @@ void SocketStream::Connect() { next_state_ = STATE_RESOLVE_PROXY; net_log_.BeginEvent( NetLog::TYPE_SOCKET_STREAM_CONNECT, - new NetLogStringParameter("url", url_.possibly_invalid_spec())); + make_scoped_refptr( + new NetLogStringParameter("url", url_.possibly_invalid_spec()))); MessageLoop::current()->PostTask( FROM_HERE, NewRunnableMethod(this, &SocketStream::DoLoop, OK)); @@ -162,7 +163,8 @@ bool SocketStream::SendData(const char* data, int len) { if (current_amount_send > max_pending_send_allowed_) return false; - pending_write_bufs_.push_back(new IOBufferWithSize(len)); + pending_write_bufs_.push_back(make_scoped_refptr( + new IOBufferWithSize(len))); memcpy(pending_write_bufs_.back()->data(), data, len); return true; } @@ -445,8 +447,9 @@ void SocketStream::DoLoop(int result) { // close the connection. if (state != STATE_READ_WRITE && result < ERR_IO_PENDING) { DCHECK_EQ(next_state_, STATE_CLOSE); - net_log_.EndEvent(NetLog::TYPE_SOCKET_STREAM_CONNECT, - new NetLogIntegerParameter("net_error", result)); + net_log_.EndEvent( + NetLog::TYPE_SOCKET_STREAM_CONNECT, + make_scoped_refptr(new NetLogIntegerParameter("net_error", result))); } } while (result != ERR_IO_PENDING); } diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc index 737eba5..89002cb 100644 --- a/net/spdy/spdy_http_stream.cc +++ b/net/spdy/spdy_http_stream.cc @@ -113,7 +113,7 @@ int SpdyHttpStream::ReadResponseBody( memcpy(new_buffer->data(), &(data->data()[bytes_to_copy]), bytes_remaining); response_body_.pop_front(); - response_body_.push_front(new_buffer); + response_body_.push_front(make_scoped_refptr(new_buffer)); } bytes_read += bytes_to_copy; } @@ -273,7 +273,7 @@ void SpdyHttpStream::OnDataReceived(const char* data, int length) { // Save the received data. IOBufferWithSize* io_buffer = new IOBufferWithSize(length); memcpy(io_buffer->data(), data, length); - response_body_.push_back(io_buffer); + response_body_.push_back(make_scoped_refptr(io_buffer)); if (user_buffer_) { // Handing small chunks of data to the caller creates measurable overhead. diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc index 8b2dc92..d72a2a7 100644 --- a/net/spdy/spdy_network_transaction_unittest.cc +++ b/net/spdy/spdy_network_transaction_unittest.cc @@ -4151,8 +4151,8 @@ TEST_P(SpdyNetworkTransactionTest, ProxyConnect) { BoundNetLog(), GetParam()); helper.session_deps().reset(new SpdySessionDependencies( ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"))); - helper.SetSession(SpdySessionDependencies::SpdyCreateSession( - helper.session_deps().get())); + helper.SetSession(make_scoped_refptr( + SpdySessionDependencies::SpdyCreateSession(helper.session_deps().get()))); helper.RunPreTestSetup(); HttpNetworkTransaction* trans = helper.trans(); @@ -4254,8 +4254,8 @@ TEST_P(SpdyNetworkTransactionTest, DirectConnectProxyReconnect) { // that the session pool key used does is just "DIRECT". helper.session_deps().reset(new SpdySessionDependencies( ProxyService::CreateFixedFromPacResult("DIRECT; PROXY myproxy:70"))); - helper.SetSession(SpdySessionDependencies::SpdyCreateSession( - helper.session_deps().get())); + helper.SetSession(make_scoped_refptr( + SpdySessionDependencies::SpdyCreateSession(helper.session_deps().get()))); SpdySessionPool* spdy_session_pool = helper.session()->spdy_session_pool(); helper.RunPreTestSetup(); diff --git a/net/spdy/spdy_proxy_client_socket.cc b/net/spdy/spdy_proxy_client_socket.cc index 69e93a6..8066007 100644 --- a/net/spdy/spdy_proxy_client_socket.cc +++ b/net/spdy/spdy_proxy_client_socket.cc @@ -310,8 +310,8 @@ int SpdyProxyClientSocket::DoSendRequest() { if (net_log_.IsLoggingAllEvents()) { net_log_.AddEvent( NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, - new NetLogHttpRequestParameter( - request_line, request_headers)); + make_scoped_refptr(new NetLogHttpRequestParameter( + request_line, request_headers))); } request_.extra_headers.MergeFrom(request_headers); @@ -350,7 +350,7 @@ int SpdyProxyClientSocket::DoReadReplyComplete(int result) { if (net_log_.IsLoggingAllEvents()) { net_log_.AddEvent( NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, - new NetLogHttpResponseParameter(response_.headers)); + make_scoped_refptr(new NetLogHttpResponseParameter(response_.headers))); } if (response_.headers->response_code() == 200) @@ -406,7 +406,8 @@ void SpdyProxyClientSocket::OnDataReceived(const char* data, int length) { // Save the received data. scoped_refptr<IOBuffer> io_buffer(new IOBuffer(length)); memcpy(io_buffer->data(), data, length); - read_buffer_.push_back(new DrainableIOBuffer(io_buffer, length)); + read_buffer_.push_back( + make_scoped_refptr(new DrainableIOBuffer(io_buffer, length))); } if (read_callback_) { diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index 3af9079..7035bb8 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc @@ -255,7 +255,8 @@ SpdySession::SpdySession(const HostPortProxyPair& host_port_proxy_pair, DCHECK(HttpStreamFactory::spdy_enabled()); net_log_.BeginEvent( NetLog::TYPE_SPDY_SESSION, - new NetLogSpdySessionParameter(host_port_proxy_pair_)); + make_scoped_refptr( + new NetLogSpdySessionParameter(host_port_proxy_pair_))); // TODO(mbelshe): consider randomization of the stream_hi_water_mark. @@ -463,7 +464,8 @@ int SpdySession::WriteSynStream( if (net_log().IsLoggingAllEvents()) { net_log().AddEvent( NetLog::TYPE_SPDY_SESSION_SYN_STREAM, - new NetLogSpdySynParameter(headers, flags, stream_id)); + make_scoped_refptr( + new NetLogSpdySynParameter(headers, flags, stream_id))); } return ERR_IO_PENDING; @@ -494,8 +496,10 @@ int SpdySession::WriteStreamData(spdy::SpdyStreamId stream_id, // as stalled - because only the session knows for sure when the // stall occurs. stream->set_stalled_by_flow_control(true); - net_log().AddEvent(NetLog::TYPE_SPDY_SESSION_STALLED_ON_SEND_WINDOW, - new NetLogIntegerParameter("stream_id", stream_id)); + net_log().AddEvent( + NetLog::TYPE_SPDY_SESSION_STALLED_ON_SEND_WINDOW, + make_scoped_refptr( + new NetLogIntegerParameter("stream_id", stream_id))); return ERR_IO_PENDING; } int new_len = std::min(len, stream->send_window_size()); @@ -506,9 +510,11 @@ int SpdySession::WriteStreamData(spdy::SpdyStreamId stream_id, stream->DecreaseSendWindowSize(len); } - if (net_log().IsLoggingAllEvents()) - net_log().AddEvent(NetLog::TYPE_SPDY_SESSION_SEND_DATA, - new NetLogSpdyDataParameter(stream_id, len, flags)); + if (net_log().IsLoggingAllEvents()) { + net_log().AddEvent( + NetLog::TYPE_SPDY_SESSION_SEND_DATA, + make_scoped_refptr(new NetLogSpdyDataParameter(stream_id, len, flags))); + } // TODO(mbelshe): reduce memory copies here. scoped_ptr<spdy::SpdyDataFrame> frame( @@ -529,7 +535,7 @@ void SpdySession::ResetStream( net_log().AddEvent( NetLog::TYPE_SPDY_SESSION_SEND_RST_STREAM, - new NetLogSpdyRstParameter(stream_id, status)); + make_scoped_refptr(new NetLogSpdyRstParameter(stream_id, status))); scoped_ptr<spdy::SpdyRstStreamControlFrame> rst_frame( spdy_framer_.CreateRstStream(stream_id, status)); @@ -829,8 +835,9 @@ void SpdySession::CloseSessionOnError(net::Error err, bool remove_from_pool) { scoped_refptr<SpdySession> self(this); DCHECK_LT(err, OK); - net_log_.AddEvent(NetLog::TYPE_SPDY_SESSION_CLOSE, - new NetLogIntegerParameter("status", err)); + net_log_.AddEvent( + NetLog::TYPE_SPDY_SESSION_CLOSE, + make_scoped_refptr(new NetLogIntegerParameter("status", err))); // Don't close twice. This can occur because we can have both // a read and a write outstanding, and each can complete with @@ -912,7 +919,7 @@ void SpdySession::DeleteStream(spdy::SpdyStreamId id, int status) { void SpdySession::RemoveFromPool() { if (spdy_session_pool_) { - spdy_session_pool_->Remove(this); + spdy_session_pool_->Remove(make_scoped_refptr(this)); spdy_session_pool_ = NULL; } } @@ -963,9 +970,12 @@ void SpdySession::OnError(spdy::SpdyFramer* framer) { void SpdySession::OnStreamFrameData(spdy::SpdyStreamId stream_id, const char* data, size_t len) { - if (net_log().IsLoggingAllEvents()) - net_log().AddEvent(NetLog::TYPE_SPDY_SESSION_RECV_DATA, - new NetLogSpdyDataParameter(stream_id, len, spdy::SpdyDataFlags())); + if (net_log().IsLoggingAllEvents()) { + net_log().AddEvent( + NetLog::TYPE_SPDY_SESSION_RECV_DATA, + make_scoped_refptr(new NetLogSpdyDataParameter( + stream_id, len, spdy::SpdyDataFlags()))); + } if (!IsStreamActive(stream_id)) { // NOTE: it may just be that the stream was cancelled. @@ -999,9 +1009,9 @@ void SpdySession::OnSyn(const spdy::SpdySynStreamControlFrame& frame, if (net_log_.IsLoggingAllEvents()) { net_log_.AddEvent( NetLog::TYPE_SPDY_SESSION_PUSHED_SYN_STREAM, - new NetLogSpdySynParameter( + make_scoped_refptr(new NetLogSpdySynParameter( headers, static_cast<spdy::SpdyControlFlags>(frame.flags()), - stream_id)); + stream_id))); } // Server-initiated streams should have even sequence numbers. @@ -1097,9 +1107,9 @@ void SpdySession::OnSynReply(const spdy::SpdySynReplyControlFrame& frame, if (net_log().IsLoggingAllEvents()) { net_log().AddEvent( NetLog::TYPE_SPDY_SESSION_SYN_REPLY, - new NetLogSpdySynParameter( + make_scoped_refptr(new NetLogSpdySynParameter( headers, static_cast<spdy::SpdyControlFlags>(frame.flags()), - stream_id)); + stream_id))); } Respond(*headers, stream); @@ -1160,7 +1170,8 @@ void SpdySession::OnRst(const spdy::SpdyRstStreamControlFrame& frame) { net_log().AddEvent( NetLog::TYPE_SPDY_SESSION_RST_STREAM, - new NetLogSpdyRstParameter(stream_id, frame.status())); + make_scoped_refptr( + new NetLogSpdyRstParameter(stream_id, frame.status()))); bool valid_stream = IsStreamActive(stream_id); if (!valid_stream) { @@ -1185,9 +1196,10 @@ void SpdySession::OnRst(const spdy::SpdyRstStreamControlFrame& frame) { void SpdySession::OnGoAway(const spdy::SpdyGoAwayControlFrame& frame) { net_log_.AddEvent( NetLog::TYPE_SPDY_SESSION_GOAWAY, - new NetLogSpdyGoAwayParameter(frame.last_accepted_stream_id(), - active_streams_.size(), - unclaimed_pushed_streams_.size())); + make_scoped_refptr( + new NetLogSpdyGoAwayParameter(frame.last_accepted_stream_id(), + active_streams_.size(), + unclaimed_pushed_streams_.size()))); RemoveFromPool(); CloseAllStreams(net::ERR_ABORTED); @@ -1210,7 +1222,7 @@ void SpdySession::OnSettings(const spdy::SpdySettingsControlFrame& frame) { net_log_.AddEvent( NetLog::TYPE_SPDY_SESSION_RECV_SETTINGS, - new NetLogSpdySettingsParameter(settings)); + make_scoped_refptr(new NetLogSpdySettingsParameter(settings))); } void SpdySession::OnWindowUpdate( @@ -1238,9 +1250,8 @@ void SpdySession::OnWindowUpdate( net_log_.AddEvent( NetLog::TYPE_SPDY_SESSION_SEND_WINDOW_UPDATE, - new NetLogSpdyWindowUpdateParameter(stream_id, - delta_window_size, - stream->send_window_size())); + make_scoped_refptr(new NetLogSpdyWindowUpdateParameter( + stream_id, delta_window_size, stream->send_window_size()))); } void SpdySession::SendWindowUpdate(spdy::SpdyStreamId stream_id, @@ -1251,9 +1262,8 @@ void SpdySession::SendWindowUpdate(spdy::SpdyStreamId stream_id, net_log_.AddEvent( NetLog::TYPE_SPDY_SESSION_RECV_WINDOW_UPDATE, - new NetLogSpdyWindowUpdateParameter(stream_id, - delta_window_size, - stream->recv_window_size())); + make_scoped_refptr(new NetLogSpdyWindowUpdateParameter( + stream_id, delta_window_size, stream->recv_window_size()))); scoped_ptr<spdy::SpdyWindowUpdateControlFrame> window_update_frame( spdy_framer_.CreateWindowUpdate(stream_id, delta_window_size)); @@ -1268,7 +1278,7 @@ void SpdySession::SendSettings() { net_log_.AddEvent( NetLog::TYPE_SPDY_SESSION_SEND_SETTINGS, - new NetLogSpdySettingsParameter(settings)); + make_scoped_refptr(new NetLogSpdySettingsParameter(settings))); // Create the SETTINGS frame and send it. scoped_ptr<spdy::SpdySettingsControlFrame> settings_frame( diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc index fe2a310..aa807af 100644 --- a/net/spdy/spdy_session_pool.cc +++ b/net/spdy/spdy_session_pool.cc @@ -41,9 +41,10 @@ scoped_refptr<SpdySession> SpdySessionPool::Get( if (list->size() >= static_cast<unsigned int>(g_max_sessions_per_domain)) { spdy_session = list->front(); list->pop_front(); - net_log.AddEvent(NetLog::TYPE_SPDY_SESSION_POOL_FOUND_EXISTING_SESSION, - new NetLogSourceParameter("session", - spdy_session->net_log().source())); + net_log.AddEvent( + NetLog::TYPE_SPDY_SESSION_POOL_FOUND_EXISTING_SESSION, + make_scoped_refptr(new NetLogSourceParameter( + "session", spdy_session->net_log().source()))); } } else { list = AddSessionList(host_port_proxy_pair); @@ -53,9 +54,10 @@ scoped_refptr<SpdySession> SpdySessionPool::Get( if (!spdy_session) { spdy_session = new SpdySession(host_port_proxy_pair, this, spdy_settings, net_log.net_log()); - net_log.AddEvent(NetLog::TYPE_SPDY_SESSION_POOL_CREATED_NEW_SESSION, - new NetLogSourceParameter("session", - spdy_session->net_log().source())); + net_log.AddEvent( + NetLog::TYPE_SPDY_SESSION_POOL_CREATED_NEW_SESSION, + make_scoped_refptr(new NetLogSourceParameter( + "session", spdy_session->net_log().source()))); } DCHECK(spdy_session); @@ -81,9 +83,10 @@ net::Error SpdySessionPool::GetSpdySessionFromSocket( DCHECK(list->empty()); list->push_back(*spdy_session); - net_log.AddEvent(NetLog::TYPE_SPDY_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, - new NetLogSourceParameter("session", - (*spdy_session)->net_log().source())); + net_log.AddEvent( + NetLog::TYPE_SPDY_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, + make_scoped_refptr(new NetLogSourceParameter( + "session", (*spdy_session)->net_log().source()))); // Now we can initialize the session with the SSL socket. return (*spdy_session)->InitializeWithSocket(connection, is_secure, @@ -103,9 +106,10 @@ void SpdySessionPool::Remove(const scoped_refptr<SpdySession>& session) { if (!list) return; list->remove(session); - session->net_log().AddEvent(NetLog::TYPE_SPDY_SESSION_POOL_REMOVE_SESSION, - new NetLogSourceParameter("session", - session->net_log().source())); + session->net_log().AddEvent( + NetLog::TYPE_SPDY_SESSION_POOL_REMOVE_SESSION, + make_scoped_refptr(new NetLogSourceParameter( + "session", session->net_log().source()))); if (list->empty()) RemoveSessionList(session->host_port_proxy_pair()); } diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc index 102d318..f26dd6d 100644 --- a/net/spdy/spdy_stream.cc +++ b/net/spdy/spdy_stream.cc @@ -60,8 +60,9 @@ SpdyStream::SpdyStream(SpdySession* session, net_log_(net_log), send_bytes_(0), recv_bytes_(0) { - net_log_.BeginEvent(NetLog::TYPE_SPDY_STREAM, - new NetLogIntegerParameter("stream_id", stream_id_)); + net_log_.BeginEvent( + NetLog::TYPE_SPDY_STREAM, + make_scoped_refptr(new NetLogIntegerParameter("stream_id", stream_id_))); } SpdyStream::~SpdyStream() { @@ -148,9 +149,10 @@ void SpdyStream::IncreaseSendWindowSize(int delta_window_size) { send_window_size_ = new_window_size; - net_log_.AddEvent(NetLog::TYPE_SPDY_STREAM_SEND_WINDOW_UPDATE, - new NetLogSpdyStreamWindowUpdateParameter(stream_id_, - delta_window_size, send_window_size_)); + net_log_.AddEvent( + NetLog::TYPE_SPDY_STREAM_SEND_WINDOW_UPDATE, + make_scoped_refptr(new NetLogSpdyStreamWindowUpdateParameter( + stream_id_, delta_window_size, send_window_size_))); if (stalled_by_flow_control_) { stalled_by_flow_control_ = false; io_state_ = STATE_SEND_BODY; @@ -170,9 +172,10 @@ void SpdyStream::DecreaseSendWindowSize(int delta_window_size) { send_window_size_ -= delta_window_size; - net_log_.AddEvent(NetLog::TYPE_SPDY_STREAM_SEND_WINDOW_UPDATE, - new NetLogSpdyStreamWindowUpdateParameter(stream_id_, - -delta_window_size, send_window_size_)); + net_log_.AddEvent( + NetLog::TYPE_SPDY_STREAM_SEND_WINDOW_UPDATE, + make_scoped_refptr(new NetLogSpdyStreamWindowUpdateParameter( + stream_id_, -delta_window_size, send_window_size_))); } void SpdyStream::IncreaseRecvWindowSize(int delta_window_size) { @@ -185,9 +188,10 @@ void SpdyStream::IncreaseRecvWindowSize(int delta_window_size) { DCHECK(new_window_size > 0); recv_window_size_ = new_window_size; - net_log_.AddEvent(NetLog::TYPE_SPDY_STREAM_RECV_WINDOW_UPDATE, - new NetLogSpdyStreamWindowUpdateParameter(stream_id_, - delta_window_size, recv_window_size_)); + net_log_.AddEvent( + NetLog::TYPE_SPDY_STREAM_RECV_WINDOW_UPDATE, + make_scoped_refptr(new NetLogSpdyStreamWindowUpdateParameter( + stream_id_, delta_window_size, recv_window_size_))); session_->SendWindowUpdate(stream_id_, delta_window_size); } @@ -195,9 +199,10 @@ void SpdyStream::DecreaseRecvWindowSize(int delta_window_size) { DCHECK_GE(delta_window_size, 1); recv_window_size_ -= delta_window_size; - net_log_.AddEvent(NetLog::TYPE_SPDY_STREAM_RECV_WINDOW_UPDATE, - new NetLogSpdyStreamWindowUpdateParameter(stream_id_, - -delta_window_size, recv_window_size_)); + net_log_.AddEvent( + NetLog::TYPE_SPDY_STREAM_RECV_WINDOW_UPDATE, + make_scoped_refptr(new NetLogSpdyStreamWindowUpdateParameter( + stream_id_, -delta_window_size, recv_window_size_))); // Since we never decrease the initial window size, we should never hit // a negative |recv_window_size_|, if we do, it's a flow-control violation. @@ -257,7 +262,7 @@ void SpdyStream::OnDataReceived(const char* data, int length) { if (length > 0) { IOBufferWithSize* buf = new IOBufferWithSize(length); memcpy(buf->data(), data, length); - pending_buffers_.push_back(buf); + pending_buffers_.push_back(make_scoped_refptr(buf)); } else { pending_buffers_.push_back(NULL); metrics_.StopStream(); @@ -298,7 +303,7 @@ void SpdyStream::OnDataReceived(const char* data, int length) { // We'll return received data when delegate gets attached to the stream. IOBufferWithSize* buf = new IOBufferWithSize(length); memcpy(buf->data(), data, length); - pending_buffers_.push_back(buf); + pending_buffers_.push_back(make_scoped_refptr(buf)); return; } diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index c8dd874..c4f20c4 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc @@ -315,8 +315,8 @@ void URLRequest::StartJob(URLRequestJob* job) { net_log_.BeginEvent( net::NetLog::TYPE_URL_REQUEST_START_JOB, - new URLRequestStartEventParameters( - url_, method_, load_flags_, priority_)); + make_scoped_refptr(new URLRequestStartEventParameters( + url_, method_, load_flags_, priority_))); job_ = job; job_->SetExtraRequestHeaders(extra_request_headers_); @@ -493,8 +493,8 @@ int URLRequest::Redirect(const GURL& location, int http_status_code) { if (net_log_.IsLoggingAllEvents()) { net_log_.AddEvent( net::NetLog::TYPE_URL_REQUEST_REDIRECTED, - new net::NetLogStringParameter( - "location", location.possibly_invalid_spec())); + make_scoped_refptr(new net::NetLogStringParameter( + "location", location.possibly_invalid_spec()))); } if (redirect_limit_ <= 0) { DVLOG(1) << "disallowing redirect: exceeds limit"; diff --git a/net/websockets/websocket.cc b/net/websockets/websocket.cc index 3bf1da8..f8d9eb9 100644 --- a/net/websockets/websocket.cc +++ b/net/websockets/websocket.cc @@ -80,7 +80,7 @@ void WebSocket::Send(const std::string& msg) { *p = '\0'; memcpy(p + 1, msg.data(), msg.size()); *(p + 1 + msg.size()) = '\xff'; - pending_write_bufs_.push_back(buf); + pending_write_bufs_.push_back(make_scoped_refptr(buf)); SendPending(); } @@ -172,7 +172,7 @@ void WebSocket::OnConnected(SocketStream* socket_stream, const std::string msg = handshake_->CreateClientHandshakeMessage(); IOBufferWithSize* buf = new IOBufferWithSize(msg.size()); memcpy(buf->data(), msg.data(), msg.size()); - pending_write_bufs_.push_back(buf); + pending_write_bufs_.push_back(make_scoped_refptr(buf)); origin_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, &WebSocket::SendPending)); } @@ -430,7 +430,7 @@ void WebSocket::StartClosingHandshake() { client_closing_handshake_ = true; IOBufferWithSize* buf = new IOBufferWithSize(2); memcpy(buf->data(), kClosingFrame, 2); - pending_write_bufs_.push_back(buf); + pending_write_bufs_.push_back(make_scoped_refptr(buf)); SendPending(); } diff --git a/net/websockets/websocket_job.cc b/net/websockets/websocket_job.cc index 64af45b..a1e2dde 100644 --- a/net/websockets/websocket_job.cc +++ b/net/websockets/websocket_job.cc @@ -313,7 +313,8 @@ void WebSocketJob::OnCanGetCookiesCompleted(int policy) { handshake_request_sent_ = 0; socket_->net_log()->AddEvent( NetLog::TYPE_WEB_SOCKET_SEND_REQUEST_HEADERS, - new NetLogWebSocketHandshakeParameter(handshake_request)); + make_scoped_refptr( + new NetLogWebSocketHandshakeParameter(handshake_request))); socket_->SendData(handshake_request.data(), handshake_request.size()); } @@ -354,8 +355,8 @@ void WebSocketJob::OnReceivedHandshakeResponse( // handshake message is completed. socket_->net_log()->AddEvent( NetLog::TYPE_WEB_SOCKET_READ_RESPONSE_HEADERS, - new NetLogWebSocketHandshakeParameter( - handshake_response_->GetRawResponse())); + make_scoped_refptr(new NetLogWebSocketHandshakeParameter( + handshake_response_->GetRawResponse()))); if (len - response_length > 0) { // If we received extra data, it should be frame data. receive_frame_handler_->AppendData(data + response_length, |