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

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

Issue 475533003: Upstream changes to enable chunked uploads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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..89c034503f9a7429ba3bcd0709db7f017038f4a5 100644
--- a/components/cronet/android/url_request_adapter.h
+++ b/components/cronet/android/url_request_adapter.h
@@ -38,6 +38,7 @@ class URLRequestAdapter : public net::URLRequest::Delegate {
virtual void OnBytesRead(URLRequestAdapter* request) = 0;
virtual void OnRequestFinished(URLRequestAdapter* request) = 0;
virtual int ReadFromUploadChannel(net::IOBuffer* buf, int buf_length) = 0;
+ virtual void OnAppendChunkCompleted(URLRequestAdapter* request) = 0;
protected:
friend class base::RefCountedThreadSafe<URLRequestAdapterDelegate>;
@@ -62,6 +63,16 @@ class URLRequestAdapter : public net::URLRequest::Delegate {
// Sets the request to streaming upload.
void SetUploadChannel(JNIEnv* env, int64 content_length);
+ // Indicates that the request body will be streamed by calling
+ // AppendChunkToUpload() repeatedly. This must be called before Start().
+ void EnableChunkedUpload();
+
+ // Appends a chunk to the upload.
+ // This must be called after EnableChunkedUpload() and Start().
+ void AppendChunkToUpload(const char* bytes,
+ int bytes_len,
+ bool is_last_chunk);
+
// Starts the request.
void Start();
@@ -136,6 +147,7 @@ class URLRequestAdapter : public net::URLRequest::Delegate {
std::string content_type_;
bool canceled_;
int64 expected_size_;
+ bool chunked_upload_;
DISALLOW_COPY_AND_ASSIGN(URLRequestAdapter);
};

Powered by Google App Engine
This is Rietveld 408576698