OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/common/indexed_db/indexed_db_key.h" | 5 #include "content/common/indexed_db/indexed_db_key.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 binary_(binary), | 85 binary_(binary), |
86 size_estimate_(kOverheadSize + | 86 size_estimate_(kOverheadSize + |
87 (binary.length() * sizeof(std::string::value_type))) {} | 87 (binary.length() * sizeof(std::string::value_type))) {} |
88 | 88 |
89 IndexedDBKey::IndexedDBKey(const base::string16& string) | 89 IndexedDBKey::IndexedDBKey(const base::string16& string) |
90 : type_(WebIDBKeyTypeString), | 90 : type_(WebIDBKeyTypeString), |
91 string_(string), | 91 string_(string), |
92 size_estimate_(kOverheadSize + | 92 size_estimate_(kOverheadSize + |
93 (string.length() * sizeof(base::string16::value_type))) {} | 93 (string.length() * sizeof(base::string16::value_type))) {} |
94 | 94 |
95 IndexedDBKey::~IndexedDBKey() {} | 95 IndexedDBKey::IndexedDBKey(const IndexedDBKey& other) = default; |
| 96 IndexedDBKey::~IndexedDBKey() = default; |
| 97 IndexedDBKey& IndexedDBKey::operator=(const IndexedDBKey& other) = default; |
96 | 98 |
97 bool IndexedDBKey::IsValid() const { | 99 bool IndexedDBKey::IsValid() const { |
98 if (type_ == WebIDBKeyTypeInvalid || type_ == WebIDBKeyTypeNull) | 100 if (type_ == WebIDBKeyTypeInvalid || type_ == WebIDBKeyTypeNull) |
99 return false; | 101 return false; |
100 | 102 |
101 if (type_ == WebIDBKeyTypeArray) { | 103 if (type_ == WebIDBKeyTypeArray) { |
102 for (size_t i = 0; i < array_.size(); i++) { | 104 for (size_t i = 0; i < array_.size(); i++) { |
103 if (!array_[i].IsValid()) | 105 if (!array_[i].IsValid()) |
104 return false; | 106 return false; |
105 } | 107 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 case WebIDBKeyTypeInvalid: | 143 case WebIDBKeyTypeInvalid: |
142 case WebIDBKeyTypeNull: | 144 case WebIDBKeyTypeNull: |
143 case WebIDBKeyTypeMin: | 145 case WebIDBKeyTypeMin: |
144 default: | 146 default: |
145 NOTREACHED(); | 147 NOTREACHED(); |
146 return 0; | 148 return 0; |
147 } | 149 } |
148 } | 150 } |
149 | 151 |
150 } // namespace content | 152 } // namespace content |
OLD | NEW |