Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/service_worker/service_worker_register_job.h" | 5 #include "content/browser/service_worker/service_worker_register_job.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 void ServiceWorkerRegisterJob::OnStartWorkerFinished( | 338 void ServiceWorkerRegisterJob::OnStartWorkerFinished( |
| 339 ServiceWorkerStatusCode status) { | 339 ServiceWorkerStatusCode status) { |
| 340 if (status == SERVICE_WORKER_OK) { | 340 if (status == SERVICE_WORKER_OK) { |
| 341 InstallAndContinue(); | 341 InstallAndContinue(); |
| 342 return; | 342 return; |
| 343 } | 343 } |
| 344 | 344 |
| 345 // The updated worker is identical to the incumbent. | 345 // The updated worker is identical to the incumbent. |
| 346 if (status == SERVICE_WORKER_ERROR_EXISTS) { | 346 if (status == SERVICE_WORKER_ERROR_EXISTS) { |
| 347 // Only bump the last check time when we've bypassed the browser cache. | 347 // Only bump the last check time when we've bypassed the browser cache. |
| 348 base::TimeDelta time_since_last_check = | 348 if (new_version()->embedded_worker()->network_accessed_for_script() || |
|
nhiroki
2015/08/24 07:57:51
This could break some content_unittests?
jungkees
2015/08/25 09:36:51
Ah yes.. I found ServiceWorkerJobTest.Update_BumpL
nhiroki
2015/08/28 09:19:55
Thank you for clarifying the spec. The latest spec
jungkees
2015/09/04 12:56:57
As per the latest spec change, I moved this part t
| |
| 349 base::Time::Now() - registration()->last_update_check(); | |
| 350 if (time_since_last_check > base::TimeDelta::FromHours( | |
| 351 kServiceWorkerScriptMaxCacheAgeInHours) || | |
| 352 new_version()->force_bypass_cache_for_scripts()) { | 349 new_version()->force_bypass_cache_for_scripts()) { |
|
nhiroki
2015/08/24 07:57:51
This second condition seems no longer necessary be
jungkees
2015/08/25 09:36:51
Yes. I'll remove this second condition.
| |
| 353 registration()->set_last_update_check(base::Time::Now()); | 350 registration()->set_last_update_check(base::Time::Now()); |
| 354 context_->storage()->UpdateLastUpdateCheckTime(registration()); | 351 context_->storage()->UpdateLastUpdateCheckTime(registration()); |
| 355 } | 352 } |
| 356 | 353 |
| 357 ResolvePromise(SERVICE_WORKER_OK, std::string(), registration()); | 354 ResolvePromise(SERVICE_WORKER_OK, std::string(), registration()); |
| 358 Complete(status, "The updated worker is identical to the incumbent."); | 355 Complete(status, "The updated worker is identical to the incumbent."); |
| 359 return; | 356 return; |
| 360 } | 357 } |
| 361 | 358 |
| 362 // "If serviceWorker fails to start up..." then reject the promise with an | 359 // "If serviceWorker fails to start up..." then reject the promise with an |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 532 if (host->IsHostToRunningServiceWorker()) | 529 if (host->IsHostToRunningServiceWorker()) |
| 533 continue; | 530 continue; |
| 534 if (!ServiceWorkerUtils::ScopeMatches(registration->pattern(), | 531 if (!ServiceWorkerUtils::ScopeMatches(registration->pattern(), |
| 535 host->document_url())) | 532 host->document_url())) |
| 536 continue; | 533 continue; |
| 537 host->AddMatchingRegistration(registration); | 534 host->AddMatchingRegistration(registration); |
| 538 } | 535 } |
| 539 } | 536 } |
| 540 | 537 |
| 541 } // namespace content | 538 } // namespace content |
| OLD | NEW |