Chromium Code Reviews| Index: content/common/indexed_db/indexed_db_key.h |
| diff --git a/content/common/indexed_db/indexed_db_key.h b/content/common/indexed_db/indexed_db_key.h |
| index d9dfa1e340cb4a313726146a8d89e0f15c7e3560..3f7b60e150af97e4d5345c5a379769b6e0f10e71 100644 |
| --- a/content/common/indexed_db/indexed_db_key.h |
| +++ b/content/common/indexed_db/indexed_db_key.h |
| @@ -9,6 +9,7 @@ |
| #include <vector> |
| #include "base/basictypes.h" |
| +#include "base/logging.h" |
| #include "base/memory/scoped_vector.h" |
| #include "base/strings/string16.h" |
| #include "content/common/content_export.h" |
| @@ -41,11 +42,26 @@ class CONTENT_EXPORT IndexedDBKey { |
| bool Equals(const IndexedDBKey& other) const; |
| blink::WebIDBKeyType type() const { return type_; } |
| - const std::vector<IndexedDBKey>& array() const { return array_; } |
| - const std::string& binary() const { return binary_; } |
| - const base::string16& string() const { return string_; } |
| - double date() const { return date_; } |
| - double number() const { return number_; } |
| + const std::vector<IndexedDBKey>& array() const { |
| + DCHECK(type_ == blink::WebIDBKeyTypeArray); |
|
cmumford
2015/04/08 22:16:32
DCHECK_EQ - also for the others below.
jsbell
2015/04/08 23:09:52
Oops. Done.
|
| + return array_; |
| + } |
| + const std::string& binary() const { |
| + DCHECK(type_ == blink::WebIDBKeyTypeBinary); |
| + return binary_; |
| + } |
| + const base::string16& string() const { |
| + DCHECK(type_ == blink::WebIDBKeyTypeString); |
| + return string_; |
| + } |
| + double date() const { |
| + DCHECK(type_ == blink::WebIDBKeyTypeDate); |
| + return number_; |
| + } |
| + double number() const { |
| + DCHECK(type_ == blink::WebIDBKeyTypeNumber); |
| + return number_; |
| + } |
| size_t size_estimate() const { return size_estimate_; } |
| @@ -56,8 +72,7 @@ class CONTENT_EXPORT IndexedDBKey { |
| std::vector<IndexedDBKey> array_; |
| std::string binary_; |
| base::string16 string_; |
| - double date_; |
| - double number_; |
| + double number_ = 0; |
| size_t size_estimate_; |
| }; |