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

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: Move IndexedDBKeyPath to content namespace, formatting nits. 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..101cd8221b0608876dc7162e368bab1eeb3a5d65 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<content::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<content::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: {
+ 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<content::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());
« no previous file with comments | « content/common/indexed_db/indexed_db_param_traits.h ('k') | content/common/indexed_db/proxy_webidbdatabase_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698