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

Unified Diff: net/base/upload_element.h

Issue 10868064: net: Move data reading functionalities from UploadElement to UploadElementReader (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/upload_data_stream_unittest.cc ('k') | net/base/upload_element.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/upload_element.h
diff --git a/net/base/upload_element.h b/net/base/upload_element.h
index ea58bfda12a545f1bb08f566955b3994d5304b18..96e065e7963d8a48c7618b624e73155522ce5a85 100644
--- a/net/base/upload_element.h
+++ b/net/base/upload_element.h
@@ -9,15 +9,11 @@
#include "base/basictypes.h"
#include "base/file_path.h"
-#include "base/gtest_prod_util.h"
#include "base/time.h"
-#include "googleurl/src/gurl.h"
#include "net/base/net_export.h"
namespace net {
-class FileStream;
-
// A class representing an element contained by UploadData.
class NET_EXPORT UploadElement {
public:
@@ -72,42 +68,7 @@ class NET_EXPORT UploadElement {
expected_file_modification_time_ = expected_modification_time;
}
- // Returns the byte-length of the element. For files that do not exist, 0
- // is returned. This is done for consistency with Mozilla.
- uint64 GetContentLength();
-
- // Reads up to |buf_len| bytes synchronously. Returns the number of bytes
- // read. This function never fails. If there's less data to read than we
- // initially observed, then pad with zero (this can happen with files).
- // |buf_len| must be greater than 0.
- int ReadSync(char* buf, int buf_len);
-
- // Returns the number of bytes remaining to read.
- uint64 BytesRemaining();
-
- // Resets the offset to zero and closes the file stream if opened, so
- // that the element can be reread.
- void ResetOffset();
-
private:
- // Returns a FileStream opened for reading for this element, positioned
- // at |file_range_offset_|. Returns NULL if the file is not openable.
- FileStream* OpenFileStream();
-
- // Reads up to |buf_len| bytes synchronously from memory (i.e. type_ is
- // TYPE_BYTES).
- int ReadFromMemorySync(char* buf, int buf_len);
-
- // Reads up to |buf_len| bytes synchronously from a file (i.e. type_ is
- // TYPE_FILE).
- int ReadFromFileSync(char* buf, int buf_len);
-
- // Allows tests to override the result of GetContentLength.
- void SetContentLength(uint64 content_length) {
- override_content_length_ = true;
- content_length_ = content_length;
- }
-
Type type_;
std::vector<char> buf_;
const char* bytes_start_;
@@ -116,24 +77,6 @@ class NET_EXPORT UploadElement {
uint64 file_range_offset_;
uint64 file_range_length_;
base::Time expected_file_modification_time_;
- bool override_content_length_;
- bool content_length_computed_;
- uint64 content_length_;
-
- // The byte offset from the beginning of the element data. Used to track
- // the current position when reading data.
- uint64 offset_;
-
- // The stream of the element data, if this element is of TYPE_FILE.
- FileStream* file_stream_;
-
- FRIEND_TEST_ALL_PREFIXES(UploadDataStreamTest, FileSmallerThanLength);
- FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionTest,
- UploadFileSmallerThanLength);
- FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionSpdy2Test,
- UploadFileSmallerThanLength);
- FRIEND_TEST_ALL_PREFIXES(HttpNetworkTransactionSpdy3Test,
- UploadFileSmallerThanLength);
};
#if defined(UNIT_TEST)
« no previous file with comments | « net/base/upload_data_stream_unittest.cc ('k') | net/base/upload_element.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698