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

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/IDBKey.h

Issue 2801893008: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in modules/indexeddb (Closed)
Patch Set: rebase Created 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 kStringType = 3, 72 kStringType = 3,
73 kDateType = 4, 73 kDateType = 4,
74 kNumberType = 5, 74 kNumberType = 5,
75 kTypeEnumMax, 75 kTypeEnumMax,
76 }; 76 };
77 77
78 Type GetType() const { return type_; } 78 Type GetType() const { return type_; }
79 bool IsValid() const; 79 bool IsValid() const;
80 80
81 const KeyArray& Array() const { 81 const KeyArray& Array() const {
82 ASSERT(type_ == kArrayType); 82 DCHECK_EQ(type_, kArrayType);
83 return array_; 83 return array_;
84 } 84 }
85 85
86 PassRefPtr<SharedBuffer> Binary() const { 86 PassRefPtr<SharedBuffer> Binary() const {
87 ASSERT(type_ == kBinaryType); 87 DCHECK_EQ(type_, kBinaryType);
88 return binary_; 88 return binary_;
89 } 89 }
90 90
91 const String& GetString() const { 91 const String& GetString() const {
92 ASSERT(type_ == kStringType); 92 DCHECK_EQ(type_, kStringType);
93 return string_; 93 return string_;
94 } 94 }
95 95
96 double Date() const { 96 double Date() const {
97 ASSERT(type_ == kDateType); 97 DCHECK_EQ(type_, kDateType);
98 return number_; 98 return number_;
99 } 99 }
100 100
101 double Number() const { 101 double Number() const {
102 ASSERT(type_ == kNumberType); 102 DCHECK_EQ(type_, kNumberType);
103 return number_; 103 return number_;
104 } 104 }
105 105
106 int Compare(const IDBKey* other) const; 106 int Compare(const IDBKey* other) const;
107 bool IsLessThan(const IDBKey* other) const; 107 bool IsLessThan(const IDBKey* other) const;
108 bool IsEqual(const IDBKey* other) const; 108 bool IsEqual(const IDBKey* other) const;
109 109
110 // Returns a new key array with invalid keys and duplicates removed. 110 // Returns a new key array with invalid keys and duplicates removed.
111 KeyArray ToMultiEntryArray() const; 111 KeyArray ToMultiEntryArray() const;
112 112
113 private: 113 private:
114 IDBKey() : type_(kInvalidType) {} 114 IDBKey() : type_(kInvalidType) {}
115 IDBKey(Type type, double number) : type_(type), number_(number) {} 115 IDBKey(Type type, double number) : type_(type), number_(number) {}
116 explicit IDBKey(const String& value) : type_(kStringType), string_(value) {} 116 explicit IDBKey(const String& value) : type_(kStringType), string_(value) {}
117 explicit IDBKey(PassRefPtr<SharedBuffer> value) 117 explicit IDBKey(PassRefPtr<SharedBuffer> value)
118 : type_(kBinaryType), binary_(std::move(value)) {} 118 : type_(kBinaryType), binary_(std::move(value)) {}
119 explicit IDBKey(const KeyArray& key_array) 119 explicit IDBKey(const KeyArray& key_array)
120 : type_(kArrayType), array_(key_array) {} 120 : type_(kArrayType), array_(key_array) {}
121 121
122 const Type type_; 122 const Type type_;
123 const KeyArray array_; 123 const KeyArray array_;
124 RefPtr<SharedBuffer> binary_; 124 RefPtr<SharedBuffer> binary_;
125 const String string_; 125 const String string_;
126 const double number_ = 0; 126 const double number_ = 0;
127 }; 127 };
128 128
129 } // namespace blink 129 } // namespace blink
130 130
131 #endif // IDBKey_h 131 #endif // IDBKey_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/indexeddb/IDBFactory.cpp ('k') | third_party/WebKit/Source/modules/indexeddb/IDBKey.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698