Commit ea6b9eb6 authored by dcheng's avatar dcheng Committed by Commit bot

Remove implicit conversions from scoped_refptr to T* in content/*/service_worker/

This patch was generated by running the rewrite_scoped_refptr clang tool
on a Linux build.

BUG=110610

Review URL: https://codereview.chromium.org/506093002

Cr-Commit-Position: refs/heads/master@{#292011}
parent 22180a63
...@@ -131,7 +131,7 @@ class BlobReader : public net::URLRequest::Delegate { ...@@ -131,7 +131,7 @@ class BlobReader : public net::URLRequest::Delegate {
int rv = entry_->WriteData(INDEX_RESPONSE_BODY, int rv = entry_->WriteData(INDEX_RESPONSE_BODY,
cache_entry_offset_, cache_entry_offset_,
buffer_, buffer_.get(),
bytes_read, bytes_read,
cache_write_callback, cache_write_callback,
true /* truncate */); true /* truncate */);
...@@ -280,7 +280,7 @@ void PutDidCreateEntry(ServiceWorkerFetchRequest* request, ...@@ -280,7 +280,7 @@ void PutDidCreateEntry(ServiceWorkerFetchRequest* request,
rv = tmp_entry_ptr->WriteData(INDEX_HEADERS, rv = tmp_entry_ptr->WriteData(INDEX_HEADERS,
0 /* offset */, 0 /* offset */,
buffer, buffer.get(),
buffer->size(), buffer->size(),
write_headers_callback, write_headers_callback,
true /* truncate */); true /* truncate */);
...@@ -491,7 +491,7 @@ void MatchDidReadResponseBodyData( ...@@ -491,7 +491,7 @@ void MatchDidReadResponseBodyData(
int total_bytes_read = response_context->total_bytes_read; int total_bytes_read = response_context->total_bytes_read;
// Grab some pointers before passing them in bind. // Grab some pointers before passing them in bind.
net::IOBufferWithSize* buffer = response_context->buffer; net::IOBufferWithSize* buffer = response_context->buffer.get();
disk_cache::Entry* tmp_entry_ptr = entry.get(); disk_cache::Entry* tmp_entry_ptr = entry.get();
net::CompletionCallback read_callback = net::CompletionCallback read_callback =
......
...@@ -1123,21 +1123,21 @@ TEST_F(ServiceWorkerJobTest, Update_NewestVersionChanged) { ...@@ -1123,21 +1123,21 @@ TEST_F(ServiceWorkerJobTest, Update_NewestVersionChanged) {
ServiceWorkerVersion* active_version = registration->active_version(); ServiceWorkerVersion* active_version = registration->active_version();
// Queue an Update, it should abort when it starts and sees the new version. // Queue an Update, it should abort when it starts and sees the new version.
job_coordinator()->Update(registration); job_coordinator()->Update(registration.get());
// Add a waiting version with new script. // Add a waiting version with new script.
scoped_refptr<ServiceWorkerVersion> version = scoped_refptr<ServiceWorkerVersion> version =
new ServiceWorkerVersion(registration, new ServiceWorkerVersion(registration.get(),
GURL("http://www.example.com/new_worker.js"), GURL("http://www.example.com/new_worker.js"),
2L /* dummy version id */, 2L /* dummy version id */,
helper_->context()->AsWeakPtr()); helper_->context()->AsWeakPtr());
registration->SetWaitingVersion(version); registration->SetWaitingVersion(version.get());
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
// Verify the registration was not modified by the Update. // Verify the registration was not modified by the Update.
EXPECT_EQ(active_version, registration->active_version()); EXPECT_EQ(active_version, registration->active_version());
EXPECT_EQ(version, registration->waiting_version()); EXPECT_EQ(version.get(), registration->waiting_version());
EXPECT_EQ(NULL, registration->installing_version()); EXPECT_EQ(NULL, registration->installing_version());
} }
...@@ -1166,7 +1166,7 @@ TEST_F(ServiceWorkerJobTest, Update_UninstallingRegistration) { ...@@ -1166,7 +1166,7 @@ TEST_F(ServiceWorkerJobTest, Update_UninstallingRegistration) {
SaveUnregistration(SERVICE_WORKER_OK, &called)); SaveUnregistration(SERVICE_WORKER_OK, &called));
// Update should abort after it starts and sees uninstalling. // Update should abort after it starts and sees uninstalling.
job_coordinator()->Update(registration); job_coordinator()->Update(registration.get());
EXPECT_FALSE(called); EXPECT_FALSE(called);
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
......
...@@ -190,17 +190,18 @@ WebServiceWorkerImpl* ServiceWorkerDispatcher::GetServiceWorker( ...@@ -190,17 +190,18 @@ WebServiceWorkerImpl* ServiceWorkerDispatcher::GetServiceWorker(
if (adopt_handle) { if (adopt_handle) {
// We are instructed to adopt a handle but we already have one, so // We are instructed to adopt a handle but we already have one, so
// adopt and destroy a handle ref. // adopt and destroy a handle ref.
ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_); ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get());
} }
return existing_worker->second; return existing_worker->second;
} }
scoped_ptr<ServiceWorkerHandleReference> handle_ref = scoped_ptr<ServiceWorkerHandleReference> handle_ref =
adopt_handle adopt_handle
? ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_) ? ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get())
: ServiceWorkerHandleReference::Create(info, thread_safe_sender_); : ServiceWorkerHandleReference::Create(info,
thread_safe_sender_.get());
// WebServiceWorkerImpl constructor calls AddServiceWorker. // WebServiceWorkerImpl constructor calls AddServiceWorker.
return new WebServiceWorkerImpl(handle_ref.Pass(), thread_safe_sender_); return new WebServiceWorkerImpl(handle_ref.Pass(), thread_safe_sender_.get());
} }
WebServiceWorkerRegistrationImpl* WebServiceWorkerRegistrationImpl*
...@@ -218,17 +219,16 @@ ServiceWorkerDispatcher::GetServiceWorkerRegistration( ...@@ -218,17 +219,16 @@ ServiceWorkerDispatcher::GetServiceWorkerRegistration(
// We are instructed to adopt a handle but we already have one, so // We are instructed to adopt a handle but we already have one, so
// adopt and destroy a handle ref. // adopt and destroy a handle ref.
ServiceWorkerRegistrationHandleReference::Adopt( ServiceWorkerRegistrationHandleReference::Adopt(
info, thread_safe_sender_); info, thread_safe_sender_.get());
} }
return existing_registration->second; return existing_registration->second;
} }
scoped_ptr<ServiceWorkerRegistrationHandleReference> handle_ref = scoped_ptr<ServiceWorkerRegistrationHandleReference> handle_ref =
adopt_handle adopt_handle ? ServiceWorkerRegistrationHandleReference::Adopt(
? ServiceWorkerRegistrationHandleReference::Adopt( info, thread_safe_sender_.get())
info, thread_safe_sender_) : ServiceWorkerRegistrationHandleReference::Create(
: ServiceWorkerRegistrationHandleReference::Create( info, thread_safe_sender_.get());
info, thread_safe_sender_);
// WebServiceWorkerRegistrationImpl constructor calls // WebServiceWorkerRegistrationImpl constructor calls
// AddServiceWorkerRegistration. // AddServiceWorkerRegistration.
......
...@@ -82,7 +82,7 @@ void ServiceWorkerMessageFilter::OnStaleRegistered( ...@@ -82,7 +82,7 @@ void ServiceWorkerMessageFilter::OnStaleRegistered(
int thread_id, int thread_id,
int request_id, int request_id,
const ServiceWorkerRegistrationObjectInfo& info) { const ServiceWorkerRegistrationObjectInfo& info) {
SendRegistrationObjectDestroyed(thread_safe_sender_, info.handle_id); SendRegistrationObjectDestroyed(thread_safe_sender_.get(), info.handle_id);
} }
void ServiceWorkerMessageFilter::OnStaleSetVersionAttributes( void ServiceWorkerMessageFilter::OnStaleSetVersionAttributes(
...@@ -91,20 +91,21 @@ void ServiceWorkerMessageFilter::OnStaleSetVersionAttributes( ...@@ -91,20 +91,21 @@ void ServiceWorkerMessageFilter::OnStaleSetVersionAttributes(
int registration_handle_id, int registration_handle_id,
int changed_mask, int changed_mask,
const ServiceWorkerVersionAttributes& attributes) { const ServiceWorkerVersionAttributes& attributes) {
SendServiceWorkerObjectDestroyed(thread_safe_sender_, SendServiceWorkerObjectDestroyed(thread_safe_sender_.get(),
attributes.installing.handle_id); attributes.installing.handle_id);
SendServiceWorkerObjectDestroyed(thread_safe_sender_, SendServiceWorkerObjectDestroyed(thread_safe_sender_.get(),
attributes.waiting.handle_id); attributes.waiting.handle_id);
SendServiceWorkerObjectDestroyed(thread_safe_sender_, SendServiceWorkerObjectDestroyed(thread_safe_sender_.get(),
attributes.active.handle_id); attributes.active.handle_id);
SendRegistrationObjectDestroyed(thread_safe_sender_, registration_handle_id); SendRegistrationObjectDestroyed(thread_safe_sender_.get(),
registration_handle_id);
} }
void ServiceWorkerMessageFilter::OnStaleSetControllerServiceWorker( void ServiceWorkerMessageFilter::OnStaleSetControllerServiceWorker(
int thread_id, int thread_id,
int provider_id, int provider_id,
const ServiceWorkerObjectInfo& info) { const ServiceWorkerObjectInfo& info) {
SendServiceWorkerObjectDestroyed(thread_safe_sender_, info.handle_id); SendServiceWorkerObjectDestroyed(thread_safe_sender_.get(), info.handle_id);
} }
} // namespace content } // namespace content
...@@ -24,7 +24,7 @@ ServiceWorkerProviderContext::ServiceWorkerProviderContext(int provider_id) ...@@ -24,7 +24,7 @@ ServiceWorkerProviderContext::ServiceWorkerProviderContext(int provider_id)
thread_safe_sender_ = ChildThread::current()->thread_safe_sender(); thread_safe_sender_ = ChildThread::current()->thread_safe_sender();
ServiceWorkerDispatcher* dispatcher = ServiceWorkerDispatcher* dispatcher =
ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance(
thread_safe_sender_); thread_safe_sender_.get());
DCHECK(dispatcher); DCHECK(dispatcher);
dispatcher->AddProviderContext(this); dispatcher->AddProviderContext(this);
} }
...@@ -83,21 +83,24 @@ void ServiceWorkerProviderContext::OnSetInstallingServiceWorker( ...@@ -83,21 +83,24 @@ void ServiceWorkerProviderContext::OnSetInstallingServiceWorker(
int provider_id, int provider_id,
const ServiceWorkerObjectInfo& info) { const ServiceWorkerObjectInfo& info) {
DCHECK_EQ(provider_id_, provider_id); DCHECK_EQ(provider_id_, provider_id);
installing_ = ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_); installing_ =
ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get());
} }
void ServiceWorkerProviderContext::OnSetWaitingServiceWorker( void ServiceWorkerProviderContext::OnSetWaitingServiceWorker(
int provider_id, int provider_id,
const ServiceWorkerObjectInfo& info) { const ServiceWorkerObjectInfo& info) {
DCHECK_EQ(provider_id_, provider_id); DCHECK_EQ(provider_id_, provider_id);
waiting_ = ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_); waiting_ =
ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get());
} }
void ServiceWorkerProviderContext::OnSetActiveServiceWorker( void ServiceWorkerProviderContext::OnSetActiveServiceWorker(
int provider_id, int provider_id,
const ServiceWorkerObjectInfo& info) { const ServiceWorkerObjectInfo& info) {
DCHECK_EQ(provider_id_, provider_id); DCHECK_EQ(provider_id_, provider_id);
active_ = ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_); active_ =
ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get());
} }
void ServiceWorkerProviderContext::OnSetControllerServiceWorker( void ServiceWorkerProviderContext::OnSetControllerServiceWorker(
...@@ -107,7 +110,8 @@ void ServiceWorkerProviderContext::OnSetControllerServiceWorker( ...@@ -107,7 +110,8 @@ void ServiceWorkerProviderContext::OnSetControllerServiceWorker(
// This context is is the primary owner of this handle, keeps the // This context is is the primary owner of this handle, keeps the
// initial reference until it goes away. // initial reference until it goes away.
controller_ = ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_); controller_ =
ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get());
// TODO(kinuko): We can forward the message to other threads here // TODO(kinuko): We can forward the message to other threads here
// when we support navigator.serviceWorker in dedicated workers. // when we support navigator.serviceWorker in dedicated workers.
......
...@@ -33,7 +33,7 @@ ServiceWorkerRegistrationHandleReference( ...@@ -33,7 +33,7 @@ ServiceWorkerRegistrationHandleReference(
: info_(info), : info_(info),
sender_(sender) { sender_(sender) {
DCHECK_NE(kInvalidServiceWorkerRegistrationHandleId, info_.handle_id); DCHECK_NE(kInvalidServiceWorkerRegistrationHandleId, info_.handle_id);
DCHECK(sender_); DCHECK(sender_.get());
if (increment_ref_in_ctor) if (increment_ref_in_ctor)
return; return;
sender_->Send( sender_->Send(
......
...@@ -94,7 +94,7 @@ void WebServiceWorkerProviderImpl::RemoveScriptClient() { ...@@ -94,7 +94,7 @@ void WebServiceWorkerProviderImpl::RemoveScriptClient() {
ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() { ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() {
return ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance( return ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance(
thread_safe_sender_); thread_safe_sender_.get());
} }
} // namespace content } // namespace content
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment