summaryrefslogtreecommitdiffstats
path: root/net/base
diff options
context:
space:
mode:
authorhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-14 17:54:27 +0000
committerhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-14 17:54:27 +0000
commit329b68b4cf98ba464f881ae553c0a7f1a4795c6c (patch)
tree33d48f3c1a7b0a88b58aaa53649806903e85f2fb /net/base
parent5bde6ee2ad44220fcb40fec5a19c637c94ddfac6 (diff)
downloadchromium_src-329b68b4cf98ba464f881ae553c0a7f1a4795c6c.zip
chromium_src-329b68b4cf98ba464f881ae553c0a7f1a4795c6c.tar.gz
chromium_src-329b68b4cf98ba464f881ae553c0a7f1a4795c6c.tar.bz2
net: Move ownership of UploadDataStream from HttpNetworkTransaction to URLRequestHttpJob
URLRequestHttpJob creates and owns UploadDataStream. Change type of HttpRequestInfo::upload_data from UploadData* to UploadDataStream*. Add UploadDataStream::identifier(). BUG=156574 TEST=net_unittests Review URL: https://chromiumcodereview.appspot.com/11269039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167696 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base')
-rw-r--r--net/base/upload_data_stream.cc9
-rw-r--r--net/base/upload_data_stream.h9
2 files changed, 16 insertions, 2 deletions
diff --git a/net/base/upload_data_stream.cc b/net/base/upload_data_stream.cc
index 8398cd1..750302e 100644
--- a/net/base/upload_data_stream.cc
+++ b/net/base/upload_data_stream.cc
@@ -7,6 +7,7 @@
#include "base/logging.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
+#include "net/base/upload_data.h"
#include "net/base/upload_element_reader.h"
namespace net {
@@ -78,6 +79,14 @@ int UploadDataStream::ReadSync(IOBuffer* buf, int buf_len) {
CompletionCallback());
}
+int64 UploadDataStream::identifier() const {
+ return upload_data_->identifier();
+}
+
+bool UploadDataStream::is_chunked() const {
+ return upload_data_->is_chunked();
+}
+
bool UploadDataStream::IsEOF() const {
DCHECK(initialized_successfully_);
// Check if all elements are consumed.
diff --git a/net/base/upload_data_stream.h b/net/base/upload_data_stream.h
index 263ca97..520abce 100644
--- a/net/base/upload_data_stream.h
+++ b/net/base/upload_data_stream.h
@@ -11,12 +11,12 @@
#include "base/memory/weak_ptr.h"
#include "net/base/completion_callback.h"
#include "net/base/net_export.h"
-#include "net/base/upload_data.h"
namespace net {
class DrainableIOBuffer;
class IOBuffer;
+class UploadData;
class UploadElementReader;
// A class to read all elements from an UploadData object.
@@ -59,6 +59,11 @@ class NET_EXPORT UploadDataStream {
// Use this method only if the thread is IO allowed or the data is in-memory.
int ReadSync(IOBuffer* buf, int buf_len);
+ // Identifies a particular upload instance, which is used by the cache to
+ // formulate a cache key. This value should be unique across browser
+ // sessions. A value of 0 is used to indicate an unspecified identifier.
+ int64 identifier() const;
+
// Returns the total size of the data stream and the current position.
// size() is not to be used to determine whether the stream has ended
// because it is possible for the stream to end before its size is reached,
@@ -67,7 +72,7 @@ class NET_EXPORT UploadDataStream {
uint64 size() const { return total_size_; }
uint64 position() const { return current_position_; }
- bool is_chunked() const { return upload_data_->is_chunked(); }
+ bool is_chunked() const;
// Returns true if all data has been consumed from this upload data
// stream.