Passing around an 'event session context' instead of just a 'session ptr'.

This will make it easier to inline more checks into the generated event
tracing code in the future. This change inlines buffer capacity checks,
avoiding to call to acquireBuffer when not needed.