| 77 | |
| 78 | template<typename Func, typename ... Params> |
| 79 | void SendTimelinePacket::ForwardWriteBinaryFunction(Func& func, Params&& ... params) |
| 80 | { |
| 81 | try |
| 82 | { |
| 83 | ReserveBuffer(); |
| 84 | ARM_PIPE_ASSERT(m_WriteBuffer); |
| 85 | unsigned int numberOfBytesWritten = 0; |
| 86 | // Header will be prepended to the buffer on Commit() |
| 87 | while ( true ) |
| 88 | { |
| 89 | TimelinePacketStatus result = func(std::forward<Params>(params)..., |
| 90 | &m_WriteBuffer->GetWritableData()[m_Offset], |
| 91 | m_RemainingBufferSize, |
| 92 | numberOfBytesWritten); |
| 93 | switch ( result ) |
| 94 | { |
| 95 | case TimelinePacketStatus::BufferExhaustion: |
| 96 | Commit(); |
| 97 | ReserveBuffer(); |
| 98 | continue; |
| 99 | |
| 100 | case TimelinePacketStatus::Error: |
| 101 | throw arm::pipe::ProfilingException("Error processing while sending TimelineBinaryPacket", |
| 102 | LOCATION()); |
| 103 | |
| 104 | default: |
| 105 | m_Offset += numberOfBytesWritten; |
| 106 | m_RemainingBufferSize -= numberOfBytesWritten; |
| 107 | return; |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | catch (const arm::pipe::BufferExhaustion& ex) |
| 112 | { |
| 113 | // ditto |
| 114 | throw ex; |
| 115 | } |
| 116 | catch (const arm::pipe::ProfilingException& ex) |
| 117 | { |
| 118 | // don't swallow in the catch all block |
| 119 | throw ex; |
| 120 | } |
| 121 | catch ( ... ) |
| 122 | { |
| 123 | throw arm::pipe::ProfilingException("Unknown Exception thrown while sending TimelineBinaryPacket", LOCATION()); |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | } // namespace pipe |
| 128 |
nothing calls this directly
no test coverage detected