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_version.h" | 5 #include "content/browser/service_worker/service_worker_version.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "content/browser/service_worker/embedded_worker_instance.h" | 10 #include "content/browser/service_worker/embedded_worker_instance.h" |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 } | 408 } |
409 | 409 |
410 void ServiceWorkerVersion::Doom() { | 410 void ServiceWorkerVersion::Doom() { |
411 if (is_doomed_) | 411 if (is_doomed_) |
412 return; | 412 return; |
413 is_doomed_ = true; | 413 is_doomed_ = true; |
414 if (!HasControllee()) | 414 if (!HasControllee()) |
415 DoomInternal(); | 415 DoomInternal(); |
416 } | 416 } |
417 | 417 |
| 418 void ServiceWorkerVersion::NotifyStartWorkerURLRequestError( |
| 419 ServiceWorkerStatusCode status) { |
| 420 DCHECK(status != SERVICE_WORKER_OK); |
| 421 RunCallbacks(this, &start_callbacks_, status); |
| 422 } |
| 423 |
418 void ServiceWorkerVersion::OnStarted() { | 424 void ServiceWorkerVersion::OnStarted() { |
419 DCHECK_EQ(RUNNING, running_status()); | 425 DCHECK_EQ(RUNNING, running_status()); |
420 if (status() == ACTIVATED && !HasControllee()) | 426 if (status() == ACTIVATED && !HasControllee()) |
421 ScheduleStopWorker(); | 427 ScheduleStopWorker(); |
422 // Fire all start callbacks. | 428 // Fire all start callbacks. |
423 RunCallbacks(this, &start_callbacks_, SERVICE_WORKER_OK); | 429 RunCallbacks(this, &start_callbacks_, SERVICE_WORKER_OK); |
424 FOR_EACH_OBSERVER(Listener, listeners_, OnWorkerStarted(this)); | 430 FOR_EACH_OBSERVER(Listener, listeners_, OnWorkerStarted(this)); |
425 } | 431 } |
426 | 432 |
427 void ServiceWorkerVersion::OnStopped() { | 433 void ServiceWorkerVersion::OnStopped() { |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 SetStatus(REDUNDANT); | 695 SetStatus(REDUNDANT); |
690 StopWorker(base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); | 696 StopWorker(base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); |
691 if (!context_) | 697 if (!context_) |
692 return; | 698 return; |
693 std::vector<ServiceWorkerDatabase::ResourceRecord> resources; | 699 std::vector<ServiceWorkerDatabase::ResourceRecord> resources; |
694 script_cache_map_.GetResources(&resources); | 700 script_cache_map_.GetResources(&resources); |
695 context_->storage()->PurgeResources(resources); | 701 context_->storage()->PurgeResources(resources); |
696 } | 702 } |
697 | 703 |
698 } // namespace content | 704 } // namespace content |
OLD | NEW |