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 {
int rv = entry_->WriteData(INDEX_RESPONSE_BODY,
cache_entry_offset_,
buffer_,
buffer_.get(),
bytes_read,
cache_write_callback,
true /* truncate */);
......@@ -280,7 +280,7 @@ void PutDidCreateEntry(ServiceWorkerFetchRequest* request,
rv = tmp_entry_ptr->WriteData(INDEX_HEADERS,
0 /* offset */,
buffer,
buffer.get(),
buffer->size(),
write_headers_callback,
true /* truncate */);
......@@ -491,7 +491,7 @@ void MatchDidReadResponseBodyData(
int total_bytes_read = response_context->total_bytes_read;
// 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();
net::CompletionCallback read_callback =
......
......@@ -1123,21 +1123,21 @@ TEST_F(ServiceWorkerJobTest, Update_NewestVersionChanged) {
ServiceWorkerVersion* active_version = registration->active_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.
scoped_refptr<ServiceWorkerVersion> version =
new ServiceWorkerVersion(registration,
new ServiceWorkerVersion(registration.get(),
GURL("http://www.example.com/new_worker.js"),
2L /* dummy version id */,
helper_->context()->AsWeakPtr());
registration->SetWaitingVersion(version);
registration->SetWaitingVersion(version.get());
base::RunLoop().RunUntilIdle();
// Verify the registration was not modified by the Update.
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());
}
......@@ -1166,7 +1166,7 @@ TEST_F(ServiceWorkerJobTest, Update_UninstallingRegistration) {
SaveUnregistration(SERVICE_WORKER_OK, &called));
// Update should abort after it starts and sees uninstalling.
job_coordinator()->Update(registration);
job_coordinator()->Update(registration.get());
EXPECT_FALSE(called);
base::RunLoop().RunUntilIdle();
......
......@@ -190,17 +190,18 @@ WebServiceWorkerImpl* ServiceWorkerDispatcher::GetServiceWorker(
if (adopt_handle) {
// We are instructed to adopt a handle but we already have one, so
// adopt and destroy a handle ref.
ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_);
ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get());
}
return existing_worker->second;
}
scoped_ptr<ServiceWorkerHandleReference> handle_ref =
adopt_handle
? ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_)
: ServiceWorkerHandleReference::Create(info, thread_safe_sender_);
? ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get())
: ServiceWorkerHandleReference::Create(info,
thread_safe_sender_.get());
// WebServiceWorkerImpl constructor calls AddServiceWorker.
return new WebServiceWorkerImpl(handle_ref.Pass(), thread_safe_sender_);
return new WebServiceWorkerImpl(handle_ref.Pass(), thread_safe_sender_.get());
}
WebServiceWorkerRegistrationImpl*
......@@ -218,17 +219,16 @@ ServiceWorkerDispatcher::GetServiceWorkerRegistration(
// We are instructed to adopt a handle but we already have one, so
// adopt and destroy a handle ref.
ServiceWorkerRegistrationHandleReference::Adopt(
info, thread_safe_sender_);
info, thread_safe_sender_.get());
}
return existing_registration->second;
}
scoped_ptr<ServiceWorkerRegistrationHandleReference> handle_ref =
adopt_handle
? ServiceWorkerRegistrationHandleReference::Adopt(
info, thread_safe_sender_)
: ServiceWorkerRegistrationHandleReference::Create(
info, thread_safe_sender_);
adopt_handle ? ServiceWorkerRegistrationHandleReference::Adopt(
info, thread_safe_sender_.get())
: ServiceWorkerRegistrationHandleReference::Create(
info, thread_safe_sender_.get());
// WebServiceWorkerRegistrationImpl constructor calls
// AddServiceWorkerRegistration.
......
......@@ -82,7 +82,7 @@ void ServiceWorkerMessageFilter::OnStaleRegistered(
int thread_id,
int request_id,
const ServiceWorkerRegistrationObjectInfo& info) {
SendRegistrationObjectDestroyed(thread_safe_sender_, info.handle_id);
SendRegistrationObjectDestroyed(thread_safe_sender_.get(), info.handle_id);
}
void ServiceWorkerMessageFilter::OnStaleSetVersionAttributes(
......@@ -91,20 +91,21 @@ void ServiceWorkerMessageFilter::OnStaleSetVersionAttributes(
int registration_handle_id,
int changed_mask,
const ServiceWorkerVersionAttributes& attributes) {
SendServiceWorkerObjectDestroyed(thread_safe_sender_,
SendServiceWorkerObjectDestroyed(thread_safe_sender_.get(),
attributes.installing.handle_id);
SendServiceWorkerObjectDestroyed(thread_safe_sender_,
SendServiceWorkerObjectDestroyed(thread_safe_sender_.get(),
attributes.waiting.handle_id);
SendServiceWorkerObjectDestroyed(thread_safe_sender_,
SendServiceWorkerObjectDestroyed(thread_safe_sender_.get(),
attributes.active.handle_id);
SendRegistrationObjectDestroyed(thread_safe_sender_, registration_handle_id);
SendRegistrationObjectDestroyed(thread_safe_sender_.get(),
registration_handle_id);
}
void ServiceWorkerMessageFilter::OnStaleSetControllerServiceWorker(
int thread_id,
int provider_id,
const ServiceWorkerObjectInfo& info) {
SendServiceWorkerObjectDestroyed(thread_safe_sender_, info.handle_id);
SendServiceWorkerObjectDestroyed(thread_safe_sender_.get(), info.handle_id);
}
} // namespace content
......@@ -24,7 +24,7 @@ ServiceWorkerProviderContext::ServiceWorkerProviderContext(int provider_id)
thread_safe_sender_ = ChildThread::current()->thread_safe_sender();
ServiceWorkerDispatcher* dispatcher =
ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance(
thread_safe_sender_);
thread_safe_sender_.get());
DCHECK(dispatcher);
dispatcher->AddProviderContext(this);
}
......@@ -83,21 +83,24 @@ void ServiceWorkerProviderContext::OnSetInstallingServiceWorker(
int provider_id,
const ServiceWorkerObjectInfo& info) {
DCHECK_EQ(provider_id_, provider_id);
installing_ = ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_);
installing_ =
ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get());
}
void ServiceWorkerProviderContext::OnSetWaitingServiceWorker(
int provider_id,
const ServiceWorkerObjectInfo& info) {
DCHECK_EQ(provider_id_, provider_id);
waiting_ = ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_);
waiting_ =
ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get());
}
void ServiceWorkerProviderContext::OnSetActiveServiceWorker(
int provider_id,
const ServiceWorkerObjectInfo& info) {
DCHECK_EQ(provider_id_, provider_id);
active_ = ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_);
active_ =
ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get());
}
void ServiceWorkerProviderContext::OnSetControllerServiceWorker(
......@@ -107,7 +110,8 @@ void ServiceWorkerProviderContext::OnSetControllerServiceWorker(
// This context is is the primary owner of this handle, keeps the
// 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
// when we support navigator.serviceWorker in dedicated workers.
......
......@@ -33,7 +33,7 @@ ServiceWorkerRegistrationHandleReference(
: info_(info),
sender_(sender) {
DCHECK_NE(kInvalidServiceWorkerRegistrationHandleId, info_.handle_id);
DCHECK(sender_);
DCHECK(sender_.get());
if (increment_ref_in_ctor)
return;
sender_->Send(
......
......@@ -94,7 +94,7 @@ void WebServiceWorkerProviderImpl::RemoveScriptClient() {
ServiceWorkerDispatcher* WebServiceWorkerProviderImpl::GetDispatcher() {
return ServiceWorkerDispatcher::GetOrCreateThreadSpecificInstance(
thread_safe_sender_);
thread_safe_sender_.get());
}
} // 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