OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/common/indexed_db/indexed_db_key.h" | 7 #include "content/common/indexed_db/indexed_db_key.h" |
8 #include "content/public/common/serialized_script_value.h" | 8 #include "content/public/common/serialized_script_value.h" |
9 #include "ipc/ipc_message_utils.h" | 9 #include "ipc/ipc_message_utils.h" |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 case WebKit::WebIDBKey::StringType: | 55 case WebKit::WebIDBKey::StringType: |
56 WriteParam(m, p.string()); | 56 WriteParam(m, p.string()); |
57 return; | 57 return; |
58 case WebKit::WebIDBKey::DateType: | 58 case WebKit::WebIDBKey::DateType: |
59 WriteParam(m, p.date()); | 59 WriteParam(m, p.date()); |
60 return; | 60 return; |
61 case WebKit::WebIDBKey::NumberType: | 61 case WebKit::WebIDBKey::NumberType: |
62 WriteParam(m, p.number()); | 62 WriteParam(m, p.number()); |
63 return; | 63 return; |
64 case WebKit::WebIDBKey::InvalidType: | 64 case WebKit::WebIDBKey::InvalidType: |
| 65 default: |
| 66 // TODO(jsbell): Remove "default" label once WebKit bug 76487 has rolled. |
| 67 // http://crbug.com/110956 |
65 return; | 68 return; |
66 } | 69 } |
67 NOTREACHED(); | 70 NOTREACHED(); |
68 } | 71 } |
69 | 72 |
70 bool ParamTraits<IndexedDBKey>::Read(const Message* m, | 73 bool ParamTraits<IndexedDBKey>::Read(const Message* m, |
71 void** iter, | 74 void** iter, |
72 param_type* r) { | 75 param_type* r) { |
73 int type; | 76 int type; |
74 if (!ReadParam(m, iter, &type)) | 77 if (!ReadParam(m, iter, &type)) |
(...skipping 26 matching lines...) Expand all Loading... |
101 } | 104 } |
102 case WebKit::WebIDBKey::NumberType: | 105 case WebKit::WebIDBKey::NumberType: |
103 { | 106 { |
104 double number; | 107 double number; |
105 if (!ReadParam(m, iter, &number)) | 108 if (!ReadParam(m, iter, &number)) |
106 return false; | 109 return false; |
107 r->SetNumber(number); | 110 r->SetNumber(number); |
108 return true; | 111 return true; |
109 } | 112 } |
110 case WebKit::WebIDBKey::InvalidType: | 113 case WebKit::WebIDBKey::InvalidType: |
| 114 default: |
| 115 // TODO(jsbell): Remove "default" label once WebKit bug 76487 has rolled. |
| 116 // http://crbug.com/110956 |
111 r->SetInvalid(); | 117 r->SetInvalid(); |
112 return true; | 118 return true; |
113 } | 119 } |
114 NOTREACHED(); | 120 NOTREACHED(); |
115 return false; | 121 return false; |
116 } | 122 } |
117 | 123 |
118 void ParamTraits<IndexedDBKey>::Log(const param_type& p, std::string* l) { | 124 void ParamTraits<IndexedDBKey>::Log(const param_type& p, std::string* l) { |
119 l->append("<IndexedDBKey>("); | 125 l->append("<IndexedDBKey>("); |
120 LogParam(int(p.type()), l); | 126 LogParam(int(p.type()), l); |
121 l->append(", "); | 127 l->append(", "); |
122 l->append("["); | 128 l->append("["); |
123 std::vector<IndexedDBKey>::const_iterator it = p.array().begin(); | 129 std::vector<IndexedDBKey>::const_iterator it = p.array().begin(); |
124 while (it != p.array().end()) { | 130 while (it != p.array().end()) { |
125 Log(*it, l); | 131 Log(*it, l); |
126 ++it; | 132 ++it; |
127 if (it != p.array().end()) | 133 if (it != p.array().end()) |
128 l->append(", "); | 134 l->append(", "); |
129 } | 135 } |
130 l->append("], "); | 136 l->append("], "); |
131 LogParam(p.string(), l); | 137 LogParam(p.string(), l); |
132 l->append(", "); | 138 l->append(", "); |
133 LogParam(p.date(), l); | 139 LogParam(p.date(), l); |
134 l->append(", "); | 140 l->append(", "); |
135 LogParam(p.number(), l); | 141 LogParam(p.number(), l); |
136 l->append(")"); | 142 l->append(")"); |
137 } | 143 } |
138 | 144 |
139 } // namespace IPC | 145 } // namespace IPC |
OLD | NEW |