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

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

Issue 1380323002: Make registration.update() no longer force bypassing the HTTP cache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 if (!registration->GetNewestVersion()) { 430 if (!registration->GetNewestVersion()) {
431 // This can happen if update() is called during initial script evaluation. 431 // This can happen if update() is called during initial script evaluation.
432 // Abort the following steps according to the spec. 432 // Abort the following steps according to the spec.
433 Send(new ServiceWorkerMsg_ServiceWorkerUpdateError( 433 Send(new ServiceWorkerMsg_ServiceWorkerUpdateError(
434 thread_id, request_id, WebServiceWorkerError::ErrorTypeState, 434 thread_id, request_id, WebServiceWorkerError::ErrorTypeState,
435 base::ASCIIToUTF16(kServiceWorkerUpdateErrorPrefix) + 435 base::ASCIIToUTF16(kServiceWorkerUpdateErrorPrefix) +
436 base::ASCIIToUTF16(kInvalidStateErrorMessage))); 436 base::ASCIIToUTF16(kInvalidStateErrorMessage)));
437 return; 437 return;
438 } 438 }
439 439
440 // The spec says, "update() pings the server for an updated version of this
441 // script without consulting caches", so set |force_bypass_cache| to true.
442 GetContext()->UpdateServiceWorker( 440 GetContext()->UpdateServiceWorker(
443 registration, true /* force_bypass_cache */, 441 registration, false /* force_bypass_cache */,
444 false /* skip_script_comparison */, provider_host, 442 false /* skip_script_comparison */, provider_host,
445 base::Bind(&ServiceWorkerDispatcherHost::UpdateComplete, this, thread_id, 443 base::Bind(&ServiceWorkerDispatcherHost::UpdateComplete, this, thread_id,
446 provider_id, request_id)); 444 provider_id, request_id));
447 } 445 }
448 446
449 void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker( 447 void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker(
450 int thread_id, 448 int thread_id,
451 int request_id, 449 int request_id,
452 int provider_id, 450 int provider_id,
453 int64 registration_id) { 451 int64 registration_id) {
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 if (!handle) { 1292 if (!handle) {
1295 bad_message::ReceivedBadMessage(this, 1293 bad_message::ReceivedBadMessage(this,
1296 bad_message::SWDH_TERMINATE_BAD_HANDLE); 1294 bad_message::SWDH_TERMINATE_BAD_HANDLE);
1297 return; 1295 return;
1298 } 1296 }
1299 handle->version()->StopWorker( 1297 handle->version()->StopWorker(
1300 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); 1298 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback));
1301 } 1299 }
1302 1300
1303 } // namespace content 1301 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698