summaryrefslogtreecommitdiffstats
path: root/chrome/common/render_messages.h
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 19:55:08 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 19:55:08 +0000
commitccf1ac4398aeb300bc3c005640aaf57500488e2d (patch)
tree35eadc64a003ec79f2fc77924f5b92928cede2d0 /chrome/common/render_messages.h
parent059292e77d7fcfbf930ccb8cafdaaadd7a505a2e (diff)
downloadchromium_src-ccf1ac4398aeb300bc3c005640aaf57500488e2d.zip
chromium_src-ccf1ac4398aeb300bc3c005640aaf57500488e2d.tar.gz
chromium_src-ccf1ac4398aeb300bc3c005640aaf57500488e2d.tar.bz2
Chrome changes to support cached form submissions.
The solution is to add a user-defined identifier to UploadData. If that identifier is set, and if the request method is POST, then HttpCache will enable caching for the response. (The cache key will be a composition of the identifier and the URL.) A subsequent POST request to the same URL with the same identifier will "hit" the previously generated cache entry. Reuse from the cache is subject to all of the standard rules. For reference, here are the corresponding net changes: http://codereview.chromium.org/52028 Here are the corresponding WebKit changes: http://trac.webkit.org/changeset/41919 BUG=2636 R=sky Review URL: http://codereview.chromium.org/52040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12485 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/render_messages.h')
-rw-r--r--chrome/common/render_messages.h41
1 files changed, 37 insertions, 4 deletions
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 9c4af43..5f5bb6b 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -266,8 +266,8 @@ struct ViewHostMsg_Resource_Request {
// Used by plugin->browser requests to get the correct URLRequestContext.
uint32 request_context;
- // Optional upload data (may be empty).
- std::vector<net::UploadData::Element> upload_content;
+ // Optional upload data (may be null).
+ scoped_refptr<net::UploadData> upload_data;
};
// Parameters for a render request.
@@ -1161,6 +1161,39 @@ struct ParamTraits<net::UploadData::Element> {
}
};
+// Traits for net::UploadData.
+template <>
+struct ParamTraits<scoped_refptr<net::UploadData> > {
+ typedef scoped_refptr<net::UploadData> param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, p.get() != NULL);
+ if (p) {
+ WriteParam(m, p->elements());
+ WriteParam(m, p->identifier());
+ }
+ }
+ static bool Read(const Message* m, void** iter, param_type* r) {
+ bool has_object;
+ if (!ReadParam(m, iter, &has_object))
+ return false;
+ if (!has_object)
+ return true;
+ std::vector<net::UploadData::Element> elements;
+ if (!ReadParam(m, iter, &elements))
+ return false;
+ int identifier;
+ if (!ReadParam(m, iter, &identifier))
+ return false;
+ *r = new net::UploadData;
+ (*r)->swap_elements(&elements);
+ (*r)->set_identifier(identifier);
+ return true;
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(L"<net::UploadData>");
+ }
+};
+
// Traits for WebKit::WebCache::UsageStats
template <>
struct ParamTraits<WebKit::WebCache::UsageStats> {
@@ -1304,7 +1337,7 @@ struct ParamTraits<ViewHostMsg_Resource_Request> {
WriteParam(m, p.origin_pid);
WriteParam(m, p.resource_type);
WriteParam(m, p.request_context);
- WriteParam(m, p.upload_content);
+ WriteParam(m, p.upload_data);
}
static bool Read(const Message* m, void** iter, param_type* r) {
return
@@ -1319,7 +1352,7 @@ struct ParamTraits<ViewHostMsg_Resource_Request> {
ReadParam(m, iter, &r->origin_pid) &&
ReadParam(m, iter, &r->resource_type) &&
ReadParam(m, iter, &r->request_context) &&
- ReadParam(m, iter, &r->upload_content);
+ ReadParam(m, iter, &r->upload_data);
}
static void Log(const param_type& p, std::wstring* l) {
l->append(L"(");