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

Side by Side Diff: content/common/indexed_db/indexed_db_param_traits.cc

Issue 15659013: Revert "Migrate the IndexedDB backend from Blink to Chromium" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common/indexed_db/indexed_db_key.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/indexed_db/indexed_db_param_traits.h" 5 #include "content/common/indexed_db/indexed_db_param_traits.h"
6 6
7 #include <string>
8 #include <vector>
9 #include "content/common/indexed_db/indexed_db_key.h" 7 #include "content/common/indexed_db/indexed_db_key.h"
10 #include "content/common/indexed_db/indexed_db_key_path.h" 8 #include "content/common/indexed_db/indexed_db_key_path.h"
11 #include "content/common/indexed_db/indexed_db_key_range.h" 9 #include "content/common/indexed_db/indexed_db_key_range.h"
12 #include "ipc/ipc_message_utils.h" 10 #include "ipc/ipc_message_utils.h"
13 11
14 using content::IndexedDBKey; 12 using content::IndexedDBKey;
15 using content::IndexedDBKeyPath; 13 using content::IndexedDBKeyPath;
16 using content::IndexedDBKeyRange; 14 using content::IndexedDBKeyRange;
17 15
18 using WebKit::WebIDBKey; 16 using WebKit::WebIDBKey;
19 using WebKit::WebIDBKeyPath; 17 using WebKit::WebIDBKeyPath;
20 18
21 namespace IPC { 19 namespace IPC {
22 20
23 void ParamTraits<IndexedDBKey>::Write(Message* m, const param_type& p) { 21 void ParamTraits<IndexedDBKey>::Write(Message* m, const param_type& p) {
24 WriteParam(m, static_cast<int>(p.type())); 22 WriteParam(m, int(p.type()));
25 switch (p.type()) { 23 switch (p.type()) {
26 case WebIDBKey::ArrayType: 24 case WebIDBKey::ArrayType:
27 WriteParam(m, p.array()); 25 WriteParam(m, p.array());
28 return; 26 return;
29 case WebIDBKey::StringType: 27 case WebIDBKey::StringType:
30 WriteParam(m, p.string()); 28 WriteParam(m, p.string());
31 return; 29 return;
32 case WebIDBKey::DateType: 30 case WebIDBKey::DateType:
33 WriteParam(m, p.date()); 31 WriteParam(m, p.date());
34 return; 32 return;
35 case WebIDBKey::NumberType: 33 case WebIDBKey::NumberType:
36 WriteParam(m, p.number()); 34 WriteParam(m, p.number());
37 return; 35 return;
38 case WebIDBKey::InvalidType: 36 case WebIDBKey::InvalidType:
39 case WebIDBKey::NullType: 37 case WebIDBKey::NullType:
40 return; 38 return;
41 case WebIDBKey::MinType: 39 default:
40 // This is a placeholder for WebKit::WebIDBKey::MinType
42 NOTREACHED(); 41 NOTREACHED();
43 return; 42 return;
44 } 43 }
45 } 44 }
46 45
47 bool ParamTraits<IndexedDBKey>::Read(const Message* m, 46 bool ParamTraits<IndexedDBKey>::Read(const Message* m,
48 PickleIterator* iter, 47 PickleIterator* iter,
49 param_type* r) { 48 param_type* r) {
50 int type; 49 int type;
51 if (!ReadParam(m, iter, &type)) 50 if (!ReadParam(m, iter, &type))
(...skipping 20 matching lines...) Expand all
72 double number; 71 double number;
73 if (!ReadParam(m, iter, &number)) 72 if (!ReadParam(m, iter, &number))
74 return false; 73 return false;
75 *r = IndexedDBKey(number, web_type); 74 *r = IndexedDBKey(number, web_type);
76 return true; 75 return true;
77 } 76 }
78 case WebIDBKey::InvalidType: 77 case WebIDBKey::InvalidType:
79 case WebIDBKey::NullType: 78 case WebIDBKey::NullType:
80 *r = IndexedDBKey(web_type); 79 *r = IndexedDBKey(web_type);
81 return true; 80 return true;
82 case WebIDBKey::MinType: 81 default:
82 // This is a placeholder for WebKit::WebIDBKey::MinType
83 NOTREACHED(); 83 NOTREACHED();
84 return false; 84 return false;
85 } 85 }
86 NOTREACHED();
87 return false;
88 } 86 }
89 87
90 void ParamTraits<IndexedDBKey>::Log(const param_type& p, std::string* l) { 88 void ParamTraits<IndexedDBKey>::Log(const param_type& p, std::string* l) {
91 l->append("<IndexedDBKey>("); 89 l->append("<IndexedDBKey>(");
92 LogParam(static_cast<int>(p.type()), l); 90 LogParam(int(p.type()), l);
93 l->append(", "); 91 l->append(", ");
94 l->append("["); 92 l->append("[");
95 std::vector<IndexedDBKey>::const_iterator it = p.array().begin(); 93 std::vector<IndexedDBKey>::const_iterator it = p.array().begin();
96 while (it != p.array().end()) { 94 while (it != p.array().end()) {
97 Log(*it, l); 95 Log(*it, l);
98 ++it; 96 ++it;
99 if (it != p.array().end()) 97 if (it != p.array().end())
100 l->append(", "); 98 l->append(", ");
101 } 99 }
102 l->append("], "); 100 l->append("], ");
103 LogParam(p.string(), l); 101 LogParam(p.string(), l);
104 l->append(", "); 102 l->append(", ");
105 LogParam(p.date(), l); 103 LogParam(p.date(), l);
106 l->append(", "); 104 l->append(", ");
107 LogParam(p.number(), l); 105 LogParam(p.number(), l);
108 l->append(")"); 106 l->append(")");
109 } 107 }
110 108
111 void ParamTraits<IndexedDBKeyPath>::Write(Message* m, const param_type& p) { 109 void ParamTraits<IndexedDBKeyPath>::Write(Message* m, const param_type& p) {
112 WriteParam(m, static_cast<int>(p.type())); 110 WriteParam(m, int(p.type()));
113 switch (p.type()) { 111 switch (p.type()) {
114 case WebIDBKeyPath::ArrayType: 112 case WebIDBKeyPath::ArrayType:
115 WriteParam(m, p.array()); 113 WriteParam(m, p.array());
116 return; 114 return;
117 case WebIDBKeyPath::StringType: 115 case WebIDBKeyPath::StringType:
118 WriteParam(m, p.string()); 116 WriteParam(m, p.string());
119 return; 117 return;
120 case WebIDBKeyPath::NullType: 118 case WebIDBKeyPath::NullType:
121 return; 119 return;
122 } 120 }
(...skipping 25 matching lines...) Expand all
148 case WebIDBKeyPath::NullType: 146 case WebIDBKeyPath::NullType:
149 *r = IndexedDBKeyPath(); 147 *r = IndexedDBKeyPath();
150 return true; 148 return true;
151 } 149 }
152 NOTREACHED(); 150 NOTREACHED();
153 return false; 151 return false;
154 } 152 }
155 153
156 void ParamTraits<IndexedDBKeyPath>::Log(const param_type& p, std::string* l) { 154 void ParamTraits<IndexedDBKeyPath>::Log(const param_type& p, std::string* l) {
157 l->append("<IndexedDBKeyPath>("); 155 l->append("<IndexedDBKeyPath>(");
158 LogParam(static_cast<int>(p.type()), l); 156 LogParam(int(p.type()), l);
159 l->append(", "); 157 l->append(", ");
160 LogParam(p.string(), l); 158 LogParam(p.string(), l);
161 l->append(", "); 159 l->append(", ");
162 l->append("["); 160 l->append("[");
163 std::vector<string16>::const_iterator it = p.array().begin(); 161 std::vector<string16>::const_iterator it = p.array().begin();
164 while (it != p.array().end()) { 162 while (it != p.array().end()) {
165 LogParam(*it, l); 163 LogParam(*it, l);
166 ++it; 164 ++it;
167 if (it != p.array().end()) 165 if (it != p.array().end())
168 l->append(", "); 166 l->append(", ");
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 l->append(", upper="); 204 l->append(", upper=");
207 LogParam(p.upper(), l); 205 LogParam(p.upper(), l);
208 l->append(", lower_open="); 206 l->append(", lower_open=");
209 LogParam(p.lowerOpen(), l); 207 LogParam(p.lowerOpen(), l);
210 l->append(", upper_open="); 208 l->append(", upper_open=");
211 LogParam(p.upperOpen(), l); 209 LogParam(p.upperOpen(), l);
212 l->append(")"); 210 l->append(")");
213 } 211 }
214 212
215 } // namespace IPC 213 } // namespace IPC
OLDNEW
« no previous file with comments | « content/common/indexed_db/indexed_db_key.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698