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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <map> | 10 #include <map> |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 } else { | 592 } else { |
593 request->is_dispatched = true; | 593 request->is_dispatched = true; |
594 } | 594 } |
595 } | 595 } |
596 } | 596 } |
597 | 597 |
598 void ServiceWorkerVersion::AddControllee( | 598 void ServiceWorkerVersion::AddControllee( |
599 ServiceWorkerProviderHost* provider_host) { | 599 ServiceWorkerProviderHost* provider_host) { |
600 const std::string& uuid = provider_host->client_uuid(); | 600 const std::string& uuid = provider_host->client_uuid(); |
601 CHECK(!provider_host->client_uuid().empty()); | 601 CHECK(!provider_host->client_uuid().empty()); |
602 DCHECK(!ContainsKey(controllee_map_, uuid)); | 602 DCHECK(!base::ContainsKey(controllee_map_, uuid)); |
603 controllee_map_[uuid] = provider_host; | 603 controllee_map_[uuid] = provider_host; |
604 // Keep the worker alive a bit longer right after a new controllee is added. | 604 // Keep the worker alive a bit longer right after a new controllee is added. |
605 RestartTick(&idle_time_); | 605 RestartTick(&idle_time_); |
606 FOR_EACH_OBSERVER(Listener, listeners_, | 606 FOR_EACH_OBSERVER(Listener, listeners_, |
607 OnControlleeAdded(this, provider_host)); | 607 OnControlleeAdded(this, provider_host)); |
608 } | 608 } |
609 | 609 |
610 void ServiceWorkerVersion::RemoveControllee( | 610 void ServiceWorkerVersion::RemoveControllee( |
611 ServiceWorkerProviderHost* provider_host) { | 611 ServiceWorkerProviderHost* provider_host) { |
612 const std::string& uuid = provider_host->client_uuid(); | 612 const std::string& uuid = provider_host->client_uuid(); |
613 DCHECK(ContainsKey(controllee_map_, uuid)); | 613 DCHECK(base::ContainsKey(controllee_map_, uuid)); |
614 controllee_map_.erase(uuid); | 614 controllee_map_.erase(uuid); |
615 FOR_EACH_OBSERVER(Listener, listeners_, | 615 FOR_EACH_OBSERVER(Listener, listeners_, |
616 OnControlleeRemoved(this, provider_host)); | 616 OnControlleeRemoved(this, provider_host)); |
617 if (!HasControllee()) | 617 if (!HasControllee()) |
618 FOR_EACH_OBSERVER(Listener, listeners_, OnNoControllees(this)); | 618 FOR_EACH_OBSERVER(Listener, listeners_, OnNoControllees(this)); |
619 } | 619 } |
620 | 620 |
621 void ServiceWorkerVersion::AddStreamingURLRequestJob( | 621 void ServiceWorkerVersion::AddStreamingURLRequestJob( |
622 const ServiceWorkerURLRequestJob* request_job) { | 622 const ServiceWorkerURLRequestJob* request_job) { |
623 DCHECK(streaming_url_request_jobs_.find(request_job) == | 623 DCHECK(streaming_url_request_jobs_.find(request_job) == |
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1757 ServiceWorkerMetrics::RecordTimeBetweenEvents(base::TimeTicks::Now() - | 1757 ServiceWorkerMetrics::RecordTimeBetweenEvents(base::TimeTicks::Now() - |
1758 idle_time_); | 1758 idle_time_); |
1759 } | 1759 } |
1760 | 1760 |
1761 void ServiceWorkerVersion::FinishStartWorker(ServiceWorkerStatusCode status) { | 1761 void ServiceWorkerVersion::FinishStartWorker(ServiceWorkerStatusCode status) { |
1762 start_worker_first_purpose_ = base::nullopt; | 1762 start_worker_first_purpose_ = base::nullopt; |
1763 RunCallbacks(this, &start_callbacks_, status); | 1763 RunCallbacks(this, &start_callbacks_, status); |
1764 } | 1764 } |
1765 | 1765 |
1766 } // namespace content | 1766 } // namespace content |
OLD | NEW |