Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(878)

Unified Diff: content/common/indexed_db/indexed_db_key.h

Issue 1071683002: IndexedDB: Use C++11 in-class member initializers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/common/indexed_db/indexed_db_key.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
};
« no previous file with comments | « no previous file | content/common/indexed_db/indexed_db_key.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698