OLD | NEW |
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_key.h" | 5 #include "content/common/indexed_db/indexed_db_key.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 return (date_ < other.date_) ? -1 : (date_ > other.date_) ? 1 : 0; | 132 return (date_ < other.date_) ? -1 : (date_ > other.date_) ? 1 : 0; |
133 case WebIDBKeyTypeNumber: | 133 case WebIDBKeyTypeNumber: |
134 return (number_ < other.number_) ? -1 : (number_ > other.number_) ? 1 : 0; | 134 return (number_ < other.number_) ? -1 : (number_ > other.number_) ? 1 : 0; |
135 case WebIDBKeyTypeInvalid: | 135 case WebIDBKeyTypeInvalid: |
136 case WebIDBKeyTypeNull: | 136 case WebIDBKeyTypeNull: |
137 case WebIDBKeyTypeMin: | 137 case WebIDBKeyTypeMin: |
138 default: | 138 default: |
139 NOTREACHED(); | 139 NOTREACHED(); |
140 return 0; | 140 return 0; |
141 } | 141 } |
142 NOTREACHED(); | |
143 return 0; | |
144 } | 142 } |
145 | 143 |
146 bool IndexedDBKey::IsLessThan(const IndexedDBKey& other) const { | 144 bool IndexedDBKey::IsLessThan(const IndexedDBKey& other) const { |
147 return Compare(other) < 0; | 145 return Compare(other) < 0; |
148 } | 146 } |
149 | 147 |
150 bool IndexedDBKey::IsEqual(const IndexedDBKey& other) const { | 148 bool IndexedDBKey::IsEqual(const IndexedDBKey& other) const { |
151 return !Compare(other); | 149 return !Compare(other); |
152 } | 150 } |
153 | 151 |
154 bool IndexedDBKey::IsValid() const { | 152 bool IndexedDBKey::IsValid() const { |
155 if (type_ == WebIDBKeyTypeInvalid || type_ == WebIDBKeyTypeNull) | 153 if (type_ == WebIDBKeyTypeInvalid || type_ == WebIDBKeyTypeNull) |
156 return false; | 154 return false; |
157 | 155 |
158 if (type_ == WebIDBKeyTypeArray) { | 156 if (type_ == WebIDBKeyTypeArray) { |
159 for (size_t i = 0; i < array_.size(); i++) { | 157 for (size_t i = 0; i < array_.size(); i++) { |
160 if (!array_[i].IsValid()) | 158 if (!array_[i].IsValid()) |
161 return false; | 159 return false; |
162 } | 160 } |
163 } | 161 } |
164 | 162 |
165 return true; | 163 return true; |
166 } | 164 } |
167 | 165 |
168 } // namespace content | 166 } // namespace content |
OLD | NEW |