summaryrefslogtreecommitdiffstats
path: root/net/base/upload_data.h
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-24 23:37:50 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-24 23:37:50 +0000
commit7a6db4024aa668fd49741c4c34965ab674efaac6 (patch)
tree291de61ee2f86da940a5c9c0a67a79d394478a8e /net/base/upload_data.h
parente8b3ddfde11a59bc910697090906dd36f0426401 (diff)
downloadchromium_src-7a6db4024aa668fd49741c4c34965ab674efaac6.zip
chromium_src-7a6db4024aa668fd49741c4c34965ab674efaac6.tar.gz
chromium_src-7a6db4024aa668fd49741c4c34965ab674efaac6.tar.bz2
Support sending a sliced file in chromium.
BUG=none TEST=The WebKit Layout test. Review URL: http://codereview.chromium.org/594036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42559 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/upload_data.h')
-rw-r--r--net/base/upload_data.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/net/base/upload_data.h b/net/base/upload_data.h
index 3aab835..869ab68 100644
--- a/net/base/upload_data.h
+++ b/net/base/upload_data.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/file_path.h"
#include "base/ref_counted.h"
+#include "base/time.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
namespace net {
@@ -35,6 +36,10 @@ class UploadData : public base::RefCounted<UploadData> {
const FilePath& file_path() const { return file_path_; }
uint64 file_range_offset() const { return file_range_offset_; }
uint64 file_range_length() const { return file_range_length_; }
+ // If NULL time is returned, we do not do the check.
+ const base::Time& expected_file_modification_time() const {
+ return expected_file_modification_time_;
+ }
void SetToBytes(const char* bytes, int bytes_len) {
type_ = TYPE_BYTES;
@@ -42,15 +47,20 @@ class UploadData : public base::RefCounted<UploadData> {
}
void SetToFilePath(const FilePath& path) {
- SetToFilePathRange(path, 0, kuint64max);
+ SetToFilePathRange(path, 0, kuint64max, base::Time());
}
+ // If expected_modification_time is NULL, we do not check for the file
+ // change. Also note that the granularity for comparison is time_t, not
+ // the full precision.
void SetToFilePathRange(const FilePath& path,
- uint64 offset, uint64 length) {
+ uint64 offset, uint64 length,
+ const base::Time& expected_modification_time) {
type_ = TYPE_FILE;
file_path_ = path;
file_range_offset_ = offset;
file_range_length_ = length;
+ expected_file_modification_time_ = expected_modification_time;
}
// Returns the byte-length of the element. For files that do not exist, 0
@@ -69,6 +79,7 @@ class UploadData : public base::RefCounted<UploadData> {
FilePath file_path_;
uint64 file_range_offset_;
uint64 file_range_length_;
+ base::Time expected_file_modification_time_;
bool override_content_length_;
uint64 content_length_;
@@ -89,9 +100,11 @@ class UploadData : public base::RefCounted<UploadData> {
}
void AppendFileRange(const FilePath& file_path,
- uint64 offset, uint64 length) {
+ uint64 offset, uint64 length,
+ const base::Time& expected_modification_time) {
elements_.push_back(Element());
- elements_.back().SetToFilePathRange(file_path, offset, length);
+ elements_.back().SetToFilePathRange(file_path, offset, length,
+ expected_modification_time);
}
// Returns the total size in bytes of the data to upload.