Chromium Code Reviews| Index: content/browser/service_worker/service_worker_storage.cc |
| diff --git a/content/browser/service_worker/service_worker_storage.cc b/content/browser/service_worker/service_worker_storage.cc |
| index 7fe900830c9308030e0719fd23069cc400e1bc6e..d6c5303a49f4fea3326ea9dbb7b115962b0475d3 100644 |
| --- a/content/browser/service_worker/service_worker_storage.cc |
| +++ b/content/browser/service_worker/service_worker_storage.cc |
| @@ -39,7 +39,7 @@ void RunSoon(const tracked_objects::Location& from_here, |
| } |
| void CompleteFindNow( |
| - const scoped_refptr<ServiceWorkerRegistration>& registration, |
| + scoped_refptr<ServiceWorkerRegistration> registration, |
| ServiceWorkerStatusCode status, |
| const ServiceWorkerStorage::FindRegistrationCallback& callback) { |
| if (registration && registration->is_deleted()) { |
| @@ -47,16 +47,16 @@ void CompleteFindNow( |
| callback.Run(SERVICE_WORKER_ERROR_NOT_FOUND, nullptr); |
| return; |
| } |
| - callback.Run(status, registration); |
| + callback.Run(status, std::move(registration)); |
| } |
| void CompleteFindSoon( |
| const tracked_objects::Location& from_here, |
| - const scoped_refptr<ServiceWorkerRegistration>& registration, |
| + scoped_refptr<ServiceWorkerRegistration> registration, |
| ServiceWorkerStatusCode status, |
| const ServiceWorkerStorage::FindRegistrationCallback& callback) { |
| - RunSoon(from_here, |
| - base::Bind(&CompleteFindNow, registration, status, callback)); |
| + RunSoon(from_here, base::Bind(&CompleteFindNow, std::move(registration), |
| + status, callback)); |
| } |
| const base::FilePath::CharType kDatabaseName[] = |
| @@ -167,9 +167,7 @@ void ServiceWorkerStorage::FindRegistrationForDocument( |
| TRACE_EVENT_SCOPE_THREAD, |
| "URL", document_url.spec(), |
| "Status", ServiceWorkerStatusToString(status)); |
| - CompleteFindNow(installing_registration, |
| - status, |
| - callback); |
| + CompleteFindNow(std::move(installing_registration), status, callback); |
| return; |
| } |
| @@ -214,7 +212,7 @@ void ServiceWorkerStorage::FindRegistrationForPattern( |
| // Look for something currently being installed. |
| scoped_refptr<ServiceWorkerRegistration> installing_registration = |
| FindInstallingRegistrationForPattern(scope); |
| - CompleteFindSoon(FROM_HERE, installing_registration, |
| + CompleteFindSoon(FROM_HERE, std::move(installing_registration), |
| installing_registration ? SERVICE_WORKER_OK |
|
nhiroki
2016/07/25 09:15:40
This ternary operation may be evaluated after the
horo
2016/07/25 09:32:01
Done.
|
| : SERVICE_WORKER_ERROR_NOT_FOUND, |
| callback); |
| @@ -277,7 +275,7 @@ void ServiceWorkerStorage::FindRegistrationForId( |
| scoped_refptr<ServiceWorkerRegistration> registration = |
| context_->GetLiveRegistration(registration_id); |
| if (registration) { |
| - CompleteFindNow(registration, SERVICE_WORKER_OK, callback); |
| + CompleteFindNow(std::move(registration), SERVICE_WORKER_OK, callback); |
| return; |
| } |
| @@ -896,7 +894,7 @@ void ServiceWorkerStorage::DidFindRegistrationForDocument( |
| ServiceWorkerStatusCode installing_status = |
| installing_registration ? SERVICE_WORKER_OK |
| : SERVICE_WORKER_ERROR_NOT_FOUND; |
| - callback.Run(installing_status, installing_registration); |
| + callback.Run(installing_status, std::move(installing_registration)); |
| TRACE_EVENT_ASYNC_END2( |
| "ServiceWorker", |
| "ServiceWorkerStorage::FindRegistrationForDocument", |
| @@ -933,9 +931,10 @@ void ServiceWorkerStorage::DidFindRegistrationForPattern( |
| if (status == ServiceWorkerDatabase::STATUS_ERROR_NOT_FOUND) { |
| scoped_refptr<ServiceWorkerRegistration> installing_registration = |
| FindInstallingRegistrationForPattern(scope); |
| - callback.Run(installing_registration ? SERVICE_WORKER_OK |
| - : SERVICE_WORKER_ERROR_NOT_FOUND, |
| - installing_registration); |
| + ServiceWorkerStatusCode installing_status = |
| + installing_registration ? SERVICE_WORKER_OK |
| + : SERVICE_WORKER_ERROR_NOT_FOUND; |
| + callback.Run(installing_status, std::move(installing_registration)); |
| return; |
| } |
| @@ -973,7 +972,7 @@ void ServiceWorkerStorage::ReturnFoundRegistration( |
| DCHECK(!resources.empty()); |
| scoped_refptr<ServiceWorkerRegistration> registration = |
| GetOrCreateRegistration(data, resources); |
| - CompleteFindNow(registration, SERVICE_WORKER_OK, callback); |
| + CompleteFindNow(std::move(registration), SERVICE_WORKER_OK, callback); |
| } |
| void ServiceWorkerStorage::DidGetRegistrations( |
| @@ -1012,7 +1011,7 @@ void ServiceWorkerStorage::DidGetRegistrations( |
| } |
| } |
| - callback.Run(SERVICE_WORKER_OK, registrations); |
| + callback.Run(SERVICE_WORKER_OK, std::move(registrations)); |
| } |
| void ServiceWorkerStorage::DidGetRegistrationsInfos( |