| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 date_(0), | 69 date_(0), |
| 70 number_(0), | 70 number_(0), |
| 71 size_estimate_(kOverheadSize + CalculateArraySize(keys)) {} | 71 size_estimate_(kOverheadSize + CalculateArraySize(keys)) {} |
| 72 | 72 |
| 73 IndexedDBKey::IndexedDBKey(const std::string& key) | 73 IndexedDBKey::IndexedDBKey(const std::string& key) |
| 74 : type_(WebIDBKeyTypeBinary), | 74 : type_(WebIDBKeyTypeBinary), |
| 75 binary_(key), | 75 binary_(key), |
| 76 size_estimate_(kOverheadSize + | 76 size_estimate_(kOverheadSize + |
| 77 (key.length() * sizeof(std::string::value_type))) {} | 77 (key.length() * sizeof(std::string::value_type))) {} |
| 78 | 78 |
| 79 IndexedDBKey::IndexedDBKey(const string16& key) | 79 IndexedDBKey::IndexedDBKey(const base::string16& key) |
| 80 : type_(WebIDBKeyTypeString), | 80 : type_(WebIDBKeyTypeString), |
| 81 string_(key), | 81 string_(key), |
| 82 size_estimate_(kOverheadSize + | 82 size_estimate_(kOverheadSize + |
| 83 (key.length() * sizeof(string16::value_type))) {} | 83 (key.length() * sizeof(base::string16::value_type))) {} |
| 84 | 84 |
| 85 IndexedDBKey::~IndexedDBKey() {} | 85 IndexedDBKey::~IndexedDBKey() {} |
| 86 | 86 |
| 87 int IndexedDBKey::Compare(const IndexedDBKey& other) const { | 87 int IndexedDBKey::Compare(const IndexedDBKey& other) const { |
| 88 DCHECK(IsValid()); | 88 DCHECK(IsValid()); |
| 89 DCHECK(other.IsValid()); | 89 DCHECK(other.IsValid()); |
| 90 if (type_ != other.type_) | 90 if (type_ != other.type_) |
| 91 return type_ > other.type_ ? -1 : 1; | 91 return type_ > other.type_ ? -1 : 1; |
| 92 | 92 |
| 93 switch (type_) { | 93 switch (type_) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 for (size_t i = 0; i < array_.size(); i++) { | 136 for (size_t i = 0; i < array_.size(); i++) { |
| 137 if (!array_[i].IsValid()) | 137 if (!array_[i].IsValid()) |
| 138 return false; | 138 return false; |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 return true; | 142 return true; |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace content | 145 } // namespace content |
| OLD | NEW |