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

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: Introducing RequestResponder! Created 4 years, 10 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 /** 301 /**
302 * Invoked when a ping fails. The given argument is the cause of the fai lure. 302 * Invoked when a ping fails. The given argument is the cause of the fai lure.
303 * 303 *
304 * @param cause the cause of the ping failure 304 * @param cause the cause of the ping failure
305 */ 305 */
306 public abstract void pingFailed(CronetException cause); 306 public abstract void pingFailed(CronetException cause);
307 } 307 }
308 308
309 /** 309 /**
310 * Starts the stream, all callbacks go to the {@code callback} argument pass ed to {@link 310 * Starts the stream, all callbacks go to the {@code callback} argument pass ed to {@link
311 * BidirectionalStream.Builder#BidirectionalStream.Builder BidirectionalStre am.Builder()}. 311 * BidirectionalStream.Builder#BidirectionalStream.Builder BidirectionalStre am.Builder()}.
kapishnikov 2016/01/29 20:08:58 Should be BidirectionalStream.Builder#Builder inst
mef 2016/01/29 20:42:18 Done.
312 * Should only be called once. 312 * Should only be called once.
313 */ 313 */
314 public abstract void start(); 314 public abstract void start();
315 315
316 /** 316 /**
317 * Reads data from the stream into the provided buffer. 317 * Reads data from the stream into the provided buffer.
318 * Must only be called at most once in response to each invocation of the 318 * Must only be called at most once in response to each invocation of the
319 * {@link Callback#onResponseHeadersReceived onResponseHeadersReceived()} an d {@link 319 * {@link Callback#onResponseHeadersReceived onResponseHeadersReceived()} an d {@link
320 * Callback#onReadCompleted onReadCompleted()} methods of the {@link 320 * Callback#onReadCompleted onReadCompleted()} methods of the {@link
321 * Callback}. Each call will result in an invocation of one of the 321 * Callback}. Each call will result in an invocation of one of the
(...skipping 77 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