| 50 | } |
| 51 | |
| 52 | bool RecordList::Visit(const void *arg) |
| 53 | { |
| 54 | assert(m_visitor); // See constructor |
| 55 | if (m_pPolicy) |
| 56 | m_pPolicy->OnBeginPublish(); |
| 57 | bool result = false; |
| 58 | for (auto pRecord = next; pRecord; pRecord = pRecord->next) { |
| 59 | try { |
| 60 | if (m_visitor(*pRecord, arg)) { |
| 61 | result = true; |
| 62 | break; |
| 63 | } |
| 64 | // pRecord might have been removed from the list by the callback, |
| 65 | // but pRecord->next is unchanged. We won't see callbacks added by |
| 66 | // the callback, because they are earlier in the list. |
| 67 | } |
| 68 | catch (...) { |
| 69 | if (m_pPolicy && m_pPolicy->OnEachFailedCallback()) { |
| 70 | result = true; |
| 71 | break; |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | // Intentionally not in a finally(): |
| 76 | if (m_pPolicy) |
| 77 | m_pPolicy->OnEndPublish(); |
| 78 | return result; |
| 79 | } |
| 80 | |
| 81 | } |
| 82 |
no outgoing calls
no test coverage detected