| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_LEVELDB_CODING_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_LEVELDB_CODING_H_ |
| 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_LEVELDB_CODING_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_LEVELDB_CODING_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 kMaxObjectStoreIdSizeBytes * 8 - 1; // 63 | 129 kMaxObjectStoreIdSizeBytes * 8 - 1; // 63 |
| 130 static const size_t kMaxIndexIdBits = kMaxIndexIdSizeBytes * 8 - 1; // 31 | 130 static const size_t kMaxIndexIdBits = kMaxIndexIdSizeBytes * 8 - 1; // 31 |
| 131 | 131 |
| 132 static const int64 kMaxDatabaseId = | 132 static const int64 kMaxDatabaseId = |
| 133 (1ULL << kMaxDatabaseIdBits) - 1; // max signed int64 | 133 (1ULL << kMaxDatabaseIdBits) - 1; // max signed int64 |
| 134 static const int64 kMaxObjectStoreId = | 134 static const int64 kMaxObjectStoreId = |
| 135 (1ULL << kMaxObjectStoreIdBits) - 1; // max signed int64 | 135 (1ULL << kMaxObjectStoreIdBits) - 1; // max signed int64 |
| 136 static const int64 kMaxIndexId = | 136 static const int64 kMaxIndexId = |
| 137 (1ULL << kMaxIndexIdBits) - 1; // max signed int32 | 137 (1ULL << kMaxIndexIdBits) - 1; // max signed int32 |
| 138 | 138 |
| 139 static bool IsValidDatabaseId(int64 database_id); | 139 CONTENT_EXPORT static bool IsValidDatabaseId(int64 database_id); |
| 140 static bool IsValidObjectStoreId(int64 index_id); | 140 static bool IsValidObjectStoreId(int64 index_id); |
| 141 static bool IsValidIndexId(int64 index_id); | 141 static bool IsValidIndexId(int64 index_id); |
| 142 static bool ValidIds(int64 database_id, | 142 static bool ValidIds(int64 database_id, |
| 143 int64 object_store_id, | 143 int64 object_store_id, |
| 144 int64 index_id) { | 144 int64 index_id) { |
| 145 return IsValidDatabaseId(database_id) && | 145 return IsValidDatabaseId(database_id) && |
| 146 IsValidObjectStoreId(object_store_id) && IsValidIndexId(index_id); | 146 IsValidObjectStoreId(object_store_id) && IsValidIndexId(index_id); |
| 147 } | 147 } |
| 148 static bool ValidIds(int64 database_id, int64 object_store_id) { | 148 static bool ValidIds(int64 database_id, int64 object_store_id) { |
| 149 return IsValidDatabaseId(database_id) && | 149 return IsValidDatabaseId(database_id) && |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 std::string encoded_user_key_; | 483 std::string encoded_user_key_; |
| 484 std::string encoded_primary_key_; | 484 std::string encoded_primary_key_; |
| 485 int64 sequence_number_; | 485 int64 sequence_number_; |
| 486 | 486 |
| 487 DISALLOW_COPY_AND_ASSIGN(IndexDataKey); | 487 DISALLOW_COPY_AND_ASSIGN(IndexDataKey); |
| 488 }; | 488 }; |
| 489 | 489 |
| 490 } // namespace content | 490 } // namespace content |
| 491 | 491 |
| 492 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_LEVELDB_CODING_H_ | 492 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_LEVELDB_CODING_H_ |
| OLD | NEW |