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

Unified Diff: content/common/indexed_db/indexed_db_param_traits.cc

Issue 10533057: IPC plumbing for IndexedDB to snapshot metadata to the renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't CamelCase "metadata" Created 8 years, 6 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
Index: content/common/indexed_db/indexed_db_param_traits.cc
diff --git a/content/common/indexed_db/indexed_db_param_traits.cc b/content/common/indexed_db/indexed_db_param_traits.cc
index 65107ea1891a8ce58074523fdfe74d73d3f8f2ce..528693ca0566df4ee9f7f3b895b4af4aba7c8605 100644
--- a/content/common/indexed_db/indexed_db_param_traits.cc
+++ b/content/common/indexed_db/indexed_db_param_traits.cc
@@ -7,12 +7,16 @@
#include "content/common/indexed_db/indexed_db_key.h"
#include "content/common/indexed_db/indexed_db_key_path.h"
#include "content/common/indexed_db/indexed_db_key_range.h"
+#include "content/common/indexed_db/indexed_db_metadata.h"
#include "content/public/common/serialized_script_value.h"
#include "ipc/ipc_message_utils.h"
using content::IndexedDBKey;
using content::IndexedDBKeyPath;
using content::IndexedDBKeyRange;
+using content::IndexedDBDatabaseMetadata;
+using content::IndexedDBObjectStoreMetadata;
+using content::IndexedDBIndexMetadata;
using content::SerializedScriptValue;
namespace IPC {
@@ -253,4 +257,129 @@ void ParamTraits<IndexedDBKeyRange>::Log(const param_type& p,
l->append(")");
}
+void ParamTraits<IndexedDBDatabaseMetadata>::Write(Message* m,
+ const param_type& p) {
+ WriteParam(m, p.name());
+ WriteParam(m, p.version());
+ WriteParam(m, p.object_stores());
+}
+
+bool ParamTraits<IndexedDBDatabaseMetadata>::Read(const Message* m,
+ PickleIterator* iter,
+ param_type* r) {
+ string16 name;
+ if (!ReadParam(m, iter, &name))
+ return false;
+
+ string16 version;
+ if (!ReadParam(m, iter, &version))
+ return false;
+
+ std::vector<IndexedDBObjectStoreMetadata> object_stores;
+ if (!ReadParam(m, iter, &object_stores))
+ return false;
+
+ r->Set(name, version, object_stores);
+ return true;
+}
+
+void ParamTraits<IndexedDBDatabaseMetadata>::Log(const param_type& p,
+ std::string* l) {
+ l->append("<IndexedDBDatabaseMetadata>(name=");
+ LogParam(p.name(), l);
+ l->append(", version=");
+ LogParam(p.version(), l);
+ l->append(", object_stores=");
+ LogParam(p.object_stores(), l);
+ l->append(")");
+}
+
+void ParamTraits<IndexedDBObjectStoreMetadata>::Write(Message* m,
+ const param_type& p) {
+ WriteParam(m, p.name());
+ WriteParam(m, p.key_path());
+ WriteParam(m, p.auto_increment());
+ WriteParam(m, p.indexes());
+}
+
+bool ParamTraits<IndexedDBObjectStoreMetadata>::Read(const Message* m,
+ PickleIterator* iter,
+ param_type* r) {
+ string16 name;
+ if (!ReadParam(m, iter, &name))
+ return false;
+
+ IndexedDBKeyPath key_path;
+ if (!ReadParam(m, iter, &key_path))
+ return false;
+
+ bool auto_increment;
+ if (!ReadParam(m, iter, &auto_increment))
+ return false;
+
+ std::vector<IndexedDBIndexMetadata> indexes;
+ if (!ReadParam(m, iter, &indexes))
+ return false;
+
+ r->Set(name, key_path, auto_increment, indexes);
+ return true;
+}
+
+void ParamTraits<IndexedDBObjectStoreMetadata>::Log(const param_type& p,
+ std::string* l) {
+ l->append("<IndexedDBObjectStoreMetadata>(name=");
+ LogParam(p.name(), l);
+ l->append(", key_path=");
+ LogParam(p.key_path(), l);
+ l->append(", auto_increment=");
+ LogParam(p.auto_increment(), l);
+ l->append(", indexes=");
+ LogParam(p.indexes(), l);
+ l->append(")");
+}
+
+void ParamTraits<IndexedDBIndexMetadata>::Write(Message* m,
+ const param_type& p) {
+ WriteParam(m, p.name());
+ WriteParam(m, p.key_path());
+ WriteParam(m, p.unique());
+ WriteParam(m, p.multi_entry());
+}
+
+bool ParamTraits<IndexedDBIndexMetadata>::Read(const Message* m,
+ PickleIterator* iter,
+ param_type* r) {
+ string16 name;
+ if (!ReadParam(m, iter, &name))
+ return false;
+
+ IndexedDBKeyPath key_path;
+ if (!ReadParam(m, iter, &key_path))
+ return false;
+
+ bool unique;
+ if (!ReadParam(m, iter, &unique))
+ return false;
+
+ bool multi_entry;
+ if (!ReadParam(m, iter, &multi_entry))
+ return false;
+
+ r->Set(name, key_path, unique, multi_entry);
+ return true;
+}
+
+void ParamTraits<IndexedDBIndexMetadata>::Log(const param_type& p,
+ std::string* l) {
+ l->append("<IndexedDBIndexMetadata>(name=");
+ LogParam(p.name(), l);
+ l->append(", key_path=");
+ LogParam(p.key_path(), l);
+ l->append(", unique=");
+ LogParam(p.unique(), l);
+ l->append(", multi_entry=");
+ LogParam(p.multi_entry(), l);
+ l->append(")");
+}
+
} // namespace IPC

Powered by Google App Engine
This is Rietveld 408576698