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

Unified Diff: components/cronet/android/url_request_adapter.h

Issue 470443005: Cronet modifications to support AGSA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: components/cronet/android/url_request_adapter.h
diff --git a/components/cronet/android/url_request_adapter.h b/components/cronet/android/url_request_adapter.h
index 482f175f626527975157ff9f2736fde8f475030d..ea3686137945438df72987e715e036fea99ed01a 100644
--- a/components/cronet/android/url_request_adapter.h
+++ b/components/cronet/android/url_request_adapter.h
@@ -9,14 +9,15 @@
#include <string>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "net/base/request_priority.h"
+#include "net/base/upload_data_stream.h"
mef 2014/08/15 13:30:22 not needed?
mdumitrescu 2014/08/15 15:23:13 Done.
#include "net/http/http_request_headers.h"
#include "net/url_request/url_request.h"
namespace net {
class GrowableIOBuffer;
class HttpResponseHeaders;
class UploadDataStream;
@@ -30,14 +31,15 @@ class URLRequestContextAdapter;
// object.
class URLRequestAdapter : public net::URLRequest::Delegate {
public:
// The delegate which is called when the request finishes.
class URLRequestAdapterDelegate
: public base::RefCountedThreadSafe<URLRequestAdapterDelegate> {
public:
+ virtual void OnAppendChunkCompleted(URLRequestAdapter* request) = 0;
virtual void OnResponseStarted(URLRequestAdapter* request) = 0;
virtual void OnBytesRead(URLRequestAdapter* request) = 0;
virtual void OnRequestFinished(URLRequestAdapter* request) = 0;
virtual int ReadFromUploadChannel(net::IOBuffer* buf, int buf_length) = 0;
protected:
friend class base::RefCountedThreadSafe<URLRequestAdapterDelegate>;
@@ -58,14 +60,22 @@ class URLRequestAdapter : public net::URLRequest::Delegate {
// Sets the contents of the POST or PUT request
void SetUploadContent(const char* bytes, int bytes_len);
// Sets the request to streaming upload.
void SetUploadChannel(JNIEnv* env, int64 content_length);
+ // Indicates that the request body will be streamed by calling AppendChunk()
+ // repeatedly. This must be called before Start().
+ void EnableChunkedUpload();
+
+ // Appends a chunk to the POST body
+ // This must be called after EnableChunkedUpload() and Start().
+ void AppendChunk(const char* bytes, int bytes_len, bool is_last_chunk);
+
// Starts the request.
void Start();
// Cancels the request.
void Cancel();
// Releases all resources for the request and deletes the object itself.
@@ -91,14 +101,17 @@ class URLRequestAdapter : public net::URLRequest::Delegate {
// Returns the value of the specified response header.
std::string GetHeader(const std::string& name) const;
// Get all response headers, as a HttpResponseHeaders object.
net::HttpResponseHeaders* GetResponseHeaders() const;
+ // Gets all headers.
+ bool GetFullRequestHeaders(net::HttpRequestHeaders* headers) const;
mef 2014/08/15 13:30:22 This is already there (see 'ChromiumUrlRequest.get
mdumitrescu 2014/08/15 15:23:13 That returns the response headers. We need the req
mef 2014/08/15 15:42:52 Could you elaborate? What's your scenario and what
+
// Returns the overall number of bytes read.
size_t bytes_read() const { return bytes_read_; }
// Returns a pointer to the downloaded data.
unsigned char* Data() const;
virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE;
@@ -132,14 +145,15 @@ class URLRequestAdapter : public net::URLRequest::Delegate {
int bytes_read_;
int total_bytes_read_;
int error_code_;
int http_status_code_;
std::string content_type_;
bool canceled_;
int64 expected_size_;
+ bool chunked_upload_;
DISALLOW_COPY_AND_ASSIGN(URLRequestAdapter);
};
} // namespace cronet
#endif // COMPONENTS_CRONET_ANDROID_URL_REQUEST_ADAPTER_H_

Powered by Google App Engine
This is Rietveld 408576698