Chromium Code Reviews| Index: content/browser/service_worker/service_worker_context_request_handler.cc |
| diff --git a/content/browser/service_worker/service_worker_context_request_handler.cc b/content/browser/service_worker/service_worker_context_request_handler.cc |
| index 45248930d18cd3be34713d547fdf5ce6356b4532..1da3233668c4bbc4ea9442e91779c09a3cac118c 100644 |
| --- a/content/browser/service_worker/service_worker_context_request_handler.cc |
| +++ b/content/browser/service_worker/service_worker_context_request_handler.cc |
| @@ -10,6 +10,7 @@ |
| #include "content/browser/service_worker/service_worker_storage.h" |
| #include "content/browser/service_worker/service_worker_version.h" |
| #include "content/browser/service_worker/service_worker_write_to_cache_job.h" |
| +#include "net/base/load_flags.h" |
| #include "net/url_request/url_request.h" |
| namespace content { |
| @@ -51,14 +52,28 @@ net::URLRequestJob* ServiceWorkerContextRequestHandler::MaybeCreateJob( |
| } |
| if (ShouldAddToScriptCache(request->url())) { |
| + ServiceWorkerRegistration* registration = |
| + context_->GetLiveRegistration(version_->registration_id()); |
| + DCHECK(registration); // We're registering or updating so must be there. |
| + |
| int64 response_id = context_->storage()->NewResourceId(); |
| if (response_id == kInvalidServiceWorkerResponseId) |
| return NULL; |
| + |
| + // Bypass the browser cache for initial installs and update |
| + // checks after 24 hours have passed. |
|
michaeln
2014/08/15 01:39:59
There's a problem with this right here. I think we
michaeln
2014/08/15 02:53:24
I take that back, when the main script is found to
|
| + int extra_load_flags = 0; |
| + base::TimeDelta time_since_last_check = |
| + base::Time::Now() - registration->last_update_check(); |
| + if (time_since_last_check > base::TimeDelta::FromHours(24)) |
| + extra_load_flags = net::LOAD_BYPASS_CACHE; |
| + |
| return new ServiceWorkerWriteToCacheJob(request, |
| network_delegate, |
| resource_type_, |
| context_, |
| version_, |
| + extra_load_flags, |
| response_id); |
| } |