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

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

Issue 136853003: Explicitly implement copy ctor/assignment operator for IndexedDBKey (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Actually run and pass tests Created 6 years, 11 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 | Annotate | Revision Log
« 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 44
45 } // namespace 45 } // namespace
46 46
47 IndexedDBKey::IndexedDBKey() 47 IndexedDBKey::IndexedDBKey()
48 : type_(WebIDBKeyTypeNull), 48 : type_(WebIDBKeyTypeNull),
49 date_(0), 49 date_(0),
50 number_(0), 50 number_(0),
51 size_estimate_(kOverheadSize) {} 51 size_estimate_(kOverheadSize) {}
52 52
53 IndexedDBKey::IndexedDBKey(const IndexedDBKey& other)
54 : type_(other.type_),
55 array_(other.array_),
56 binary_(other.binary_),
57 string_(other.string_),
58 date_(other.date_),
59 number_(other.number_),
60 size_estimate_(other.size_estimate_) {
61 DCHECK((!IsValid() && !other.IsValid()) || Compare(other) == 0);
62 }
63
64 IndexedDBKey& IndexedDBKey::operator=(const IndexedDBKey& other) {
65 type_ = other.type_;
66 array_ = other.array_;
67 binary_ = other.binary_;
68 string_ = other.string_;
69 date_ = other.date_;
70 number_ = other.number_;
71 size_estimate_ = other.size_estimate_;
72 DCHECK((!IsValid() && !other.IsValid()) || Compare(other) == 0);
73 return *this;
74 }
75
53 IndexedDBKey::IndexedDBKey(WebIDBKeyType type) 76 IndexedDBKey::IndexedDBKey(WebIDBKeyType type)
54 : type_(type), date_(0), number_(0), size_estimate_(kOverheadSize) { 77 : type_(type), date_(0), number_(0), size_estimate_(kOverheadSize) {
55 DCHECK(type == WebIDBKeyTypeNull || type == WebIDBKeyTypeInvalid); 78 DCHECK(type == WebIDBKeyTypeNull || type == WebIDBKeyTypeInvalid);
56 } 79 }
57 80
58 IndexedDBKey::IndexedDBKey(double number, WebIDBKeyType type) 81 IndexedDBKey::IndexedDBKey(double number, WebIDBKeyType type)
59 : type_(type), 82 : type_(type),
60 date_(number), 83 date_(number),
61 number_(number), 84 number_(number),
62 size_estimate_(kOverheadSize + sizeof(number)) { 85 size_estimate_(kOverheadSize + sizeof(number)) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 for (size_t i = 0; i < array_.size(); i++) { 159 for (size_t i = 0; i < array_.size(); i++) {
137 if (!array_[i].IsValid()) 160 if (!array_[i].IsValid())
138 return false; 161 return false;
139 } 162 }
140 } 163 }
141 164
142 return true; 165 return true;
143 } 166 }
144 167
145 } // namespace content 168 } // 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