summaryrefslogtreecommitdiffstats
path: root/chrome/common
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 /chrome/common
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 'chrome/common')
-rw-r--r--chrome/common/common_param_traits.h7
-rw-r--r--chrome/common/render_messages_internal.h7
-rw-r--r--chrome/common/resource_dispatcher.cc13
3 files changed, 22 insertions, 5 deletions
diff --git a/chrome/common/common_param_traits.h b/chrome/common/common_param_traits.h
index 72f84ee..426075a 100644
--- a/chrome/common/common_param_traits.h
+++ b/chrome/common/common_param_traits.h
@@ -318,6 +318,7 @@ struct ParamTraits<net::UploadData::Element> {
WriteParam(m, p.file_path());
WriteParam(m, p.file_range_offset());
WriteParam(m, p.file_range_length());
+ WriteParam(m, p.expected_file_modification_time());
}
}
static bool Read(const Message* m, void** iter, param_type* r) {
@@ -334,13 +335,17 @@ struct ParamTraits<net::UploadData::Element> {
DCHECK(type == net::UploadData::TYPE_FILE);
FilePath file_path;
uint64 offset, length;
+ base::Time expected_modification_time;
if (!ReadParam(m, iter, &file_path))
return false;
if (!ReadParam(m, iter, &offset))
return false;
if (!ReadParam(m, iter, &length))
return false;
- r->SetToFilePathRange(file_path, offset, length);
+ if (!ReadParam(m, iter, &expected_modification_time))
+ return false;
+ r->SetToFilePathRange(file_path, offset, length,
+ expected_modification_time);
}
return true;
}
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index afc9a4c..a0f5d14 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -15,6 +15,7 @@
#include "base/file_path.h"
#include "base/nullable_string16.h"
#include "base/sync_socket.h"
+#include "base/time.h"
#include "base/values.h"
#include "chrome/common/content_settings.h"
#include "chrome/common/extensions/update_manifest.h"
@@ -2101,6 +2102,12 @@ IPC_BEGIN_MESSAGES(ViewHost)
FilePath /* path */,
int64 /* result */)
+ // Get file modification time in seconds. Set result to 0 if failed to get the
+ // file modification time.
+ IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_GetFileModificationTime,
+ FilePath /* path */,
+ base::Time /* result */)
+
// Sent by the renderer process to acknowledge receipt of a
// ViewMsg_CSSInsertRequest message and css has been inserted into the frame.
IPC_MESSAGE_ROUTED0(ViewHostMsg_OnCSSInserted)
diff --git a/chrome/common/resource_dispatcher.cc b/chrome/common/resource_dispatcher.cc
index 9df8eaf..5c2fd28 100644
--- a/chrome/common/resource_dispatcher.cc
+++ b/chrome/common/resource_dispatcher.cc
@@ -52,8 +52,11 @@ class IPCResourceLoaderBridge : public ResourceLoaderBridge {
// ResourceLoaderBridge
virtual void AppendDataToUpload(const char* data, int data_len);
- virtual void AppendFileRangeToUpload(const FilePath& path,
- uint64 offset, uint64 length);
+ virtual void AppendFileRangeToUpload(
+ const FilePath& path,
+ uint64 offset,
+ uint64 length,
+ const base::Time& expected_modification_time);
virtual void SetUploadIdentifier(int64 identifier);
virtual bool Start(Peer* peer);
virtual void Cancel();
@@ -152,12 +155,14 @@ void IPCResourceLoaderBridge::AppendDataToUpload(const char* data,
}
void IPCResourceLoaderBridge::AppendFileRangeToUpload(
- const FilePath& path, uint64 offset, uint64 length) {
+ const FilePath& path, uint64 offset, uint64 length,
+ const base::Time& expected_modification_time) {
DCHECK(request_id_ == -1) << "request already started";
if (!request_.upload_data)
request_.upload_data = new net::UploadData();
- request_.upload_data->AppendFileRange(path, offset, length);
+ request_.upload_data->AppendFileRange(path, offset, length,
+ expected_modification_time);
}
void IPCResourceLoaderBridge::SetUploadIdentifier(int64 identifier) {