summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-02 20:15:57 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-02 20:15:57 +0000
commit00cd9c4e71d1e6dd6cc3a2fff60505479304c9d1 (patch)
treeeb61d6402a5e967e5eb1d41dfde730af48dfa55f
parentd9b888cdf9ad654a3f2e5c22b935e68db77a71ef (diff)
downloadchromium_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
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc5
-rw-r--r--chrome/browser/extensions/extension_cookies_api.cc2
-rw-r--r--chrome/browser/extensions/extension_toolbar_model.cc11
-rw-r--r--chrome/browser/extensions/extensions_service.cc4
-rw-r--r--chrome/browser/extensions/extensions_service_unittest.cc2
-rw-r--r--chrome/browser/memory_purger.cc12
-rw-r--r--chrome/browser/printing/print_job_manager.cc4
-rw-r--r--chrome/browser/sync/engine/apply_updates_command_unittest.cc3
-rw-r--r--chrome/browser/sync/engine/process_commit_response_command_unittest.cc6
-rw-r--r--chrome/browser/sync/engine/verify_updates_command_unittest.cc4
-rw-r--r--chrome/renderer/render_view.cc7
-rw-r--r--chrome/test/automation/dom_element_proxy.cc8
-rw-r--r--ipc/ipc_channel_proxy.cc4
-rw-r--r--media/base/pipeline_impl.cc2
-rw-r--r--media/filters/ffmpeg_demuxer.cc4
-rw-r--r--net/base/host_resolver_impl.cc16
-rw-r--r--net/disk_cache/file_posix.cc6
-rw-r--r--net/disk_cache/in_flight_backend_io.cc2
-rw-r--r--net/disk_cache/in_flight_io.cc4
-rw-r--r--net/http/http_network_transaction.cc6
-rw-r--r--net/http/http_proxy_client_socket.cc6
-rw-r--r--net/proxy/init_proxy_resolver.cc8
-rw-r--r--net/proxy/multi_threaded_proxy_resolver.cc6
-rw-r--r--net/proxy/proxy_bypass_rules.cc12
-rw-r--r--net/proxy/proxy_service.cc6
-rw-r--r--net/socket/client_socket_handle.cc3
-rw-r--r--net/socket/client_socket_pool_base.cc26
-rw-r--r--net/socket/socks5_client_socket.cc28
-rw-r--r--net/socket/ssl_client_socket_nss.cc27
-rw-r--r--net/socket/tcp_client_socket_libevent.cc9
-rw-r--r--net/socket/tcp_client_socket_pool.cc8
-rw-r--r--net/socket_stream/socket_stream.cc11
-rw-r--r--net/spdy/spdy_http_stream.cc4
-rw-r--r--net/spdy/spdy_network_transaction_unittest.cc8
-rw-r--r--net/spdy/spdy_proxy_client_socket.cc9
-rw-r--r--net/spdy/spdy_session.cc70
-rw-r--r--net/spdy/spdy_session_pool.cc28
-rw-r--r--net/spdy/spdy_stream.cc37
-rw-r--r--net/url_request/url_request.cc8
-rw-r--r--net/websockets/websocket.cc6
-rw-r--r--net/websockets/websocket_job.cc7
-rw-r--r--remoting/base/multiple_array_input_stream.cc3
-rw-r--r--remoting/base/tracer.cc2
-rw-r--r--remoting/protocol/jingle_chromotocol_server.cc2
-rw-r--r--remoting/protocol/message_decoder.cc3
-rw-r--r--remoting/protocol/protocol_test_client.cc4
-rw-r--r--webkit/appcache/appcache_storage_impl.cc2
-rw-r--r--webkit/appcache/mock_appcache_storage.cc12
-rw-r--r--webkit/glue/plugins/pepper_file_chooser.cc6
-rw-r--r--webkit/glue/plugins/plugin_instance.cc2
-rw-r--r--webkit/glue/plugins/plugin_lib.cc2
-rw-r--r--webkit/glue/webmediaplayer_impl.cc12
52 files changed, 276 insertions, 213 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index 241a4b1..c3c8f14 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -562,8 +562,9 @@ void TestingAutomationProvider::DeleteCookie(const GURL& url,
NavigationController* tab = tab_tracker_->GetResource(handle);
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- new DeleteCookieTask(url, cookie_name,
- tab->profile()->GetRequestContext()));
+ new DeleteCookieTask(
+ url, cookie_name,
+ make_scoped_refptr(tab->profile()->GetRequestContext())));
*success = true;
}
}
diff --git a/chrome/browser/extensions/extension_cookies_api.cc b/chrome/browser/extensions/extension_cookies_api.cc
index b97c74d..e66c4b3 100644
--- a/chrome/browser/extensions/extension_cookies_api.cc
+++ b/chrome/browser/extensions/extension_cookies_api.cc
@@ -409,7 +409,7 @@ bool RemoveCookieFunction::RunImpl() {
// should happen after this.
bool rv = BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- new RemoveCookieTask(url, name, store_context));
+ new RemoveCookieTask(url, name, make_scoped_refptr(store_context)));
DCHECK(rv);
return true;
diff --git a/chrome/browser/extensions/extension_toolbar_model.cc b/chrome/browser/extensions/extension_toolbar_model.cc
index 4b55442..9b36825 100644
--- a/chrome/browser/extensions/extension_toolbar_model.cc
+++ b/chrome/browser/extensions/extension_toolbar_model.cc
@@ -58,7 +58,7 @@ void ExtensionToolbarModel::MoveBrowserAction(const Extension* extension,
bool inserted = false;
for (ExtensionList::iterator iter = begin(); iter != end(); ++iter, ++i) {
if (i == index) {
- toolitems_.insert(iter, extension);
+ toolitems_.insert(iter, make_scoped_refptr(extension));
inserted = true;
break;
}
@@ -68,7 +68,7 @@ void ExtensionToolbarModel::MoveBrowserAction(const Extension* extension,
DCHECK_EQ(index, static_cast<int>(toolitems_.size()));
index = toolitems_.size();
- toolitems_.push_back(extension);
+ toolitems_.push_back(make_scoped_refptr(extension));
}
FOR_EACH_OBSERVER(Observer, observers_, BrowserActionMoved(extension, index));
@@ -111,11 +111,12 @@ void ExtensionToolbarModel::AddExtension(const Extension* extension) {
if (extension->id() == last_extension_removed_ &&
last_extension_removed_index_ < toolitems_.size()) {
- toolitems_.insert(begin() + last_extension_removed_index_, extension);
+ toolitems_.insert(begin() + last_extension_removed_index_,
+ make_scoped_refptr(extension));
FOR_EACH_OBSERVER(Observer, observers_,
BrowserActionAdded(extension, last_extension_removed_index_));
} else {
- toolitems_.push_back(extension);
+ toolitems_.push_back(make_scoped_refptr(extension));
FOR_EACH_OBSERVER(Observer, observers_,
BrowserActionAdded(extension, toolitems_.size() - 1));
}
@@ -172,7 +173,7 @@ void ExtensionToolbarModel::InitializeExtensionList() {
int index = std::distance(pref_order.begin(), pos);
sorted[index] = extension;
} else {
- unsorted.push_back(extension);
+ unsorted.push_back(make_scoped_refptr(extension));
}
}
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc
index 1591eb2..98681de 100644
--- a/chrome/browser/extensions/extensions_service.cc
+++ b/chrome/browser/extensions/extensions_service.cc
@@ -891,7 +891,7 @@ void ExtensionsService::EnableExtension(const std::string& extension_id) {
extension_prefs_->SetExtensionState(extension, Extension::ENABLED);
// Move it over to the enabled list.
- extensions_.push_back(extension);
+ extensions_.push_back(make_scoped_refptr(extension));
ExtensionList::iterator iter = std::find(disabled_extensions_.begin(),
disabled_extensions_.end(),
extension);
@@ -916,7 +916,7 @@ void ExtensionsService::DisableExtension(const std::string& extension_id) {
extension_prefs_->SetExtensionState(extension, Extension::DISABLED);
// Move it over to the disabled list.
- disabled_extensions_.push_back(extension);
+ disabled_extensions_.push_back(make_scoped_refptr(extension));
ExtensionList::iterator iter = std::find(extensions_.begin(),
extensions_.end(),
extension);
diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc
index dab980d..ee979f33 100644
--- a/chrome/browser/extensions/extensions_service_unittest.cc
+++ b/chrome/browser/extensions/extensions_service_unittest.cc
@@ -422,7 +422,7 @@ class ExtensionsServiceTest
switch (type.value) {
case NotificationType::EXTENSION_LOADED: {
const Extension* extension = Details<const Extension>(details).ptr();
- loaded_.push_back(extension);
+ loaded_.push_back(make_scoped_refptr(extension));
// The tests rely on the errors being in a certain order, which can vary
// depending on how filesystem iteration works.
std::stable_sort(loaded_.begin(), loaded_.end(), ExtensionsOrder());
diff --git a/chrome/browser/memory_purger.cc b/chrome/browser/memory_purger.cc
index d1431da..3543ee5 100644
--- a/chrome/browser/memory_purger.cc
+++ b/chrome/browser/memory_purger.cc
@@ -37,7 +37,8 @@ class PurgeMemoryIOHelper
: safe_browsing_service_(safe_browsing_service) {
}
- void AddRequestContextGetter(URLRequestContextGetter* request_context_getter);
+ void AddRequestContextGetter(
+ scoped_refptr<URLRequestContextGetter> request_context_getter);
void PurgeMemoryOnIOThread();
@@ -52,11 +53,8 @@ class PurgeMemoryIOHelper
};
void PurgeMemoryIOHelper::AddRequestContextGetter(
- URLRequestContextGetter* request_context_getter) {
- if (!request_context_getters_.count(request_context_getter)) {
- request_context_getters_.insert(
- RequestContextGetter(request_context_getter));
- }
+ scoped_refptr<URLRequestContextGetter> request_context_getter) {
+ request_context_getters_.insert(request_context_getter);
}
void PurgeMemoryIOHelper::PurgeMemoryOnIOThread() {
@@ -104,7 +102,7 @@ void MemoryPurger::PurgeBrowser() {
i != profile_manager->end(); ++i) {
Profile* profile = *i;
purge_memory_io_helper->AddRequestContextGetter(
- profile->GetRequestContext());
+ make_scoped_refptr(profile->GetRequestContext()));
// NOTE: Some objects below may be duplicates across profiles. We could
// conceivably put all these in sets and then iterate over the sets.
diff --git a/chrome/browser/printing/print_job_manager.cc b/chrome/browser/printing/print_job_manager.cc
index 91b27ee..25f4791 100644
--- a/chrome/browser/printing/print_job_manager.cc
+++ b/chrome/browser/printing/print_job_manager.cc
@@ -61,7 +61,7 @@ void PrintJobManager::StopJobs(bool wait_for_finish) {
void PrintJobManager::QueuePrinterQuery(PrinterQuery* job) {
AutoLock lock(lock_);
DCHECK(job);
- queued_queries_.push_back(job);
+ queued_queries_.push_back(make_scoped_refptr(job));
DCHECK(job->is_valid());
}
@@ -116,7 +116,7 @@ void PrintJobManager::OnPrintJobEvent(
current_jobs_.end(),
print_job));
// Causes a AddRef().
- current_jobs_.push_back(print_job);
+ current_jobs_.push_back(make_scoped_refptr(print_job));
break;
}
case JobEventDetails::JOB_DONE: {
diff --git a/chrome/browser/sync/engine/apply_updates_command_unittest.cc b/chrome/browser/sync/engine/apply_updates_command_unittest.cc
index 2cf2825..b3ca18c 100644
--- a/chrome/browser/sync/engine/apply_updates_command_unittest.cc
+++ b/chrome/browser/sync/engine/apply_updates_command_unittest.cc
@@ -33,7 +33,8 @@ class ApplyUpdatesCommandTest : public SyncerCommandTest {
virtual void SetUp() {
workers()->clear();
mutable_routing_info()->clear();
- workers()->push_back(new ModelSafeWorker()); // GROUP_PASSIVE worker.
+ // GROUP_PASSIVE worker.
+ workers()->push_back(make_scoped_refptr(new ModelSafeWorker()));
(*mutable_routing_info())[syncable::BOOKMARKS] = GROUP_PASSIVE;
(*mutable_routing_info())[syncable::PASSWORDS] = GROUP_PASSIVE;
(*mutable_routing_info())[syncable::NIGORI] = GROUP_PASSIVE;
diff --git a/chrome/browser/sync/engine/process_commit_response_command_unittest.cc b/chrome/browser/sync/engine/process_commit_response_command_unittest.cc
index b6afab8..b80a3cd 100644
--- a/chrome/browser/sync/engine/process_commit_response_command_unittest.cc
+++ b/chrome/browser/sync/engine/process_commit_response_command_unittest.cc
@@ -42,8 +42,10 @@ class ProcessCommitResponseCommandTestWithParam
workers()->clear();
mutable_routing_info()->clear();
- workers()->push_back(new ModelSafeWorker()); // GROUP_PASSIVE worker.
- workers()->push_back(new MockUIModelWorker()); // GROUP_UI worker.
+ // GROUP_PASSIVE worker.
+ workers()->push_back(make_scoped_refptr(new ModelSafeWorker()));
+ // GROUP_UI worker.
+ workers()->push_back(make_scoped_refptr(new MockUIModelWorker()));
(*mutable_routing_info())[syncable::BOOKMARKS] = GROUP_UI;
(*mutable_routing_info())[syncable::PREFERENCES] = GROUP_UI;
(*mutable_routing_info())[syncable::AUTOFILL] = GROUP_PASSIVE;
diff --git a/chrome/browser/sync/engine/verify_updates_command_unittest.cc b/chrome/browser/sync/engine/verify_updates_command_unittest.cc
index 3ac4bf2..0c27b99 100644
--- a/chrome/browser/sync/engine/verify_updates_command_unittest.cc
+++ b/chrome/browser/sync/engine/verify_updates_command_unittest.cc
@@ -30,8 +30,8 @@ class VerifyUpdatesCommandTest : public SyncerCommandTest {
virtual void SetUp() {
workers()->clear();
mutable_routing_info()->clear();
- workers()->push_back(new MockDBModelWorker());
- workers()->push_back(new MockUIModelWorker());
+ workers()->push_back(make_scoped_refptr(new MockDBModelWorker()));
+ workers()->push_back(make_scoped_refptr(new MockUIModelWorker()));
(*mutable_routing_info())[syncable::PREFERENCES] = GROUP_UI;
(*mutable_routing_info())[syncable::BOOKMARKS] = GROUP_UI;
(*mutable_routing_info())[syncable::AUTOFILL] = GROUP_DB;
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 471c2a5..72ca031 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -2607,7 +2607,8 @@ WebMediaPlayer* RenderView::createMediaPlayer(
const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
if (!cmd_line->HasSwitch(switches::kDisableAudio)) {
// Add the chrome specific audio renderer.
- collection.push_back(new AudioRendererImpl(audio_message_filter()));
+ collection.push_back(make_scoped_refptr(
+ new AudioRendererImpl(audio_message_filter())));
}
if (cmd_line->HasSwitch(switches::kEnableAcceleratedDecoding) &&
@@ -2618,8 +2619,8 @@ WebMediaPlayer* RenderView::createMediaPlayer(
bool ret = frame->view()->graphicsContext3D()->makeContextCurrent();
CHECK(ret) << "Failed to switch context";
- collection.push_back(new IpcVideoDecoder(
- MessageLoop::current(), ggl::GetCurrentContext()));
+ collection.push_back(make_scoped_refptr(new IpcVideoDecoder(
+ MessageLoop::current(), ggl::GetCurrentContext())));
}
WebApplicationCacheHostImpl* appcache_host =
diff --git a/chrome/test/automation/dom_element_proxy.cc b/chrome/test/automation/dom_element_proxy.cc
index 894429f..8dce073 100644
--- a/chrome/test/automation/dom_element_proxy.cc
+++ b/chrome/test/automation/dom_element_proxy.cc
@@ -109,8 +109,8 @@ bool DOMElementProxy::FindElements(const By& by,
return false;
}
for (size_t i = 0; i < element_handles.size(); i++) {
- elements->push_back(executor_->GetObjectProxy<DOMElementProxy>(
- element_handles[i]));
+ elements->push_back(make_scoped_refptr(
+ executor_->GetObjectProxy<DOMElementProxy>(element_handles[i])));
}
return true;
}
@@ -134,8 +134,8 @@ bool DOMElementProxy::WaitForVisibleElementCount(
}
if (static_cast<int>(element_handles.size()) == count) {
for (size_t i = 0; i < element_handles.size(); i++) {
- elements->push_back(executor_->GetObjectProxy<DOMElementProxy>(
- element_handles[i]));
+ elements->push_back(make_scoped_refptr(
+ executor_->GetObjectProxy<DOMElementProxy>(element_handles[i])));
}
}
return static_cast<int>(element_handles.size()) == count;
diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc
index dcc66aad..5b9083b 100644
--- a/ipc/ipc_channel_proxy.cc
+++ b/ipc/ipc_channel_proxy.cc
@@ -70,7 +70,7 @@ ChannelProxy::Context::Context(Channel::Listener* listener,
peer_pid_(0),
channel_connected_called_(false) {
if (filter)
- filters_.push_back(filter);
+ filters_.push_back(make_scoped_refptr(filter));
}
void ChannelProxy::Context::CreateChannel(const std::string& id,
@@ -190,7 +190,7 @@ void ChannelProxy::Context::OnSendMessage(Message* message) {
// Called on the IPC::Channel thread
void ChannelProxy::Context::OnAddFilter(MessageFilter* filter) {
- filters_.push_back(filter);
+ filters_.push_back(make_scoped_refptr(filter));
// If the channel has already been created, then we need to send this message
// so that the filter gets access to the Channel.
diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc
index 2128c34..214be7d0 100644
--- a/media/base/pipeline_impl.cc
+++ b/media/base/pipeline_impl.cc
@@ -1027,7 +1027,7 @@ void PipelineImpl::PrepareFilter(scoped_refptr<MediaFilter> filter) {
DCHECK(filter_types_.find(filter->filter_type()) == filter_types_.end())
<< "Filter type " << filter->filter_type() << " already exists";
filter->set_host(this);
- filters_.push_back(filter.get());
+ filters_.push_back(make_scoped_refptr(filter.get()));
filter_types_[filter->filter_type()] = filter.get();
}
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index 658bd8a..e966c7b 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -447,8 +447,8 @@ void FFmpegDemuxer::InitializeTask(DataSource* data_source,
= new FFmpegDemuxerStream(this, stream);
DCHECK(demuxer_stream);
- streams_.push_back(demuxer_stream);
- packet_streams_.push_back(demuxer_stream);
+ streams_.push_back(make_scoped_refptr(demuxer_stream));
+ packet_streams_.push_back(make_scoped_refptr(demuxer_stream));
max_duration = std::max(max_duration, demuxer_stream->duration());
} else {
packet_streams_.push_back(NULL);
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,
diff --git a/remoting/base/multiple_array_input_stream.cc b/remoting/base/multiple_array_input_stream.cc
index d2127c4..67aa2ff 100644
--- a/remoting/base/multiple_array_input_stream.cc
+++ b/remoting/base/multiple_array_input_stream.cc
@@ -21,7 +21,8 @@ MultipleArrayInputStream::~MultipleArrayInputStream() {
void MultipleArrayInputStream::AddBuffer(net::IOBuffer* buffer, int size) {
DCHECK_EQ(position_, 0); // Haven't started reading.
- buffers_.push_back(new net::DrainableIOBuffer(buffer, size));
+ buffers_.push_back(make_scoped_refptr(
+ new net::DrainableIOBuffer(buffer, size)));
}
bool MultipleArrayInputStream::Next(const void** data, int* size) {
diff --git a/remoting/base/tracer.cc b/remoting/base/tracer.cc
index 4d30f91..3245887 100644
--- a/remoting/base/tracer.cc
+++ b/remoting/base/tracer.cc
@@ -172,7 +172,7 @@ TraceContext::TraceContext() {}
TraceContext::~TraceContext() {}
void TraceContext::PushTracerInternal(Tracer* tracer) {
- tracers_.push_back(tracer);
+ tracers_.push_back(make_scoped_refptr(tracer));
}
void TraceContext::PopTracerInternal() { tracers_.pop_back(); }
diff --git a/remoting/protocol/jingle_chromotocol_server.cc b/remoting/protocol/jingle_chromotocol_server.cc
index 2300243..b0f680b 100644
--- a/remoting/protocol/jingle_chromotocol_server.cc
+++ b/remoting/protocol/jingle_chromotocol_server.cc
@@ -270,7 +270,7 @@ void JingleChromotocolServer::OnSessionCreate(
if (incoming) {
JingleChromotocolConnection* connection =
new JingleChromotocolConnection(this);
- connections_.push_back(connection);
+ connections_.push_back(make_scoped_refptr(connection));
connection->Init(session);
}
}
diff --git a/remoting/protocol/message_decoder.cc b/remoting/protocol/message_decoder.cc
index 4a31ee1..b82eb04 100644
--- a/remoting/protocol/message_decoder.cc
+++ b/remoting/protocol/message_decoder.cc
@@ -22,7 +22,8 @@ MessageDecoder::~MessageDecoder() {}
void MessageDecoder::AddBuffer(scoped_refptr<net::IOBuffer> data,
int data_size) {
- buffer_list_.push_back(new net::DrainableIOBuffer(data, data_size));
+ buffer_list_.push_back(make_scoped_refptr(
+ new net::DrainableIOBuffer(data, data_size)));
available_bytes_ += data_size;
}
diff --git a/remoting/protocol/protocol_test_client.cc b/remoting/protocol/protocol_test_client.cc
index d61c0b5..b28e96d 100644
--- a/remoting/protocol/protocol_test_client.cc
+++ b/remoting/protocol/protocol_test_client.cc
@@ -288,7 +288,7 @@ void ProtocolTestClient::OnStateChange(
host_jid_, CandidateChromotocolConfig::CreateDefault(),
NewCallback(connection,
&ProtocolTestConnection::OnStateChange)));
- connections_.push_back(connection);
+ connections_.push_back(make_scoped_refptr(connection));
}
} else if (state == JingleClient::CLOSED) {
std::cerr << "Connection closed" << std::endl;
@@ -309,7 +309,7 @@ void ProtocolTestClient::OnNewChromotocolConnection(
NewCallback(test_connection, &ProtocolTestConnection::OnStateChange));
test_connection->Init(connection);
AutoLock auto_lock(connections_lock_);
- connections_.push_back(test_connection);
+ connections_.push_back(make_scoped_refptr(test_connection));
}
void ProtocolTestClient::OnFinishedClosing() {
diff --git a/webkit/appcache/appcache_storage_impl.cc b/webkit/appcache/appcache_storage_impl.cc
index 232dffb..c8f6e3a 100644
--- a/webkit/appcache/appcache_storage_impl.cc
+++ b/webkit/appcache/appcache_storage_impl.cc
@@ -48,7 +48,7 @@ class AppCacheStorageImpl::DatabaseTask
virtual ~DatabaseTask() {}
void AddDelegate(DelegateReference* delegate_reference) {
- delegates_.push_back(delegate_reference);
+ delegates_.push_back(make_scoped_refptr(delegate_reference));
}
// Schedules a task to be Run() on the DB thread. Tasks
diff --git a/webkit/appcache/mock_appcache_storage.cc b/webkit/appcache/mock_appcache_storage.cc
index a50dca6..13ae899 100644
--- a/webkit/appcache/mock_appcache_storage.cc
+++ b/webkit/appcache/mock_appcache_storage.cc
@@ -390,8 +390,10 @@ void MockAppCacheStorage::RunOnePendingTask() {
void MockAppCacheStorage::AddStoredCache(AppCache* cache) {
int64 cache_id = cache->cache_id();
- if (stored_caches_.find(cache_id) == stored_caches_.end())
- stored_caches_.insert(StoredCacheMap::value_type(cache_id, cache));
+ if (stored_caches_.find(cache_id) == stored_caches_.end()) {
+ stored_caches_.insert(
+ StoredCacheMap::value_type(cache_id, make_scoped_refptr(cache)));
+ }
}
void MockAppCacheStorage::RemoveStoredCache(AppCache* cache) {
@@ -411,8 +413,10 @@ void MockAppCacheStorage::RemoveStoredCaches(
void MockAppCacheStorage::AddStoredGroup(AppCacheGroup* group) {
const GURL& url = group->manifest_url();
- if (stored_groups_.find(url) == stored_groups_.end())
- stored_groups_.insert(StoredGroupMap::value_type(url, group));
+ if (stored_groups_.find(url) == stored_groups_.end()) {
+ stored_groups_.insert(
+ StoredGroupMap::value_type(url, make_scoped_refptr(group)));
+ }
}
void MockAppCacheStorage::RemoveStoredGroup(AppCacheGroup* group) {
diff --git a/webkit/glue/plugins/pepper_file_chooser.cc b/webkit/glue/plugins/pepper_file_chooser.cc
index 098d60d..576e205 100644
--- a/webkit/glue/plugins/pepper_file_chooser.cc
+++ b/webkit/glue/plugins/pepper_file_chooser.cc
@@ -118,8 +118,10 @@ void FileChooser::StoreChosenFiles(const std::vector<std::string>& files) {
next_chosen_file_index_ = 0;
std::vector<std::string>::const_iterator end_it = files.end();
for (std::vector<std::string>::const_iterator it = files.begin();
- it != end_it; it++)
- chosen_files_.push_back(new FileRef(module(), FilePath().AppendASCII(*it)));
+ it != end_it; it++) {
+ chosen_files_.push_back(make_scoped_refptr(
+ new FileRef(module(), FilePath().AppendASCII(*it))));
+ }
if (!completion_callback_.func)
return;
diff --git a/webkit/glue/plugins/plugin_instance.cc b/webkit/glue/plugins/plugin_instance.cc
index f7b3bf7..df949d0 100644
--- a/webkit/glue/plugins/plugin_instance.cc
+++ b/webkit/glue/plugins/plugin_instance.cc
@@ -91,7 +91,7 @@ PluginStreamUrl* PluginInstance::CreateStream(unsigned long resource_id,
}
void PluginInstance::AddStream(PluginStream* stream) {
- open_streams_.push_back(stream);
+ open_streams_.push_back(make_scoped_refptr(stream));
}
void PluginInstance::RemoveStream(PluginStream* stream) {
diff --git a/webkit/glue/plugins/plugin_lib.cc b/webkit/glue/plugins/plugin_lib.cc
index 6c95274..ee613c1 100644
--- a/webkit/glue/plugins/plugin_lib.cc
+++ b/webkit/glue/plugins/plugin_lib.cc
@@ -74,7 +74,7 @@ PluginLib::PluginLib(const WebPluginInfo& info,
skip_unload_(false) {
base::StatsCounter(kPluginLibrariesLoadedCounter).Increment();
memset(static_cast<void*>(&plugin_funcs_), 0, sizeof(plugin_funcs_));
- g_loaded_libs->push_back(this);
+ g_loaded_libs->push_back(make_scoped_refptr(this));
if (entry_points) {
internal_ = true;
diff --git a/webkit/glue/webmediaplayer_impl.cc b/webkit/glue/webmediaplayer_impl.cc
index 019a664..21a083d 100644
--- a/webkit/glue/webmediaplayer_impl.cc
+++ b/webkit/glue/webmediaplayer_impl.cc
@@ -284,10 +284,14 @@ WebMediaPlayerImpl::WebMediaPlayerImpl(
}
// Add in the default filter factories.
- filter_collection_.push_back(new media::FFmpegDemuxer());
- filter_collection_.push_back(new media::FFmpegAudioDecoder());
- filter_collection_.push_back(new media::FFmpegVideoDecoder(NULL));
- filter_collection_.push_back(new media::NullAudioRenderer());
+ filter_collection_.push_back(make_scoped_refptr(
+ new media::FFmpegDemuxer()));
+ filter_collection_.push_back(make_scoped_refptr(
+ new media::FFmpegAudioDecoder()));
+ filter_collection_.push_back(make_scoped_refptr(
+ new media::FFmpegVideoDecoder(NULL)));
+ filter_collection_.push_back(make_scoped_refptr(
+ new media::NullAudioRenderer()));
}
WebMediaPlayerImpl::~WebMediaPlayerImpl() {