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

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: Fix copy/pasta 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
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_;
};
« no previous file with comments | « no previous file | content/common/indexed_db/indexed_db_key.cc » ('j') | content/common/indexed_db/indexed_db_key_range.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698