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

Unified Diff: content/browser/indexed_db/indexed_db_leveldb_coding.cc

Issue 1549113002: Switch to standard integer types in content/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/indexed_db/indexed_db_leveldb_coding.cc
diff --git a/content/browser/indexed_db/indexed_db_leveldb_coding.cc b/content/browser/indexed_db/indexed_db_leveldb_coding.cc
index f4d01dec591a6107113f547bc12b80b71d3ccd83..fe46ea414503c1484b138447d3d8d8b7617db214 100644
--- a/content/browser/indexed_db/indexed_db_leveldb_coding.cc
+++ b/content/browser/indexed_db/indexed_db_leveldb_coding.cc
@@ -223,7 +223,7 @@ static const unsigned char kIndexMetaDataTypeMaximum = 255;
const unsigned char kMinimumIndexId = 30;
-inline void EncodeIntSafely(int64 value, int64 max, std::string* into) {
+inline void EncodeIntSafely(int64_t value, int64_t max, std::string* into) {
DCHECK_LE(value, max);
return EncodeInt(value, into);
}
@@ -248,12 +248,12 @@ void EncodeBool(bool value, std::string* into) {
into->push_back(value ? 1 : 0);
}
-void EncodeInt(int64 value, std::string* into) {
+void EncodeInt(int64_t value, std::string* into) {
#ifndef NDEBUG
// Exercised by unit tests in debug only.
DCHECK_GE(value, 0);
#endif
- uint64 n = static_cast<uint64>(value);
+ uint64_t n = static_cast<uint64_t>(value);
do {
unsigned char c = n;
@@ -262,12 +262,12 @@ void EncodeInt(int64 value, std::string* into) {
} while (n);
}
-void EncodeVarInt(int64 value, std::string* into) {
+void EncodeVarInt(int64_t value, std::string* into) {
#ifndef NDEBUG
// Exercised by unit tests in debug only.
DCHECK_GE(value, 0);
#endif
- uint64 n = static_cast<uint64>(value);
+ uint64_t n = static_cast<uint64_t>(value);
do {
unsigned char c = n & 0x7f;
@@ -404,16 +404,16 @@ bool DecodeBool(StringPiece* slice, bool* value) {
return true;
}
-bool DecodeInt(StringPiece* slice, int64* value) {
+bool DecodeInt(StringPiece* slice, int64_t* value) {
if (slice->empty())
return false;
StringPiece::const_iterator it = slice->begin();
int shift = 0;
- int64 ret = 0;
+ int64_t ret = 0;
while (it != slice->end()) {
unsigned char c = *it++;
- ret |= static_cast<int64>(c) << shift;
+ ret |= static_cast<int64_t>(c) << shift;
shift += 8;
}
*value = ret;
@@ -421,19 +421,19 @@ bool DecodeInt(StringPiece* slice, int64* value) {
return true;
}
-bool DecodeVarInt(StringPiece* slice, int64* value) {
+bool DecodeVarInt(StringPiece* slice, int64_t* value) {
if (slice->empty())
return false;
StringPiece::const_iterator it = slice->begin();
int shift = 0;
- int64 ret = 0;
+ int64_t ret = 0;
do {
if (it == slice->end())
return false;
unsigned char c = *it;
- ret |= static_cast<int64>(c & 0x7f) << shift;
+ ret |= static_cast<int64_t>(c & 0x7f) << shift;
shift += 7;
} while (*it++ & 0x80);
*value = ret;
@@ -466,7 +466,7 @@ bool DecodeStringWithLength(StringPiece* slice, base::string16* value) {
if (slice->empty())
return false;
- int64 length = 0;
+ int64_t length = 0;
if (!DecodeVarInt(slice, &length) || length < 0)
return false;
size_t bytes = length * sizeof(base::char16);
@@ -485,7 +485,7 @@ bool DecodeBinary(StringPiece* slice, std::string* value) {
if (slice->empty())
return false;
- int64 length = 0;
+ int64_t length = 0;
if (!DecodeVarInt(slice, &length) || length < 0)
return false;
size_t size = length;
@@ -510,7 +510,7 @@ bool DecodeIDBKey(StringPiece* slice, scoped_ptr<IndexedDBKey>* value) {
return true;
case kIndexedDBKeyArrayTypeByte: {
- int64 length = 0;
+ int64_t length = 0;
if (!DecodeVarInt(slice, &length) || length < 0)
return false;
IndexedDBKey::KeyArray array;
@@ -599,7 +599,7 @@ bool DecodeIDBKeyPath(StringPiece* slice, IndexedDBKeyPath* value) {
}
case WebIDBKeyPathTypeArray: {
std::vector<base::string16> array;
- int64 count;
+ int64_t count;
if (!DecodeVarInt(slice, &count))
return false;
DCHECK_GE(count, 0);
@@ -621,8 +621,8 @@ bool DecodeIDBKeyPath(StringPiece* slice, IndexedDBKeyPath* value) {
bool DecodeBlobJournal(StringPiece* slice, BlobJournalType* journal) {
BlobJournalType output;
while (!slice->empty()) {
- int64 database_id = -1;
- int64 blob_key = -1;
+ int64_t database_id = -1;
+ int64_t blob_key = -1;
if (!DecodeVarInt(slice, &database_id))
return false;
if (!KeyPrefix::IsValidDatabaseId(database_id))
@@ -648,7 +648,7 @@ bool ConsumeEncodedIDBKey(StringPiece* slice) {
case kIndexedDBKeyMinKeyTypeByte:
return true;
case kIndexedDBKeyArrayTypeByte: {
- int64 length;
+ int64_t length;
if (!DecodeVarInt(slice, &length))
return false;
while (length--) {
@@ -658,7 +658,7 @@ bool ConsumeEncodedIDBKey(StringPiece* slice) {
return true;
}
case kIndexedDBKeyBinaryTypeByte: {
- int64 length = 0;
+ int64_t length = 0;
if (!DecodeVarInt(slice, &length) || length < 0)
return false;
if (slice->size() < static_cast<size_t>(length))
@@ -667,7 +667,7 @@ bool ConsumeEncodedIDBKey(StringPiece* slice) {
return true;
}
case kIndexedDBKeyStringTypeByte: {
- int64 length = 0;
+ int64_t length = 0;
if (!DecodeVarInt(slice, &length) || length < 0)
return false;
if (slice->size() < static_cast<size_t>(length) * sizeof(base::char16))
@@ -721,7 +721,7 @@ static WebIDBKeyType KeyTypeByteToKeyType(unsigned char type) {
int CompareEncodedStringsWithLength(StringPiece* slice1,
StringPiece* slice2,
bool* ok) {
- int64 len1, len2;
+ int64_t len1, len2;
if (!DecodeVarInt(slice1, &len1) || !DecodeVarInt(slice2, &len2)) {
*ok = false;
return 0;
@@ -754,7 +754,7 @@ int CompareEncodedStringsWithLength(StringPiece* slice1,
int CompareEncodedBinary(StringPiece* slice1,
StringPiece* slice2,
bool* ok) {
- int64 len1, len2;
+ int64_t len1, len2;
if (!DecodeVarInt(slice1, &len1) || !DecodeVarInt(slice2, &len2)) {
*ok = false;
return 0;
@@ -786,13 +786,13 @@ int CompareEncodedBinary(StringPiece* slice1,
return binary1.compare(binary2);
}
-static int CompareInts(int64 a, int64 b) {
+static int CompareInts(int64_t a, int64_t b) {
#ifndef NDEBUG
// Exercised by unit tests in debug only.
DCHECK_GE(a, 0);
DCHECK_GE(b, 0);
#endif
- int64 diff = a - b;
+ int64_t diff = a - b;
if (diff < 0)
return -1;
if (diff > 0)
@@ -831,13 +831,13 @@ int CompareEncodedIDBKeys(StringPiece* slice_a,
// Null type or max type; no payload to compare.
return 0;
case kIndexedDBKeyArrayTypeByte: {
- int64 length_a, length_b;
+ int64_t length_a, length_b;
if (!DecodeVarInt(slice_a, &length_a) ||
!DecodeVarInt(slice_b, &length_b)) {
*ok = false;
return 0;
}
- for (int64 i = 0; i < length_a && i < length_b; ++i) {
+ for (int64_t i = 0; i < length_a && i < length_b; ++i) {
int result = CompareEncodedIDBKeys(slice_a, slice_b, ok);
if (!*ok || result)
return result;
@@ -940,8 +940,8 @@ int CompareSuffix<IndexDataKey>(StringPiece* slice_a,
return 0;
// sequence number [optional]
- int64 sequence_number_a = -1;
- int64 sequence_number_b = -1;
+ int64_t sequence_number_a = -1;
+ int64_t sequence_number_b = -1;
if (!slice_a->empty() && !DecodeVarInt(slice_a, &sequence_number_a))
return 0;
if (!slice_b->empty() && !DecodeVarInt(slice_b, &sequence_number_b))
@@ -1133,12 +1133,12 @@ KeyPrefix::KeyPrefix()
object_store_id_(INVALID_TYPE),
index_id_(INVALID_TYPE) {}
-KeyPrefix::KeyPrefix(int64 database_id)
+KeyPrefix::KeyPrefix(int64_t database_id)
: database_id_(database_id), object_store_id_(0), index_id_(0) {
DCHECK(KeyPrefix::IsValidDatabaseId(database_id));
}
-KeyPrefix::KeyPrefix(int64 database_id, int64 object_store_id)
+KeyPrefix::KeyPrefix(int64_t database_id, int64_t object_store_id)
: database_id_(database_id),
object_store_id_(object_store_id),
index_id_(0) {
@@ -1146,7 +1146,9 @@ KeyPrefix::KeyPrefix(int64 database_id, int64 object_store_id)
DCHECK(KeyPrefix::IsValidObjectStoreId(object_store_id));
}
-KeyPrefix::KeyPrefix(int64 database_id, int64 object_store_id, int64 index_id)
+KeyPrefix::KeyPrefix(int64_t database_id,
+ int64_t object_store_id,
+ int64_t index_id)
: database_id_(database_id),
object_store_id_(object_store_id),
index_id_(index_id) {
@@ -1156,9 +1158,9 @@ KeyPrefix::KeyPrefix(int64 database_id, int64 object_store_id, int64 index_id)
}
KeyPrefix::KeyPrefix(enum Type type,
- int64 database_id,
- int64 object_store_id,
- int64 index_id)
+ int64_t database_id,
+ int64_t object_store_id,
+ int64_t index_id)
: database_id_(database_id),
object_store_id_(object_store_id),
index_id_(index_id) {
@@ -1167,25 +1169,25 @@ KeyPrefix::KeyPrefix(enum Type type,
DCHECK(KeyPrefix::IsValidObjectStoreId(object_store_id));
}
-KeyPrefix KeyPrefix::CreateWithSpecialIndex(int64 database_id,
- int64 object_store_id,
- int64 index_id) {
+KeyPrefix KeyPrefix::CreateWithSpecialIndex(int64_t database_id,
+ int64_t object_store_id,
+ int64_t index_id) {
DCHECK(KeyPrefix::IsValidDatabaseId(database_id));
DCHECK(KeyPrefix::IsValidObjectStoreId(object_store_id));
DCHECK(index_id);
return KeyPrefix(INVALID_TYPE, database_id, object_store_id, index_id);
}
-bool KeyPrefix::IsValidDatabaseId(int64 database_id) {
+bool KeyPrefix::IsValidDatabaseId(int64_t database_id) {
return (database_id > 0) && (database_id < KeyPrefix::kMaxDatabaseId);
}
-bool KeyPrefix::IsValidObjectStoreId(int64 object_store_id) {
+bool KeyPrefix::IsValidObjectStoreId(int64_t object_store_id) {
return (object_store_id > 0) &&
(object_store_id < KeyPrefix::kMaxObjectStoreId);
}
-bool KeyPrefix::IsValidIndexId(int64 index_id) {
+bool KeyPrefix::IsValidIndexId(int64_t index_id) {
return (index_id >= kMinimumIndexId) && (index_id < KeyPrefix::kMaxIndexId);
}
@@ -1236,9 +1238,9 @@ std::string KeyPrefix::Encode() const {
return EncodeInternal(database_id_, object_store_id_, index_id_);
}
-std::string KeyPrefix::EncodeInternal(int64 database_id,
- int64 object_store_id,
- int64 index_id) {
+std::string KeyPrefix::EncodeInternal(int64_t database_id,
+ int64_t object_store_id,
+ int64_t index_id) {
std::string database_id_string;
std::string object_store_id_string;
std::string index_id_string;
@@ -1356,7 +1358,7 @@ bool DatabaseFreeListKey::Decode(StringPiece* slice,
return true;
}
-std::string DatabaseFreeListKey::Encode(int64 database_id) {
+std::string DatabaseFreeListKey::Encode(int64_t database_id) {
std::string ret = KeyPrefix::EncodeEmpty();
ret.push_back(kDatabaseFreeListTypeByte);
EncodeVarInt(database_id, &ret);
@@ -1364,10 +1366,10 @@ std::string DatabaseFreeListKey::Encode(int64 database_id) {
}
std::string DatabaseFreeListKey::EncodeMaxKey() {
- return Encode(std::numeric_limits<int64>::max());
+ return Encode(std::numeric_limits<int64_t>::max());
}
-int64 DatabaseFreeListKey::DatabaseId() const {
+int64_t DatabaseFreeListKey::DatabaseId() const {
DCHECK_GE(database_id_, 0);
return database_id_;
}
@@ -1421,15 +1423,15 @@ int DatabaseNameKey::Compare(const DatabaseNameKey& other) {
return database_name_.compare(other.database_name_);
}
-bool DatabaseMetaDataKey::IsValidBlobKey(int64 blob_key) {
+bool DatabaseMetaDataKey::IsValidBlobKey(int64_t blob_key) {
return blob_key >= kBlobKeyGeneratorInitialNumber;
}
-const int64 DatabaseMetaDataKey::kAllBlobsKey = 1;
-const int64 DatabaseMetaDataKey::kBlobKeyGeneratorInitialNumber = 2;
-const int64 DatabaseMetaDataKey::kInvalidBlobKey = -1;
+const int64_t DatabaseMetaDataKey::kAllBlobsKey = 1;
+const int64_t DatabaseMetaDataKey::kBlobKeyGeneratorInitialNumber = 2;
+const int64_t DatabaseMetaDataKey::kInvalidBlobKey = -1;
-std::string DatabaseMetaDataKey::Encode(int64 database_id,
+std::string DatabaseMetaDataKey::Encode(int64_t database_id,
MetaDataType meta_data_type) {
KeyPrefix prefix(database_id);
std::string ret = prefix.Encode();
@@ -1460,8 +1462,8 @@ bool ObjectStoreMetaDataKey::Decode(StringPiece* slice,
return true;
}
-std::string ObjectStoreMetaDataKey::Encode(int64 database_id,
- int64 object_store_id,
+std::string ObjectStoreMetaDataKey::Encode(int64_t database_id,
+ int64_t object_store_id,
unsigned char meta_data_type) {
KeyPrefix prefix(database_id);
std::string ret = prefix.Encode();
@@ -1471,18 +1473,17 @@ std::string ObjectStoreMetaDataKey::Encode(int64 database_id,
return ret;
}
-std::string ObjectStoreMetaDataKey::EncodeMaxKey(int64 database_id) {
- return Encode(database_id,
- std::numeric_limits<int64>::max(),
+std::string ObjectStoreMetaDataKey::EncodeMaxKey(int64_t database_id) {
+ return Encode(database_id, std::numeric_limits<int64_t>::max(),
kObjectMetaDataTypeMaximum);
}
-std::string ObjectStoreMetaDataKey::EncodeMaxKey(int64 database_id,
- int64 object_store_id) {
+std::string ObjectStoreMetaDataKey::EncodeMaxKey(int64_t database_id,
+ int64_t object_store_id) {
return Encode(database_id, object_store_id, kObjectMetaDataTypeMaximum);
}
-int64 ObjectStoreMetaDataKey::ObjectStoreId() const {
+int64_t ObjectStoreMetaDataKey::ObjectStoreId() const {
DCHECK_GE(object_store_id_, 0);
return object_store_id_;
}
@@ -1520,9 +1521,9 @@ bool IndexMetaDataKey::Decode(StringPiece* slice, IndexMetaDataKey* result) {
return true;
}
-std::string IndexMetaDataKey::Encode(int64 database_id,
- int64 object_store_id,
- int64 index_id,
+std::string IndexMetaDataKey::Encode(int64_t database_id,
+ int64_t object_store_id,
+ int64_t index_id,
unsigned char meta_data_type) {
KeyPrefix prefix(database_id);
std::string ret = prefix.Encode();
@@ -1533,17 +1534,15 @@ std::string IndexMetaDataKey::Encode(int64 database_id,
return ret;
}
-std::string IndexMetaDataKey::EncodeMaxKey(int64 database_id,
- int64 object_store_id) {
- return Encode(database_id,
- object_store_id,
- std::numeric_limits<int64>::max(),
- kIndexMetaDataTypeMaximum);
+std::string IndexMetaDataKey::EncodeMaxKey(int64_t database_id,
+ int64_t object_store_id) {
+ return Encode(database_id, object_store_id,
+ std::numeric_limits<int64_t>::max(), kIndexMetaDataTypeMaximum);
}
-std::string IndexMetaDataKey::EncodeMaxKey(int64 database_id,
- int64 object_store_id,
- int64 index_id) {
+std::string IndexMetaDataKey::EncodeMaxKey(int64_t database_id,
+ int64_t object_store_id,
+ int64_t index_id) {
return Encode(
database_id, object_store_id, index_id, kIndexMetaDataTypeMaximum);
}
@@ -1559,7 +1558,7 @@ int IndexMetaDataKey::Compare(const IndexMetaDataKey& other) {
return meta_data_type_ - other.meta_data_type_;
}
-int64 IndexMetaDataKey::IndexId() const {
+int64_t IndexMetaDataKey::IndexId() const {
DCHECK_GE(index_id_, 0);
return index_id_;
}
@@ -1583,8 +1582,8 @@ bool ObjectStoreFreeListKey::Decode(StringPiece* slice,
return true;
}
-std::string ObjectStoreFreeListKey::Encode(int64 database_id,
- int64 object_store_id) {
+std::string ObjectStoreFreeListKey::Encode(int64_t database_id,
+ int64_t object_store_id) {
KeyPrefix prefix(database_id);
std::string ret = prefix.Encode();
ret.push_back(kObjectStoreFreeListTypeByte);
@@ -1592,11 +1591,11 @@ std::string ObjectStoreFreeListKey::Encode(int64 database_id,
return ret;
}
-std::string ObjectStoreFreeListKey::EncodeMaxKey(int64 database_id) {
- return Encode(database_id, std::numeric_limits<int64>::max());
+std::string ObjectStoreFreeListKey::EncodeMaxKey(int64_t database_id) {
+ return Encode(database_id, std::numeric_limits<int64_t>::max());
}
-int64 ObjectStoreFreeListKey::ObjectStoreId() const {
+int64_t ObjectStoreFreeListKey::ObjectStoreId() const {
DCHECK_GE(object_store_id_, 0);
return object_store_id_;
}
@@ -1629,9 +1628,9 @@ bool IndexFreeListKey::Decode(StringPiece* slice, IndexFreeListKey* result) {
return true;
}
-std::string IndexFreeListKey::Encode(int64 database_id,
- int64 object_store_id,
- int64 index_id) {
+std::string IndexFreeListKey::Encode(int64_t database_id,
+ int64_t object_store_id,
+ int64_t index_id) {
KeyPrefix prefix(database_id);
std::string ret = prefix.Encode();
ret.push_back(kIndexFreeListTypeByte);
@@ -1640,10 +1639,10 @@ std::string IndexFreeListKey::Encode(int64 database_id,
return ret;
}
-std::string IndexFreeListKey::EncodeMaxKey(int64 database_id,
- int64 object_store_id) {
- return Encode(
- database_id, object_store_id, std::numeric_limits<int64>::max());
+std::string IndexFreeListKey::EncodeMaxKey(int64_t database_id,
+ int64_t object_store_id) {
+ return Encode(database_id, object_store_id,
+ std::numeric_limits<int64_t>::max());
}
int IndexFreeListKey::Compare(const IndexFreeListKey& other) {
@@ -1654,12 +1653,12 @@ int IndexFreeListKey::Compare(const IndexFreeListKey& other) {
return CompareInts(index_id_, other.index_id_);
}
-int64 IndexFreeListKey::ObjectStoreId() const {
+int64_t IndexFreeListKey::ObjectStoreId() const {
DCHECK_GE(object_store_id_, 0);
return object_store_id_;
}
-int64 IndexFreeListKey::IndexId() const {
+int64_t IndexFreeListKey::IndexId() const {
DCHECK_GE(index_id_, 0);
return index_id_;
}
@@ -1685,7 +1684,7 @@ bool ObjectStoreNamesKey::Decode(StringPiece* slice,
}
std::string ObjectStoreNamesKey::Encode(
- int64 database_id,
+ int64_t database_id,
const base::string16& object_store_name) {
KeyPrefix prefix(database_id);
std::string ret = prefix.Encode();
@@ -1720,8 +1719,8 @@ bool IndexNamesKey::Decode(StringPiece* slice, IndexNamesKey* result) {
return true;
}
-std::string IndexNamesKey::Encode(int64 database_id,
- int64 object_store_id,
+std::string IndexNamesKey::Encode(int64_t database_id,
+ int64_t object_store_id,
const base::string16& index_name) {
KeyPrefix prefix(database_id);
std::string ret = prefix.Encode();
@@ -1754,8 +1753,8 @@ bool ObjectStoreDataKey::Decode(StringPiece* slice,
return true;
}
-std::string ObjectStoreDataKey::Encode(int64 database_id,
- int64 object_store_id,
+std::string ObjectStoreDataKey::Encode(int64_t database_id,
+ int64_t object_store_id,
const std::string encoded_user_key) {
KeyPrefix prefix(KeyPrefix::CreateWithSpecialIndex(
database_id, object_store_id, kSpecialIndexNumber));
@@ -1765,8 +1764,8 @@ std::string ObjectStoreDataKey::Encode(int64 database_id,
return ret;
}
-std::string ObjectStoreDataKey::Encode(int64 database_id,
- int64 object_store_id,
+std::string ObjectStoreDataKey::Encode(int64_t database_id,
+ int64_t object_store_id,
const IndexedDBKey& user_key) {
std::string encoded_key;
EncodeIDBKey(user_key, &encoded_key);
@@ -1782,7 +1781,7 @@ scoped_ptr<IndexedDBKey> ObjectStoreDataKey::user_key() const {
return key.Pass();
}
-const int64 ObjectStoreDataKey::kSpecialIndexNumber = kObjectStoreDataIndexId;
+const int64_t ObjectStoreDataKey::kSpecialIndexNumber = kObjectStoreDataIndexId;
ExistsEntryKey::ExistsEntryKey() {}
ExistsEntryKey::~ExistsEntryKey() {}
@@ -1799,8 +1798,8 @@ bool ExistsEntryKey::Decode(StringPiece* slice, ExistsEntryKey* result) {
return true;
}
-std::string ExistsEntryKey::Encode(int64 database_id,
- int64 object_store_id,
+std::string ExistsEntryKey::Encode(int64_t database_id,
+ int64_t object_store_id,
const std::string& encoded_key) {
KeyPrefix prefix(KeyPrefix::CreateWithSpecialIndex(
database_id, object_store_id, kSpecialIndexNumber));
@@ -1809,8 +1808,8 @@ std::string ExistsEntryKey::Encode(int64 database_id,
return ret;
}
-std::string ExistsEntryKey::Encode(int64 database_id,
- int64 object_store_id,
+std::string ExistsEntryKey::Encode(int64_t database_id,
+ int64_t object_store_id,
const IndexedDBKey& user_key) {
std::string encoded_key;
EncodeIDBKey(user_key, &encoded_key);
@@ -1826,7 +1825,7 @@ scoped_ptr<IndexedDBKey> ExistsEntryKey::user_key() const {
return key.Pass();
}
-const int64 ExistsEntryKey::kSpecialIndexNumber = kExistsEntryIndexId;
+const int64_t ExistsEntryKey::kSpecialIndexNumber = kExistsEntryIndexId;
bool BlobEntryKey::Decode(StringPiece* slice, BlobEntryKey* result) {
KeyPrefix prefix;
@@ -1870,14 +1869,14 @@ std::string BlobEntryKey::ReencodeToObjectStoreDataKey(StringPiece* slice) {
key.database_id_, key.object_store_id_, key.encoded_user_key_);
}
-std::string BlobEntryKey::EncodeMinKeyForObjectStore(int64 database_id,
- int64 object_store_id) {
+std::string BlobEntryKey::EncodeMinKeyForObjectStore(int64_t database_id,
+ int64_t object_store_id) {
// Our implied encoded_user_key_ here is empty, the lowest possible key.
return Encode(database_id, object_store_id, std::string());
}
-std::string BlobEntryKey::EncodeStopKeyForObjectStore(int64 database_id,
- int64 object_store_id) {
+std::string BlobEntryKey::EncodeStopKeyForObjectStore(int64_t database_id,
+ int64_t object_store_id) {
DCHECK(KeyPrefix::ValidIds(database_id, object_store_id));
KeyPrefix prefix(KeyPrefix::CreateWithSpecialIndex(
database_id, object_store_id, kSpecialIndexNumber + 1));
@@ -1889,16 +1888,16 @@ std::string BlobEntryKey::Encode() const {
return Encode(database_id_, object_store_id_, encoded_user_key_);
}
-std::string BlobEntryKey::Encode(int64 database_id,
- int64 object_store_id,
+std::string BlobEntryKey::Encode(int64_t database_id,
+ int64_t object_store_id,
const IndexedDBKey& user_key) {
std::string encoded_key;
EncodeIDBKey(user_key, &encoded_key);
return Encode(database_id, object_store_id, encoded_key);
}
-std::string BlobEntryKey::Encode(int64 database_id,
- int64 object_store_id,
+std::string BlobEntryKey::Encode(int64_t database_id,
+ int64_t object_store_id,
const std::string& encoded_user_key) {
DCHECK(KeyPrefix::ValidIds(database_id, object_store_id));
KeyPrefix prefix(KeyPrefix::CreateWithSpecialIndex(
@@ -1906,7 +1905,7 @@ std::string BlobEntryKey::Encode(int64 database_id,
return prefix.Encode() + encoded_user_key;
}
-const int64 BlobEntryKey::kSpecialIndexNumber = kBlobEntryIndexId;
+const int64_t BlobEntryKey::kSpecialIndexNumber = kBlobEntryIndexId;
IndexDataKey::IndexDataKey()
: database_id_(-1),
@@ -1946,12 +1945,12 @@ bool IndexDataKey::Decode(StringPiece* slice, IndexDataKey* result) {
return true;
}
-std::string IndexDataKey::Encode(int64 database_id,
- int64 object_store_id,
- int64 index_id,
+std::string IndexDataKey::Encode(int64_t database_id,
+ int64_t object_store_id,
+ int64_t index_id,
const std::string& encoded_user_key,
const std::string& encoded_primary_key,
- int64 sequence_number) {
+ int64_t sequence_number) {
KeyPrefix prefix(database_id, object_store_id, index_id);
std::string ret = prefix.Encode();
ret.append(encoded_user_key);
@@ -1960,9 +1959,9 @@ std::string IndexDataKey::Encode(int64 database_id,
return ret;
}
-std::string IndexDataKey::Encode(int64 database_id,
- int64 object_store_id,
- int64 index_id,
+std::string IndexDataKey::Encode(int64_t database_id,
+ int64_t object_store_id,
+ int64_t index_id,
const IndexedDBKey& user_key) {
std::string encoded_key;
EncodeIDBKey(user_key, &encoded_key);
@@ -1970,9 +1969,9 @@ std::string IndexDataKey::Encode(int64 database_id,
database_id, object_store_id, index_id, encoded_key, MinIDBKey(), 0);
}
-std::string IndexDataKey::Encode(int64 database_id,
- int64 object_store_id,
- int64 index_id,
+std::string IndexDataKey::Encode(int64_t database_id,
+ int64_t object_store_id,
+ int64_t index_id,
const IndexedDBKey& user_key,
const IndexedDBKey& user_primary_key) {
std::string encoded_key;
@@ -1987,35 +1986,31 @@ std::string IndexDataKey::Encode(int64 database_id,
0);
}
-std::string IndexDataKey::EncodeMinKey(int64 database_id,
- int64 object_store_id,
- int64 index_id) {
+std::string IndexDataKey::EncodeMinKey(int64_t database_id,
+ int64_t object_store_id,
+ int64_t index_id) {
return Encode(
database_id, object_store_id, index_id, MinIDBKey(), MinIDBKey(), 0);
}
-std::string IndexDataKey::EncodeMaxKey(int64 database_id,
- int64 object_store_id,
- int64 index_id) {
- return Encode(database_id,
- object_store_id,
- index_id,
- MaxIDBKey(),
- MaxIDBKey(),
- std::numeric_limits<int64>::max());
+std::string IndexDataKey::EncodeMaxKey(int64_t database_id,
+ int64_t object_store_id,
+ int64_t index_id) {
+ return Encode(database_id, object_store_id, index_id, MaxIDBKey(),
+ MaxIDBKey(), std::numeric_limits<int64_t>::max());
}
-int64 IndexDataKey::DatabaseId() const {
+int64_t IndexDataKey::DatabaseId() const {
DCHECK_GE(database_id_, 0);
return database_id_;
}
-int64 IndexDataKey::ObjectStoreId() const {
+int64_t IndexDataKey::ObjectStoreId() const {
DCHECK_GE(object_store_id_, 0);
return object_store_id_;
}
-int64 IndexDataKey::IndexId() const {
+int64_t IndexDataKey::IndexId() const {
DCHECK_GE(index_id_, 0);
return index_id_;
}

Powered by Google App Engine
This is Rietveld 408576698