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

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: Refactoring after Passing URLRequestContextGetter. Created 4 years, 4 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..a5122b06b209b5f204e97606d6f45744b723ddce
--- /dev/null
+++ b/content/browser/indexed_db/indexed_db_struct_traits.cc
@@ -0,0 +1,75 @@
+// 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::DataLoss;
+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;
+}
+
+DataLoss EnumTraits<DataLoss, blink::WebIDBDataLoss>::ToMojom(
+ blink::WebIDBDataLoss input) {
+ switch (input) {
+ case blink::WebIDBDataLossNone:
+ return DataLoss::None;
+ case blink::WebIDBDataLossTotal:
+ return DataLoss::Total;
+ }
+
+ NOTREACHED();
+ return DataLoss::None;
+}
+
+bool EnumTraits<DataLoss, blink::WebIDBDataLoss>::FromMojom(
+ DataLoss input,
+ blink::WebIDBDataLoss* output) {
+ switch (input) {
+ case DataLoss::None:
+ *output = blink::WebIDBDataLossNone;
+ return true;
+ case DataLoss::Total:
+ *output = blink::WebIDBDataLossTotal;
+ return true;
+ }
+
+ NOTREACHED();
+ return false;
+}
+
+} // namespace mojo
« no previous file with comments | « content/browser/indexed_db/indexed_db_struct_traits.h ('k') | content/browser/indexed_db/indexed_db_transaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698