| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ipc/ipc_test_sink.h" | 5 #include "ipc/ipc_test_sink.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 NOTIMPLEMENTED(); | 38 NOTIMPLEMENTED(); |
| 39 return base::ProcessId(); | 39 return base::ProcessId(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 base::ProcessId TestSink::GetSelfPID() const { | 42 base::ProcessId TestSink::GetSelfPID() const { |
| 43 NOTIMPLEMENTED(); | 43 NOTIMPLEMENTED(); |
| 44 return base::ProcessId(); | 44 return base::ProcessId(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 bool TestSink::OnMessageReceived(const Message& msg) { | 47 bool TestSink::OnMessageReceived(const Message& msg) { |
| 48 base::ObserverListBase<Listener>::Iterator it(&filter_list_); | 48 for (auto& observer : filter_list_) { |
| 49 Listener* observer; | 49 if (observer.OnMessageReceived(msg)) |
| 50 while ((observer = it.GetNext()) != NULL) { | |
| 51 if (observer->OnMessageReceived(msg)) | |
| 52 return true; | 50 return true; |
| 53 } | 51 } |
| 54 | 52 |
| 55 // No filter handled the message, so store it. | 53 // No filter handled the message, so store it. |
| 56 messages_.push_back(Message(msg)); | 54 messages_.push_back(Message(msg)); |
| 57 return true; | 55 return true; |
| 58 } | 56 } |
| 59 | 57 |
| 60 void TestSink::ClearMessages() { | 58 void TestSink::ClearMessages() { |
| 61 messages_.clear(); | 59 messages_.clear(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } | 103 } |
| 106 | 104 |
| 107 base::ScopedFD TestSink::TakeClientFileDescriptor() { | 105 base::ScopedFD TestSink::TakeClientFileDescriptor() { |
| 108 NOTREACHED(); | 106 NOTREACHED(); |
| 109 return base::ScopedFD(); | 107 return base::ScopedFD(); |
| 110 } | 108 } |
| 111 | 109 |
| 112 #endif // defined(OS_POSIX) && !defined(OS_NACL) | 110 #endif // defined(OS_POSIX) && !defined(OS_NACL) |
| 113 | 111 |
| 114 } // namespace IPC | 112 } // namespace IPC |
| OLD | NEW |