| Index: components/cronet/android/api/src/org/chromium/net/BidirectionalStream.java
|
| diff --git a/components/cronet/android/api/src/org/chromium/net/BidirectionalStream.java b/components/cronet/android/api/src/org/chromium/net/BidirectionalStream.java
|
| index f7e31d276336373a54f72d96eed60c8d4e0ee40e..abc4c1952f7d8b24238e05dfa850288771d9e7ff 100644
|
| --- a/components/cronet/android/api/src/org/chromium/net/BidirectionalStream.java
|
| +++ b/components/cronet/android/api/src/org/chromium/net/BidirectionalStream.java
|
| @@ -47,7 +47,9 @@ public abstract class BidirectionalStream {
|
| // Priority of the stream. Default is medium.
|
| @StreamPriority private int mPriority = STREAM_PRIORITY_MEDIUM;
|
|
|
| + // TODO(xunjieli): Remove mDisableAutoFlush and make flush() required as part of th API.
|
| private boolean mDisableAutoFlush;
|
| + private boolean mDelayRequestHeadersUntilNextFlush;
|
|
|
| /**
|
| * Creates a builder for {@link BidirectionalStream} objects. All callbacks for
|
| @@ -174,6 +176,22 @@ public abstract class BidirectionalStream {
|
| }
|
|
|
| /**
|
| + * Delays sending request headers until the next {@link BidirectionalStream#flush()}
|
| + * is called. This flag is currently only respected when QUIC is negotiated.
|
| + * When true, QUIC will send request header frame along with data frame(s)
|
| + * as a single packet when possible.
|
| + *
|
| + * @param delayRequestHeadersUntilNextFlush if true, sending request headers will
|
| + * be delayed until the next flush() is called.
|
| + * @return the builder to facilitate chaining.
|
| + */
|
| + public Builder delayRequestHeadersUntilNextFlush(
|
| + boolean delayRequestHeadersUntilNextFlush) {
|
| + mDelayRequestHeadersUntilNextFlush = delayRequestHeadersUntilNextFlush;
|
| + return this;
|
| + }
|
| +
|
| + /**
|
| * Creates a {@link BidirectionalStream} using configuration from this
|
| * {@link Builder}. The returned {@code BidirectionalStream} can then be started
|
| * by calling {@link BidirectionalStream#start}.
|
| @@ -183,7 +201,8 @@ public abstract class BidirectionalStream {
|
| */
|
| public BidirectionalStream build() {
|
| return mCronetEngine.createBidirectionalStream(mUrl, mCallback, mExecutor, mHttpMethod,
|
| - mRequestHeaders, mPriority, mDisableAutoFlush);
|
| + mRequestHeaders, mPriority, mDisableAutoFlush,
|
| + mDelayRequestHeadersUntilNextFlush);
|
| }
|
| }
|
|
|
| @@ -378,8 +397,8 @@ public abstract class BidirectionalStream {
|
| public abstract void write(ByteBuffer buffer, boolean endOfStream);
|
|
|
| /**
|
| - * Flushes pending writes. This method should only be invoked when auto
|
| - * flush is disabled through {@link Builder#disableAutoFlush}.
|
| + * Flushes pending writes. This method should not be invoked before {@link
|
| + * Callback#onStreamReady onStreamReady()}.
|
| */
|
| public abstract void flush();
|
|
|
|
|