| 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_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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 if (!registration->GetNewestVersion()) { | 421 if (!registration->GetNewestVersion()) { |
| 422 // This can happen if update() is called during initial script evaluation. | 422 // This can happen if update() is called during initial script evaluation. |
| 423 // Abort the following steps according to the spec. | 423 // Abort the following steps according to the spec. |
| 424 Send(new ServiceWorkerMsg_ServiceWorkerUpdateError( | 424 Send(new ServiceWorkerMsg_ServiceWorkerUpdateError( |
| 425 thread_id, request_id, WebServiceWorkerError::ErrorTypeState, | 425 thread_id, request_id, WebServiceWorkerError::ErrorTypeState, |
| 426 base::ASCIIToUTF16(kServiceWorkerUpdateErrorPrefix) + | 426 base::ASCIIToUTF16(kServiceWorkerUpdateErrorPrefix) + |
| 427 base::ASCIIToUTF16(kInvalidStateErrorMessage))); | 427 base::ASCIIToUTF16(kInvalidStateErrorMessage))); |
| 428 return; | 428 return; |
| 429 } | 429 } |
| 430 | 430 |
| 431 // The spec says, "update() pings the server for an updated version of this | |
| 432 // script without consulting caches", so set |force_bypass_cache| to true. | |
| 433 GetContext()->UpdateServiceWorker( | 431 GetContext()->UpdateServiceWorker( |
| 434 registration, true, /* force_bypass_cache */ | 432 registration, false, /* force_bypass_cache */ |
| 435 provider_host, base::Bind(&ServiceWorkerDispatcherHost::UpdateComplete, | 433 provider_host, base::Bind(&ServiceWorkerDispatcherHost::UpdateComplete, |
| 436 this, thread_id, provider_id, request_id)); | 434 this, thread_id, provider_id, request_id)); |
| 437 } | 435 } |
| 438 | 436 |
| 439 void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker( | 437 void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker( |
| 440 int thread_id, | 438 int thread_id, |
| 441 int request_id, | 439 int request_id, |
| 442 int provider_id, | 440 int provider_id, |
| 443 int64 registration_id) { | 441 int64 registration_id) { |
| 444 TRACE_EVENT0("ServiceWorker", | 442 TRACE_EVENT0("ServiceWorker", |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1258 if (!handle) { | 1256 if (!handle) { |
| 1259 bad_message::ReceivedBadMessage(this, | 1257 bad_message::ReceivedBadMessage(this, |
| 1260 bad_message::SWDH_TERMINATE_BAD_HANDLE); | 1258 bad_message::SWDH_TERMINATE_BAD_HANDLE); |
| 1261 return; | 1259 return; |
| 1262 } | 1260 } |
| 1263 handle->version()->StopWorker( | 1261 handle->version()->StopWorker( |
| 1264 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); | 1262 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); |
| 1265 } | 1263 } |
| 1266 | 1264 |
| 1267 } // namespace content | 1265 } // namespace content |
| OLD | NEW |