| 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 { |
| 11 | 11 |
| 12 using WebKit::WebIDBKey; | 12 using blink::WebIDBKey; |
| 13 using WebKit::WebIDBKeyType; | 13 using blink::WebIDBKeyType; |
| 14 using WebKit::WebIDBKeyTypeArray; | 14 using blink::WebIDBKeyTypeArray; |
| 15 using WebKit::WebIDBKeyTypeDate; | 15 using blink::WebIDBKeyTypeDate; |
| 16 using WebKit::WebIDBKeyTypeInvalid; | 16 using blink::WebIDBKeyTypeInvalid; |
| 17 using WebKit::WebIDBKeyTypeMin; | 17 using blink::WebIDBKeyTypeMin; |
| 18 using WebKit::WebIDBKeyTypeNull; | 18 using blink::WebIDBKeyTypeNull; |
| 19 using WebKit::WebIDBKeyTypeNumber; | 19 using blink::WebIDBKeyTypeNumber; |
| 20 using WebKit::WebIDBKeyTypeString; | 20 using blink::WebIDBKeyTypeString; |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 // Very rough estimate of minimum key size overhead. | 24 // Very rough estimate of minimum key size overhead. |
| 25 const size_t kOverheadSize = 16; | 25 const size_t kOverheadSize = 16; |
| 26 | 26 |
| 27 static size_t CalculateArraySize(const IndexedDBKey::KeyArray& keys) { | 27 static size_t CalculateArraySize(const IndexedDBKey::KeyArray& keys) { |
| 28 size_t size(0); | 28 size_t size(0); |
| 29 for (size_t i = 0; i < keys.size(); ++i) | 29 for (size_t i = 0; i < keys.size(); ++i) |
| 30 size += keys[i].size_estimate(); | 30 size += keys[i].size_estimate(); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 for (size_t i = 0; i < array_.size(); i++) { | 127 for (size_t i = 0; i < array_.size(); i++) { |
| 128 if (!array_[i].IsValid()) | 128 if (!array_[i].IsValid()) |
| 129 return false; | 129 return false; |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 | 132 |
| 133 return true; | 133 return true; |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace content | 136 } // namespace content |
| OLD | NEW |