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

Unified Diff: content/browser/indexed_db/indexed_db_struct_traits.cc

Issue 1963293002: Replacing Indexed DB Chromium IPC with Mojo Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Some (incomplete) work on struct traits. Created 4 years, 5 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/browser/indexed_db/indexed_db_struct_traits.cc
diff --git a/content/browser/indexed_db/indexed_db_struct_traits.cc b/content/browser/indexed_db/indexed_db_struct_traits.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b4b0ce880b8b13752930360f3235cf155b075040
--- /dev/null
+++ b/content/browser/indexed_db/indexed_db_struct_traits.cc
@@ -0,0 +1,45 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/indexed_db/indexed_db_struct_traits.h"
+
+using indexed_db::mojom::KeyPathType;
+
+namespace mojo {
+
+KeyPathType EnumTraits<KeyPathType, blink::WebIDBKeyPathType>::ToMojom(
+ blink::WebIDBKeyPathType input) {
+ switch (input) {
+ case blink::WebIDBKeyPathTypeNull:
+ return KeyPathType::NONE;
+ case blink::WebIDBKeyPathTypeString:
+ return KeyPathType::STRING;
+ case blink::WebIDBKeyPathTypeArray:
+ return KeyPathType::ARRAY;
+ }
+
+ NOTREACHED();
+ return KeyPathType::NONE;
+}
+
+bool EnumTraits<KeyPathType, blink::WebIDBKeyPathType>::FromMojom(
+ KeyPathType input,
+ blink::WebIDBKeyPathType* output) {
+ switch (input) {
+ case KeyPathType::NONE:
+ *output = blink::WebIDBKeyPathTypeNull;
+ return true;
+ case KeyPathType::STRING:
+ *output = blink::WebIDBKeyPathTypeString;
+ return true;
+ case KeyPathType::ARRAY:
+ *output = blink::WebIDBKeyPathTypeArray;
+ return true;
+ }
+
+ NOTREACHED();
+ return false;
+}
+
+} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698