SPDY: refactor frame codec implementation