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/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 } | 777 } |
778 | 778 |
779 void ServiceWorkerVersion::AddListener(Listener* listener) { | 779 void ServiceWorkerVersion::AddListener(Listener* listener) { |
780 listeners_.AddObserver(listener); | 780 listeners_.AddObserver(listener); |
781 } | 781 } |
782 | 782 |
783 void ServiceWorkerVersion::RemoveListener(Listener* listener) { | 783 void ServiceWorkerVersion::RemoveListener(Listener* listener) { |
784 listeners_.RemoveObserver(listener); | 784 listeners_.RemoveObserver(listener); |
785 } | 785 } |
786 | 786 |
| 787 void ServiceWorkerVersion::ReportError(ServiceWorkerStatusCode status, |
| 788 const std::string& status_message) { |
| 789 if (status_message.empty()) { |
| 790 OnReportException(base::UTF8ToUTF16(ServiceWorkerStatusToString(status)), |
| 791 -1, -1, GURL()); |
| 792 } else { |
| 793 OnReportException(base::UTF8ToUTF16(status_message), -1, -1, GURL()); |
| 794 } |
| 795 } |
| 796 |
787 void ServiceWorkerVersion::Doom() { | 797 void ServiceWorkerVersion::Doom() { |
788 if (is_doomed_) | 798 if (is_doomed_) |
789 return; | 799 return; |
790 is_doomed_ = true; | 800 is_doomed_ = true; |
791 if (!HasControllee()) | 801 if (!HasControllee()) |
792 DoomInternal(); | 802 DoomInternal(); |
793 } | 803 } |
794 | 804 |
795 void ServiceWorkerVersion::SetDevToolsAttached(bool attached) { | 805 void ServiceWorkerVersion::SetDevToolsAttached(bool attached) { |
796 embedded_worker()->set_devtools_attached(attached); | 806 embedded_worker()->set_devtools_attached(attached); |
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1750 while (!requests_.empty()) { | 1760 while (!requests_.empty()) { |
1751 RequestInfo info = requests_.front(); | 1761 RequestInfo info = requests_.front(); |
1752 info.time = ticks; | 1762 info.time = ticks; |
1753 new_requests.push(info); | 1763 new_requests.push(info); |
1754 requests_.pop(); | 1764 requests_.pop(); |
1755 } | 1765 } |
1756 requests_ = new_requests; | 1766 requests_ = new_requests; |
1757 } | 1767 } |
1758 | 1768 |
1759 } // namespace content | 1769 } // namespace content |
OLD | NEW |