class DefaultHttp2LocalFlowController implements Http2LocalFlowController {

  @Override
  public void receiveFlowControlledFrame(
      final Http2Stream stream, final ByteBuf data, final int padding, final boolean endOfStream)
      throws Http2Exception {
    assert ctx != null && ctx.executor().inEventLoop();
    final int dataLength = data.readableBytes() + padding;

    // Apply the connection-level flow control
    final FlowState connectionState = connectionState();
    connectionState.receiveFlowControlledFrame(dataLength);

    if (stream != null && !isClosed(stream)) {
      // Apply the stream-level flow control
      final FlowState state = state(stream);
      state.endOfStream(endOfStream);
      state.receiveFlowControlledFrame(dataLength);
    } else if (dataLength > 0) {
      // Immediately consume the bytes for the connection window.
      connectionState.consumeBytes(dataLength);
    }
  }

  public  DefaultHttp2LocalFlowController(final Http2Connection connection);
  public  DefaultHttp2LocalFlowController(
      final Http2Connection connection,
      final float windowUpdateRatio,
      final boolean autoRefillConnectionWindow);

}