OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 ASSERT(keyPath.isStringSequence()); | 127 ASSERT(keyPath.isStringSequence()); |
128 m_type = ArrayType; | 128 m_type = ArrayType; |
129 m_array = keyPath.getAsStringSequence(); | 129 m_array = keyPath.getAsStringSequence(); |
130 #if ENABLE(ASSERT) | 130 #if ENABLE(ASSERT) |
131 for (size_t i = 0; i < m_array.size(); ++i) | 131 for (size_t i = 0; i < m_array.size(); ++i) |
132 ASSERT(!m_array[i].isNull()); | 132 ASSERT(!m_array[i].isNull()); |
133 #endif | 133 #endif |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 IDBKeyPath::IDBKeyPath(const WebIDBKeyPath& keyPath) | 137 IDBKeyPath::IDBKeyPath(const indexed_db::mojom::blink::KeyPathPtr& keyPath) |
138 { | 138 { |
139 switch (keyPath.keyPathType()) { | 139 switch (keyPath->type) { |
140 case WebIDBKeyPathTypeNull: | 140 case indexed_db::mojom::blink::KeyPathType::NONE: |
141 m_type = NullType; | 141 m_type = NullType; |
142 return; | 142 return; |
143 | 143 |
144 case WebIDBKeyPathTypeString: | 144 case indexed_db::mojom::blink::KeyPathType::STRING: |
145 m_type = StringType; | 145 m_type = StringType; |
146 m_string = keyPath.string(); | 146 m_string = keyPath->data->get_str(); |
147 return; | 147 return; |
148 | 148 |
149 case WebIDBKeyPathTypeArray: | 149 case indexed_db::mojom::blink::KeyPathType::ARRAY: |
150 m_type = ArrayType; | 150 m_type = ArrayType; |
151 for (size_t i = 0, size = keyPath.array().size(); i < size; ++i) | 151 for (size_t i = 0, size = keyPath->data->get_arr().size(); i < size; ++i
) |
152 m_array.append(keyPath.array()[i]); | 152 m_array.append(keyPath->data->get_arr()[i]); |
153 return; | 153 return; |
154 } | 154 } |
155 ASSERT_NOT_REACHED(); | 155 ASSERT_NOT_REACHED(); |
156 } | 156 } |
157 | 157 |
158 IDBKeyPath::operator WebIDBKeyPath() const | 158 IDBKeyPath::operator WebIDBKeyPath() const |
159 { | 159 { |
160 switch (m_type) { | 160 switch (m_type) { |
161 case NullType: | 161 case NullType: |
162 return WebIDBKeyPath(); | 162 return WebIDBKeyPath(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 case StringType: | 202 case StringType: |
203 return m_string == other.m_string; | 203 return m_string == other.m_string; |
204 case ArrayType: | 204 case ArrayType: |
205 return m_array == other.m_array; | 205 return m_array == other.m_array; |
206 } | 206 } |
207 ASSERT_NOT_REACHED(); | 207 ASSERT_NOT_REACHED(); |
208 return false; | 208 return false; |
209 } | 209 } |
210 | 210 |
211 } // namespace blink | 211 } // namespace blink |
OLD | NEW |