Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: components/cronet/android/api/src/org/chromium/net/BidirectionalStream.java

Issue 1412243012: Initial implementation of CronetBidirectionalStream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Paul's comments. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.net; 5 package org.chromium.net;
6 6
7 import android.support.annotation.IntDef; 7 import android.support.annotation.IntDef;
8 8
9 import java.lang.annotation.Retention; 9 import java.lang.annotation.Retention;
10 import java.lang.annotation.RetentionPolicy; 10 import java.lang.annotation.RetentionPolicy;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 /** 83 /**
84 * Sets the HTTP method for the request. Returns builder to facilitate c haining. 84 * Sets the HTTP method for the request. Returns builder to facilitate c haining.
85 * 85 *
86 * @param method the method to use for request. Default is 'POST' 86 * @param method the method to use for request. Default is 'POST'
87 * @return the builder to facilitate chaining 87 * @return the builder to facilitate chaining
88 */ 88 */
89 public Builder setHttpMethod(String method) { 89 public Builder setHttpMethod(String method) {
90 if (method == null) { 90 if (method == null) {
91 throw new NullPointerException("Invalid method name."); 91 throw new NullPointerException("Method is required.");
92 } 92 }
93 mHttpMethod = method; 93 mHttpMethod = method;
94 return this; 94 return this;
95 } 95 }
96 96
97 /** 97 /**
98 * Adds a request header. Returns builder to facilitate chaining. 98 * Adds a request header. Returns builder to facilitate chaining.
99 * 99 *
100 * @param header the header name 100 * @param header the header name
101 * @param value the header value 101 * @param value the header value
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 * onSucceeded()} callback if {@link BidirectionalStream#write write ()} was invoked with 215 * onSucceeded()} callback if {@link BidirectionalStream#write write ()} was invoked with
216 * {@code endOfStream} set to {@code true}. The buffer's limit is no t changed. 216 * {@code endOfStream} set to {@code true}. The buffer's limit is no t changed.
217 */ 217 */
218 public abstract void onReadCompleted( 218 public abstract void onReadCompleted(
219 BidirectionalStream stream, UrlResponseInfo info, ByteBuffer buf fer); 219 BidirectionalStream stream, UrlResponseInfo info, ByteBuffer buf fer);
220 220
221 /** 221 /**
222 * Invoked when data passed to {@link BidirectionalStream#write write()} is sent. The 222 * Invoked when data passed to {@link BidirectionalStream#write write()} is sent. The
223 * buffer's position is updated to the end of the sent data. The buffer' s limit is not 223 * buffer's position is updated to the end of the sent data. The buffer' s limit is not
224 * changed. Not all available data may have been sent, so the buffer's p osition is not 224 * changed. Not all available data may have been sent, so the buffer's p osition is not
225 * necessarily equal to its limit. To continue writing, call 225 * necessarily equal to its limit. To continue writing, call
pauljensen 2016/01/19 16:03:39 is there any reason to require all callers to hand
mef 2016/01/20 15:37:39 Acknowledged. I agree, but I would wait until QUIC
226 * {@link BidirectionalStream#write write()}. 226 * {@link BidirectionalStream#write write()}.
227 * 227 *
228 * @param stream the stream on which the write completed 228 * @param stream the stream on which the write completed
229 * @param info the response information 229 * @param info the response information
230 * @param buffer the buffer that was passed to {@link BidirectionalStrea m#write write()}. 230 * @param buffer the buffer that was passed to {@link BidirectionalStrea m#write write()}.
231 * The buffer's position is set to the end of the sent data. The buf fer's limit 231 * The buffer's position is set to the end of the sent data. The buf fer's limit
232 * is not changed. 232 * is not changed.
233 */ 233 */
234 public abstract void onWriteCompleted( 234 public abstract void onWriteCompleted(
235 BidirectionalStream stream, UrlResponseInfo info, ByteBuffer buf fer); 235 BidirectionalStream stream, UrlResponseInfo info, ByteBuffer buf fer);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 /** 399 /**
400 * Returns {@code true} if the stream was successfully started and is now 400 * Returns {@code true} if the stream was successfully started and is now
401 * done (succeeded, canceled, or failed). 401 * done (succeeded, canceled, or failed).
402 * 402 *
403 * @return {@code true} if the stream was successfully started and is now 403 * @return {@code true} if the stream was successfully started and is now
404 * done (completed, canceled, or failed), otherwise returns {@code f alse} 404 * done (completed, canceled, or failed), otherwise returns {@code f alse}
405 * to indicate stream is not yet started or is in progress. 405 * to indicate stream is not yet started or is in progress.
406 */ 406 */
407 public abstract boolean isDone(); 407 public abstract boolean isDone();
408 } 408 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698