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

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

Issue 849903002: [Cronet] Upload support for async APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Combined with Matt's CL Created 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 java.util.concurrent.Executor;
8
7 /** 9 /**
8 * HTTP request (GET, PUT or POST). 10 * HTTP request (GET, PUT or POST).
9 * Note: All methods must be called on the Executor passed in during creation. 11 * Note: All methods must be called on the Executor passed in during creation.
10 */ 12 */
11 public interface UrlRequest { 13 public interface UrlRequest {
12 public static final int REQUEST_PRIORITY_IDLE = 0; 14 public static final int REQUEST_PRIORITY_IDLE = 0;
13 15
14 public static final int REQUEST_PRIORITY_LOWEST = 1; 16 public static final int REQUEST_PRIORITY_LOWEST = 1;
15 17
16 public static final int REQUEST_PRIORITY_LOW = 2; 18 public static final int REQUEST_PRIORITY_LOW = 2;
(...skipping 21 matching lines...) Expand all
38 40
39 /** 41 /**
40 * Adds a request header. Must be done before request has started. 42 * Adds a request header. Must be done before request has started.
41 * 43 *
42 * @param header Header name 44 * @param header Header name
43 * @param value Header value 45 * @param value Header value
44 */ 46 */
45 public void addHeader(String header, String value); 47 public void addHeader(String header, String value);
46 48
47 /** 49 /**
50 * Sets upload data. Must be done before request has started. May only be
51 * invoked once per request. Switches method to "POST" if not explicitly
52 * set. Starting the request will throw an exception it a content-type is
mef 2015/02/02 17:45:11 if a Content-Type header.
xunjieli 2015/02/02 18:25:42 Done.
53 * not also set.
54 *
55 * @param uploadDataProvider responsible for providing the upload data.
56 * @param executor All UploadDataProvider methods will be called using this
57 * executor. May optionally be the same executor the request itself is
58 * using.
59 */
60 public void setUploadDataProvider(UploadDataProvider uploadDataProvider, Exe cutor executor);
61
62 /**
48 * Starts the request, all callbacks go to listener. May only be called 63 * Starts the request, all callbacks go to listener. May only be called
49 * once. May not be called if cancel has been called on the request. 64 * once. May not be called if cancel has been called on the request.
50 */ 65 */
51 public void start(); 66 public void start();
52 67
53 /** 68 /**
54 * Cancels the request. 69 * Cancels the request.
55 * 70 *
56 * Can be called at any time. If the Executor passed to UrlRequest on 71 * Can be called at any time. If the Executor passed to UrlRequest on
57 * construction runs tasks on a single thread, and cancel is called on that 72 * construction runs tasks on a single thread, and cancel is called on that
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 */ 105 */
91 public void resume(); 106 public void resume();
92 107
93 /** 108 /**
94 * Note: There are deliberately no accessors for the results of the request 109 * Note: There are deliberately no accessors for the results of the request
95 * here. Having none removes any ambiguity over when they are populated, 110 * here. Having none removes any ambiguity over when they are populated,
96 * particularly in the redirect case. 111 * particularly in the redirect case.
97 */ 112 */
98 } 113 }
99 114
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698