Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: content/browser/service_worker/service_worker_dispatcher_host.cc

Issue 1283273002: Service Worker: Change last update check location and HTTP cache bypass rule (2/2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Do not store max-age to database. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_dispatcher_host.h" 5 #include "content/browser/service_worker/service_worker_dispatcher_host.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/profiler/scoped_tracker.h" 8 #include "base/profiler/scoped_tracker.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 if (!registration->GetNewestVersion()) { 428 if (!registration->GetNewestVersion()) {
429 // This can happen if update() is called during initial script evaluation. 429 // This can happen if update() is called during initial script evaluation.
430 // Abort the following steps according to the spec. 430 // Abort the following steps according to the spec.
431 Send(new ServiceWorkerMsg_ServiceWorkerUpdateError( 431 Send(new ServiceWorkerMsg_ServiceWorkerUpdateError(
432 thread_id, request_id, WebServiceWorkerError::ErrorTypeState, 432 thread_id, request_id, WebServiceWorkerError::ErrorTypeState,
433 base::ASCIIToUTF16(kServiceWorkerUpdateErrorPrefix) + 433 base::ASCIIToUTF16(kServiceWorkerUpdateErrorPrefix) +
434 base::ASCIIToUTF16(kInvalidStateErrorMessage))); 434 base::ASCIIToUTF16(kInvalidStateErrorMessage)));
435 return; 435 return;
436 } 436 }
437 437
438 // The spec says, "update() pings the server for an updated version of this 438 // update() does not always bypass the browser cache. It obeys the same rule
439 // script without consulting caches", so set |force_bypass_cache| to true. 439 // as other update attempts that bypasses the browser cache only when
440 // min(Cache-Control's max-age value, 86400) seconds have passed since the
441 // last update.
nhiroki 2015/08/24 07:57:51 Probably this comment should be moved to service_w
jungkees 2015/08/25 09:36:51 Agreed. I'll move the suggested comment to service
440 GetContext()->UpdateServiceWorker( 442 GetContext()->UpdateServiceWorker(
441 registration, true, /* force_bypass_cache */ 443 registration, false, /* force_bypass_cache */
442 provider_host, base::Bind(&ServiceWorkerDispatcherHost::UpdateComplete, 444 provider_host, base::Bind(&ServiceWorkerDispatcherHost::UpdateComplete,
443 this, thread_id, provider_id, request_id)); 445 this, thread_id, provider_id, request_id));
444 } 446 }
445 447
446 void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker( 448 void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker(
447 int thread_id, 449 int thread_id,
448 int request_id, 450 int request_id,
449 int provider_id, 451 int provider_id,
450 int64 registration_id) { 452 int64 registration_id) {
451 TRACE_EVENT0("ServiceWorker", 453 TRACE_EVENT0("ServiceWorker",
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 if (!handle) { 1288 if (!handle) {
1287 bad_message::ReceivedBadMessage(this, 1289 bad_message::ReceivedBadMessage(this,
1288 bad_message::SWDH_TERMINATE_BAD_HANDLE); 1290 bad_message::SWDH_TERMINATE_BAD_HANDLE);
1289 return; 1291 return;
1290 } 1292 }
1291 handle->version()->StopWorker( 1293 handle->version()->StopWorker(
1292 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); 1294 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback));
1293 } 1295 }
1294 1296
1295 } // namespace content 1297 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698