| 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/embedded_worker_instance.h" | 5 #include "content/browser/service_worker/embedded_worker_instance.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 void EmbeddedWorkerInstance::Detach() { | 768 void EmbeddedWorkerInstance::Detach() { |
| 769 registry_->DetachWorker(process_id(), embedded_worker_id()); | 769 registry_->DetachWorker(process_id(), embedded_worker_id()); |
| 770 OnDetached(); | 770 OnDetached(); |
| 771 } | 771 } |
| 772 | 772 |
| 773 base::WeakPtr<EmbeddedWorkerInstance> EmbeddedWorkerInstance::AsWeakPtr() { | 773 base::WeakPtr<EmbeddedWorkerInstance> EmbeddedWorkerInstance::AsWeakPtr() { |
| 774 return weak_factory_.GetWeakPtr(); | 774 return weak_factory_.GetWeakPtr(); |
| 775 } | 775 } |
| 776 | 776 |
| 777 bool EmbeddedWorkerInstance::OnMessageReceived(const IPC::Message& message) { | 777 bool EmbeddedWorkerInstance::OnMessageReceived(const IPC::Message& message) { |
| 778 ListenerList::Iterator it(&listener_list_); | 778 for (auto& listener : listener_list_) { |
| 779 while (Listener* listener = it.GetNext()) { | 779 if (listener.OnMessageReceived(message)) |
| 780 if (listener->OnMessageReceived(message)) | |
| 781 return true; | 780 return true; |
| 782 } | 781 } |
| 783 return false; | 782 return false; |
| 784 } | 783 } |
| 785 | 784 |
| 786 void EmbeddedWorkerInstance::OnReportException( | 785 void EmbeddedWorkerInstance::OnReportException( |
| 787 const base::string16& error_message, | 786 const base::string16& error_message, |
| 788 int line_number, | 787 int line_number, |
| 789 int column_number, | 788 int column_number, |
| 790 const GURL& source_url) { | 789 const GURL& source_url) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 case SCRIPT_READ_FINISHED: | 925 case SCRIPT_READ_FINISHED: |
| 927 return "Script read finished"; | 926 return "Script read finished"; |
| 928 case STARTING_PHASE_MAX_VALUE: | 927 case STARTING_PHASE_MAX_VALUE: |
| 929 NOTREACHED(); | 928 NOTREACHED(); |
| 930 } | 929 } |
| 931 NOTREACHED() << phase; | 930 NOTREACHED() << phase; |
| 932 return std::string(); | 931 return std::string(); |
| 933 } | 932 } |
| 934 | 933 |
| 935 } // namespace content | 934 } // namespace content |
| OLD | NEW |