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

Unified Diff: webkit/glue/glue_serialize.cc

Issue 52040: Chrome changes to support cached form submissions.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 | « chrome/common/resource_dispatcher.cc ('k') | webkit/glue/resource_handle_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/glue_serialize.cc
===================================================================
--- webkit/glue/glue_serialize.cc (revision 12361)
+++ webkit/glue/glue_serialize.cc (working copy)
@@ -45,8 +45,9 @@
// data, but not vice versa.
// 3: Version 2 was broken, it stored number of UChars, not number of bytes.
// This version checks and reads v1 and v2 correctly.
+// 4: Adds support for storing FormData::identifier().
// Should be const, but unit tests may modify it.
-int kVersion = 3;
+int kVersion = 4;
// A bunch of convenience functions to read/write to SerializeObjects.
// The serializers assume the input data is in the correct format and so does
@@ -81,6 +82,16 @@
return tmp;
}
+inline void WriteInteger64(int64 data, SerializeObject* obj) {
+ obj->pickle.WriteInt64(data);
+}
+
+inline int64 ReadInteger64(const SerializeObject* obj) {
+ int64 tmp;
sky 2009/03/24 20:34:40 should you set this to 0, just in case ReadInt64 f
darin (slow to review) 2009/03/24 21:12:15 Good idea!
+ obj->pickle.ReadInt64(&obj->iter, &tmp);
+ return tmp;
+}
+
inline void WriteReal(double data, SerializeObject* obj) {
WriteData(&data, sizeof(double), obj);
}
@@ -124,8 +135,8 @@
data.length() * sizeof(UChar));
}
break;
- case 3:
- // Version 3 writes <length in bytes><string data>.
+ default:
+ // Version 3+ writes <length in bytes><string data>.
// It uses -1 in the length field to mean String().
if (data.isNull()) {
obj->pickle.WriteInt(-1);
@@ -135,9 +146,6 @@
data.length() * sizeof(UChar));
}
break;
- default:
- NOTREACHED();
- break;
}
}
@@ -199,6 +207,7 @@
WriteString(e.m_filename, obj);
}
}
+ WriteInteger64(form_data->identifier(), obj);
}
static PassRefPtr<FormData> ReadFormData(const SerializeObject* obj) {
@@ -219,6 +228,8 @@
form_data->appendFile(ReadString(obj));
}
}
+ if (obj->version >= 4)
+ form_data->setIdentifier(ReadInteger64(obj));
return form_data.release();
}
@@ -264,7 +275,7 @@
// See note in WriteHistoryItem. on this.
obj->version = ReadInteger(obj);
- if (obj->version > kVersion)
+ if (obj->version > kVersion || obj->version < 1)
return NULL;
RefPtr<HistoryItem> item = HistoryItem::create();
« no previous file with comments | « chrome/common/resource_dispatcher.cc ('k') | webkit/glue/resource_handle_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698