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..01227819dcdaf9d00d8243c3e74265c82be40f27 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_EQ(type_, blink::WebIDBKeyTypeArray); |
+ return array_; |
+ } |
+ const std::string& binary() const { |
+ DCHECK_EQ(type_, blink::WebIDBKeyTypeBinary); |
+ return binary_; |
+ } |
+ const base::string16& string() const { |
+ DCHECK_EQ(type_, blink::WebIDBKeyTypeString); |
+ return string_; |
+ } |
+ double date() const { |
+ DCHECK_EQ(type_, blink::WebIDBKeyTypeDate); |
+ return number_; |
+ } |
+ double number() const { |
+ DCHECK_EQ(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_; |
}; |