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

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

Issue 586143002: Initial implementation of Cronet Async API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 /** 7 /**
8 * HTTP request (GET, PUT or POST). 8 * HTTP request (GET, PUT or POST).
9 * Note: All methods must be called on the Executor passed in during creation. 9 * Note: All methods must be called on the Executor passed in during creation.
Charles 2014/09/20 00:47:34 You should enforce this by checking the calling th
mef 2014/09/22 17:12:13 Hmm, about executor, it doesn't seem to require th
Charles 2014/09/22 21:22:54 You can make sure that it's executing on the threa
10 */ 10 */
11 public interface UrlRequest { 11 public interface UrlRequest {
12 public static final int REQUEST_PRIORITY_IDLE = 0;
13
14 public static final int REQUEST_PRIORITY_LOWEST = 1;
15
16 public static final int REQUEST_PRIORITY_LOW = 2;
17
18 public static final int REQUEST_PRIORITY_MEDIUM = 3;
19
20 public static final int REQUEST_PRIORITY_HIGHEST = 4;
21
12 /** 22 /**
13 * More setters go here. They may only be called before start (Maybe 23 * More setters go here. They may only be called before start (Maybe
14 * also allow during redirects). Could optionally instead use arguments 24 * also allow during redirects). Could optionally instead use arguments
15 * to URLRequestFactory when creating the request. 25 * to URLRequestFactory when creating the request.
16 */ 26 */
17 27
18 /** 28 /**
19 * Sets the HTTP method verb to use for this request. 29 * Sets the HTTP method verb to use for this request.
20 * 30 *
21 * <p>The default when this method is not called is "GET" if the request has 31 * <p>The default when this method is not called is "GET" if the request has
22 * no body or "POST" if it does. 32 * no body or "POST" if it does.
23 * 33 *
24 * @param method "GET", "HEAD", "DELETE", "POST" or "PUT". 34 * @param method "GET", "HEAD", "DELETE", "POST" or "PUT".
25 */ 35 */
26 public void setHttpMethod(String method); 36 public void setHttpMethod(String method);
27 37
28 /** 38 /**
29 * Adds a request header. Must be done before request has started. 39 * Adds a request header. Must be done before request has started.
30 * 40 *
31 * @param header Header name 41 * @param header Header name
32 * @param value Header value 42 * @param value Header value
33 */ 43 */
34 public void addHeader(String header, String value); 44 public void addHeader(String header, String value);
35 45
36 /** 46 /**
37 * Starts the request, all callbacks go to listener. 47 * Starts the request, all callbacks go to listener.
38 * @param listener
39 */ 48 */
40 public void start(UrlRequestListener listener); 49 public void start();
41 50
42 /** 51 /**
43 * Can be called at any time. 52 * Can be called at any time.
44 */ 53 */
45 public void cancel(); 54 public void cancel();
46 55
47 /** 56 /**
48 * 57 *
49 * @return True if the request has been cancelled by the embedder. 58 * @return True if the request has been cancelled by the embedder.
50 * TBD(mmenke): False in all other cases (Including errors). 59 * TBD(mmenke): False in all other cases (Including errors).
(...skipping 23 matching lines...) Expand all
74 */ 83 */
75 public void resume(); 84 public void resume();
76 85
77 /** 86 /**
78 * Note: There are deliberately no accessors for the results of the request 87 * Note: There are deliberately no accessors for the results of the request
79 * here. Having none removes any ambiguity over when they are populated, 88 * here. Having none removes any ambiguity over when they are populated,
80 * particularly in the redirect case. 89 * particularly in the redirect case.
81 */ 90 */
82 } 91 }
83 92
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698