Chromium Code Reviews| Index: content/browser/service_worker/service_worker_register_job.cc |
| diff --git a/content/browser/service_worker/service_worker_register_job.cc b/content/browser/service_worker/service_worker_register_job.cc |
| index 60dc34b42a1a9f823e7b994bd18abcfc19aa3dfd..2cfe701cb99ddffe360e45f08d7cac450110eed1 100644 |
| --- a/content/browser/service_worker/service_worker_register_job.cc |
| +++ b/content/browser/service_worker/service_worker_register_job.cc |
| @@ -340,6 +340,13 @@ void ServiceWorkerRegisterJob::UpdateAndContinue() { |
| void ServiceWorkerRegisterJob::OnStartWorkerFinished( |
| ServiceWorkerStatusCode status) { |
| + // Only bump the last check time when we've bypassed the browser cache. |
| + if (new_version()->embedded_worker()->network_accessed_for_script() || |
| + new_version()->force_bypass_cache_for_scripts()) { |
| + registration()->set_last_update_check(base::Time::Now()); |
| + context_->storage()->UpdateLastUpdateCheckTime(registration()); |
|
michaeln
2015/11/09 23:19:10
This block is reachable for first time registratio
jungkees
2015/11/10 02:45:17
Executing this part of the code for the first time
falken
2015/12/02 09:27:39
Michael is saying that for first time registration
jungkees
2015/12/04 11:46:38
Having inspected the code sequence for a first tim
falken
2015/12/07 03:53:34
Right, it's a no-op but it requires reading disk w
jungkees
2015/12/07 07:02:09
Great. I made it only UPDATE_JOBs write to disk.
|
| + } |
| + |
| if (status == SERVICE_WORKER_OK) { |
| InstallAndContinue(); |
| return; |
| @@ -347,16 +354,6 @@ void ServiceWorkerRegisterJob::OnStartWorkerFinished( |
| // The updated worker is identical to the incumbent. |
| if (status == SERVICE_WORKER_ERROR_EXISTS) { |
| - // Only bump the last check time when we've bypassed the browser cache. |
| - base::TimeDelta time_since_last_check = |
| - base::Time::Now() - registration()->last_update_check(); |
| - if (time_since_last_check > base::TimeDelta::FromHours( |
| - kServiceWorkerScriptMaxCacheAgeInHours) || |
| - new_version()->force_bypass_cache_for_scripts()) { |
| - registration()->set_last_update_check(base::Time::Now()); |
| - context_->storage()->UpdateLastUpdateCheckTime(registration()); |
| - } |
| - |
| ResolvePromise(SERVICE_WORKER_OK, std::string(), registration()); |
| Complete(status, "The updated worker is identical to the incumbent."); |
| return; |
| @@ -421,7 +418,6 @@ void ServiceWorkerRegisterJob::OnInstallFinished( |
| } |
| SetPhase(STORE); |
| - registration()->set_last_update_check(base::Time::Now()); |
| context_->storage()->StoreRegistration( |
| registration(), |
| new_version(), |