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

Side by Side Diff: content/common/indexed_db/indexed_db_key.cc

Issue 473003003: Revert "Explicitly implement copy ctor/assignment operator for IndexedDBKey" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « content/common/indexed_db/indexed_db_key.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() {}
96 96
97 IndexedDBKey::IndexedDBKey(const IndexedDBKey& other)
98 : type_(other.type_),
99 array_(other.array_),
100 binary_(other.binary_),
101 string_(other.string_),
102 date_(other.date_),
103 number_(other.number_),
104 size_estimate_(other.size_estimate_) {
105 DCHECK((!IsValid() && !other.IsValid()) || CompareTo(other) == 0);
106 }
107
108 IndexedDBKey& IndexedDBKey::operator=(const IndexedDBKey& other) {
109 type_ = other.type_;
110 array_ = other.array_;
111 binary_ = other.binary_;
112 string_ = other.string_;
113 date_ = other.date_;
114 number_ = other.number_;
115 size_estimate_ = other.size_estimate_;
116 DCHECK((!IsValid() && !other.IsValid()) || CompareTo(other) == 0);
117 return *this;
118 }
119
120 bool IndexedDBKey::IsValid() const { 97 bool IndexedDBKey::IsValid() const {
121 if (type_ == WebIDBKeyTypeInvalid || type_ == WebIDBKeyTypeNull) 98 if (type_ == WebIDBKeyTypeInvalid || type_ == WebIDBKeyTypeNull)
122 return false; 99 return false;
123 100
124 if (type_ == WebIDBKeyTypeArray) { 101 if (type_ == WebIDBKeyTypeArray) {
125 for (size_t i = 0; i < array_.size(); i++) { 102 for (size_t i = 0; i < array_.size(); i++) {
126 if (!array_[i].IsValid()) 103 if (!array_[i].IsValid())
127 return false; 104 return false;
128 } 105 }
129 } 106 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 case WebIDBKeyTypeInvalid: 141 case WebIDBKeyTypeInvalid:
165 case WebIDBKeyTypeNull: 142 case WebIDBKeyTypeNull:
166 case WebIDBKeyTypeMin: 143 case WebIDBKeyTypeMin:
167 default: 144 default:
168 NOTREACHED(); 145 NOTREACHED();
169 return 0; 146 return 0;
170 } 147 }
171 } 148 }
172 149
173 } // namespace content 150 } // namespace content
OLDNEW
« no previous file with comments | « content/common/indexed_db/indexed_db_key.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698