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

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

Issue 10204003: Use WebIDBKeyPath type in WebKit API, implement IndexedDBKeyPath type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Delete stray space. Created 8 years, 8 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 57fca9a2d26268e3bde9a6c393ce40312031aa30..60c3741aaef2a0cb8d347afc84f4e49b5a0d98ab 100644
--- a/content/common/indexed_db/indexed_db_param_traits.cc
+++ b/content/common/indexed_db/indexed_db_param_traits.cc
@@ -5,6 +5,7 @@
#include "content/common/indexed_db/indexed_db_param_traits.h"
#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/public/common/serialized_script_value.h"
#include "ipc/ipc_message_utils.h"
@@ -141,6 +142,70 @@ void ParamTraits<IndexedDBKey>::Log(const param_type& p, std::string* l) {
l->append(")");
}
+void ParamTraits<IndexedDBKeyPath>::Write(Message* m, const param_type& p) {
+ WriteParam(m, int(p.type()));
+ switch (p.type()) {
+ case WebKit::WebIDBKeyPath::ArrayType:
+ WriteParam(m, p.array());
+ return;
+ case WebKit::WebIDBKeyPath::StringType:
+ WriteParam(m, p.string());
+ return;
+ case WebKit::WebIDBKeyPath::NullType:
+ return;
+ }
+ NOTREACHED();
+}
+
+bool ParamTraits<IndexedDBKeyPath>::Read(const Message* m,
+ PickleIterator* iter,
+ param_type* r) {
+ int type;
+ if (!ReadParam(m, iter, &type))
+ return false;
+
+ switch (type) {
+ case WebKit::WebIDBKeyPath::ArrayType:
+ {
jam 2012/04/30 16:01:29 ditto
jsbell 2012/04/30 18:08:23 Done.
+ std::vector<string16> array;
+ if (!ReadParam(m, iter, &array))
+ return false;
+ r->SetArray(array);
+ return true;
+ }
+ case WebKit::WebIDBKeyPath::StringType:
+ {
+ string16 string;
+ if (!ReadParam(m, iter, &string))
+ return false;
+ r->SetString(string);
+ return true;
+ }
+ case WebKit::WebIDBKeyPath::NullType:
+ r->SetNull();
+ return true;
+ }
+ NOTREACHED();
+ return false;
+}
+
+void ParamTraits<IndexedDBKeyPath>::Log(const param_type& p, std::string* l) {
+ l->append("<IndexedDBKeyPath>(");
+ LogParam(int(p.type()), l);
+ l->append(", ");
+ LogParam(p.string(), l);
+ l->append(", ");
+ l->append("[");
+ std::vector<string16>::const_iterator it = p.array().begin();
+ while (it != p.array().end()) {
+ LogParam(*it, l);
+ ++it;
+ if (it != p.array().end())
+ l->append(", ");
+ }
+ l->append("])");
+}
+
void ParamTraits<IndexedDBKeyRange>::Write(Message* m, const param_type& p) {
WriteParam(m, p.lower());
WriteParam(m, p.upper());

Powered by Google App Engine
This is Rietveld 408576698