Commit 62c7cf84 authored by dcheng's avatar dcheng Committed by Commit bot

Service worker fixups for scoped_refptr operator T* removal.

BUG=110610

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

Cr-Commit-Position: refs/heads/master@{#292595}
parent 9d1dd593
...@@ -35,7 +35,7 @@ namespace content { ...@@ -35,7 +35,7 @@ namespace content {
scoped_ptr<ServiceWorkerCacheStorageManager> scoped_ptr<ServiceWorkerCacheStorageManager>
ServiceWorkerCacheStorageManager::Create( ServiceWorkerCacheStorageManager::Create(
const base::FilePath& path, const base::FilePath& path,
base::SequencedTaskRunner* cache_task_runner) { const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner) {
base::FilePath root_path = path; base::FilePath root_path = path;
if (!path.empty()) { if (!path.empty()) {
root_path = path.Append(ServiceWorkerContextCore::kServiceWorkerDirectory) root_path = path.Append(ServiceWorkerContextCore::kServiceWorkerDirectory)
...@@ -138,7 +138,7 @@ void ServiceWorkerCacheStorageManager::SetBlobParametersForCache( ...@@ -138,7 +138,7 @@ void ServiceWorkerCacheStorageManager::SetBlobParametersForCache(
ServiceWorkerCacheStorageManager::ServiceWorkerCacheStorageManager( ServiceWorkerCacheStorageManager::ServiceWorkerCacheStorageManager(
const base::FilePath& path, const base::FilePath& path,
base::SequencedTaskRunner* cache_task_runner) const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner)
: root_path_(path), : root_path_(path),
cache_task_runner_(cache_task_runner), cache_task_runner_(cache_task_runner),
request_context_(NULL) { request_context_(NULL) {
......
...@@ -36,7 +36,7 @@ class CONTENT_EXPORT ServiceWorkerCacheStorageManager { ...@@ -36,7 +36,7 @@ class CONTENT_EXPORT ServiceWorkerCacheStorageManager {
public: public:
static scoped_ptr<ServiceWorkerCacheStorageManager> Create( static scoped_ptr<ServiceWorkerCacheStorageManager> Create(
const base::FilePath& path, const base::FilePath& path,
base::SequencedTaskRunner* cache_task_runner); const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner);
static scoped_ptr<ServiceWorkerCacheStorageManager> Create( static scoped_ptr<ServiceWorkerCacheStorageManager> Create(
ServiceWorkerCacheStorageManager* old_manager); ServiceWorkerCacheStorageManager* old_manager);
...@@ -78,7 +78,7 @@ class CONTENT_EXPORT ServiceWorkerCacheStorageManager { ...@@ -78,7 +78,7 @@ class CONTENT_EXPORT ServiceWorkerCacheStorageManager {
ServiceWorkerCacheStorageManager( ServiceWorkerCacheStorageManager(
const base::FilePath& path, const base::FilePath& path,
base::SequencedTaskRunner* cache_task_runner); const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner);
// The returned ServiceWorkerCacheStorage* is owned by // The returned ServiceWorkerCacheStorage* is owned by
// service_worker_cache_storages_. // service_worker_cache_storages_.
...@@ -92,7 +92,7 @@ class CONTENT_EXPORT ServiceWorkerCacheStorageManager { ...@@ -92,7 +92,7 @@ class CONTENT_EXPORT ServiceWorkerCacheStorageManager {
return blob_context_; return blob_context_;
} }
base::FilePath root_path() const { return root_path_; } base::FilePath root_path() const { return root_path_; }
scoped_refptr<base::SequencedTaskRunner> cache_task_runner() const { const scoped_refptr<base::SequencedTaskRunner>& cache_task_runner() const {
return cache_task_runner_; return cache_task_runner_;
} }
......
...@@ -99,7 +99,8 @@ class ServiceWorkerCacheTest : public testing::Test { ...@@ -99,7 +99,8 @@ class ServiceWorkerCacheTest : public testing::Test {
new storage::BlobData("blob-id:myblob")); new storage::BlobData("blob-id:myblob"));
blob_data->AppendData(expected_blob_data_); blob_data->AppendData(expected_blob_data_);
blob_handle_ = blob_storage_context->context()->AddFinishedBlob(blob_data); blob_handle_ =
blob_storage_context->context()->AddFinishedBlob(blob_data.get());
body_response_.reset( body_response_.reset(
new ServiceWorkerResponse(GURL("http://example.com/body.html"), new ServiceWorkerResponse(GURL("http://example.com/body.html"),
......
...@@ -74,7 +74,7 @@ void ServiceWorkerProviderHost::UpdatePotentialControllees( ...@@ -74,7 +74,7 @@ void ServiceWorkerProviderHost::UpdatePotentialControllees(
ServiceWorkerVersion* active_version) { ServiceWorkerVersion* active_version) {
if (installing_version != installing_version_.get()) { if (installing_version != installing_version_.get()) {
scoped_refptr<ServiceWorkerVersion> previous_version = installing_version_; scoped_refptr<ServiceWorkerVersion> previous_version = installing_version_;
if (previous_version) if (previous_version.get())
previous_version->RemovePotentialControllee(this); previous_version->RemovePotentialControllee(this);
if (installing_version) if (installing_version)
installing_version->AddPotentialControllee(this); installing_version->AddPotentialControllee(this);
...@@ -83,7 +83,7 @@ void ServiceWorkerProviderHost::UpdatePotentialControllees( ...@@ -83,7 +83,7 @@ void ServiceWorkerProviderHost::UpdatePotentialControllees(
if (waiting_version != waiting_version_.get()) { if (waiting_version != waiting_version_.get()) {
scoped_refptr<ServiceWorkerVersion> previous_version = waiting_version_; scoped_refptr<ServiceWorkerVersion> previous_version = waiting_version_;
if (previous_version) if (previous_version.get())
previous_version->RemovePotentialControllee(this); previous_version->RemovePotentialControllee(this);
if (waiting_version) if (waiting_version)
waiting_version->AddPotentialControllee(this); waiting_version->AddPotentialControllee(this);
...@@ -92,7 +92,7 @@ void ServiceWorkerProviderHost::UpdatePotentialControllees( ...@@ -92,7 +92,7 @@ void ServiceWorkerProviderHost::UpdatePotentialControllees(
if (active_version != active_version_.get()) { if (active_version != active_version_.get()) {
scoped_refptr<ServiceWorkerVersion> previous_version = active_version_; scoped_refptr<ServiceWorkerVersion> previous_version = active_version_;
if (previous_version) if (previous_version.get())
previous_version->RemovePotentialControllee(this); previous_version->RemovePotentialControllee(this);
if (active_version) if (active_version)
active_version->AddPotentialControllee(this); active_version->AddPotentialControllee(this);
......
...@@ -117,7 +117,7 @@ ServiceWorkerRegisterJob::Internal::Internal() {} ...@@ -117,7 +117,7 @@ ServiceWorkerRegisterJob::Internal::Internal() {}
ServiceWorkerRegisterJob::Internal::~Internal() {} ServiceWorkerRegisterJob::Internal::~Internal() {}
void ServiceWorkerRegisterJob::set_registration( void ServiceWorkerRegisterJob::set_registration(
ServiceWorkerRegistration* registration) { const scoped_refptr<ServiceWorkerRegistration>& registration) {
DCHECK(phase_ == START || phase_ == REGISTER) << phase_; DCHECK(phase_ == START || phase_ == REGISTER) << phase_;
DCHECK(!internal_.registration.get()); DCHECK(!internal_.registration.get());
internal_.registration = registration; internal_.registration = registration;
...@@ -141,7 +141,7 @@ ServiceWorkerVersion* ServiceWorkerRegisterJob::new_version() { ...@@ -141,7 +141,7 @@ ServiceWorkerVersion* ServiceWorkerRegisterJob::new_version() {
} }
void ServiceWorkerRegisterJob::set_uninstalling_registration( void ServiceWorkerRegisterJob::set_uninstalling_registration(
ServiceWorkerRegistration* registration) { const scoped_refptr<ServiceWorkerRegistration>& registration) {
DCHECK_EQ(phase_, WAIT_FOR_UNINSTALL); DCHECK_EQ(phase_, WAIT_FOR_UNINSTALL);
internal_.uninstalling_registration = registration; internal_.uninstalling_registration = registration;
} }
...@@ -149,7 +149,7 @@ void ServiceWorkerRegisterJob::set_uninstalling_registration( ...@@ -149,7 +149,7 @@ void ServiceWorkerRegisterJob::set_uninstalling_registration(
ServiceWorkerRegistration* ServiceWorkerRegistration*
ServiceWorkerRegisterJob::uninstalling_registration() { ServiceWorkerRegisterJob::uninstalling_registration() {
DCHECK_EQ(phase_, WAIT_FOR_UNINSTALL); DCHECK_EQ(phase_, WAIT_FOR_UNINSTALL);
return internal_.uninstalling_registration; return internal_.uninstalling_registration.get();
} }
void ServiceWorkerRegisterJob::SetPhase(Phase phase) { void ServiceWorkerRegisterJob::SetPhase(Phase phase) {
...@@ -297,8 +297,9 @@ void ServiceWorkerRegisterJob::ContinueWithRegistrationForSameScriptUrl( ...@@ -297,8 +297,9 @@ void ServiceWorkerRegisterJob::ContinueWithRegistrationForSameScriptUrl(
return; return;
} }
ResolvePromise( ResolvePromise(status,
status, existing_registration, existing_registration->active_version()); existing_registration.get(),
existing_registration->active_version());
Complete(SERVICE_WORKER_OK); Complete(SERVICE_WORKER_OK);
} }
......
...@@ -99,11 +99,13 @@ class ServiceWorkerRegisterJob : public ServiceWorkerRegisterJobBase, ...@@ -99,11 +99,13 @@ class ServiceWorkerRegisterJob : public ServiceWorkerRegisterJobBase,
scoped_refptr<ServiceWorkerRegistration> uninstalling_registration; scoped_refptr<ServiceWorkerRegistration> uninstalling_registration;
}; };
void set_registration(ServiceWorkerRegistration* registration); void set_registration(
const scoped_refptr<ServiceWorkerRegistration>& registration);
ServiceWorkerRegistration* registration(); ServiceWorkerRegistration* registration();
void set_new_version(ServiceWorkerVersion* version); void set_new_version(ServiceWorkerVersion* version);
ServiceWorkerVersion* new_version(); ServiceWorkerVersion* new_version();
void set_uninstalling_registration(ServiceWorkerRegistration* registration); void set_uninstalling_registration(
const scoped_refptr<ServiceWorkerRegistration>& registration);
ServiceWorkerRegistration* uninstalling_registration(); ServiceWorkerRegistration* uninstalling_registration();
void SetPhase(Phase phase); void SetPhase(Phase phase);
......
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