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

Unified Diff: content/browser/appcache/appcache_database.cc

Issue 1498003003: Remove kint64max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: INT64_MAX 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/appcache/appcache_database.cc
diff --git a/content/browser/appcache/appcache_database.cc b/content/browser/appcache/appcache_database.cc
index 8298bfb58bb6fff89a8c230800b653cc3ae4f350..aaa2ed2b4628814d4a32e054dfce4ec3a6a86a9f 100644
--- a/content/browser/appcache/appcache_database.cc
+++ b/content/browser/appcache/appcache_database.cc
@@ -218,12 +218,12 @@ void AppCacheDatabase::Disable() {
ResetConnectionAndTables();
}
-int64 AppCacheDatabase::GetOriginUsage(const GURL& origin) {
+int64_t AppCacheDatabase::GetOriginUsage(const GURL& origin) {
std::vector<CacheRecord> records;
if (!FindCachesForOrigin(origin, &records))
return 0;
- int64 origin_usage = 0;
+ int64_t origin_usage = 0;
std::vector<CacheRecord>::const_iterator iter = records.begin();
while (iter != records.end()) {
origin_usage += iter->cache_size;
@@ -232,7 +232,7 @@ int64 AppCacheDatabase::GetOriginUsage(const GURL& origin) {
return origin_usage;
}
-bool AppCacheDatabase::GetAllOriginUsage(std::map<GURL, int64>* usage_map) {
+bool AppCacheDatabase::GetAllOriginUsage(std::map<GURL, int64_t>* usage_map) {
std::set<GURL> origins;
if (!FindOriginsWithGroups(&origins))
return false;
@@ -260,8 +260,10 @@ bool AppCacheDatabase::FindOriginsWithGroups(std::set<GURL>* origins) {
}
bool AppCacheDatabase::FindLastStorageIds(
- int64* last_group_id, int64* last_cache_id, int64* last_response_id,
- int64* last_deletable_response_rowid) {
+ int64_t* last_group_id,
+ int64_t* last_cache_id,
+ int64_t* last_response_id,
+ int64_t* last_deletable_response_rowid) {
DCHECK(last_group_id && last_cache_id && last_response_id &&
last_deletable_response_rowid);
@@ -281,11 +283,11 @@ bool AppCacheDatabase::FindLastStorageIds(
"SELECT MAX(response_id) FROM DeletableResponseIds";
const char* kMaxDeletableResponseRowIdSql =
"SELECT MAX(rowid) FROM DeletableResponseIds";
- int64 max_group_id;
- int64 max_cache_id;
- int64 max_response_id_from_entries;
- int64 max_response_id_from_deletables;
- int64 max_deletable_response_rowid;
+ int64_t max_group_id;
+ int64_t max_cache_id;
+ int64_t max_response_id_from_entries;
+ int64_t max_response_id_from_deletables;
+ int64_t max_deletable_response_rowid;
if (!RunUniqueStatementWithInt64Result(kMaxGroupIdSql, &max_group_id) ||
!RunUniqueStatementWithInt64Result(kMaxCacheIdSql, &max_cache_id) ||
!RunUniqueStatementWithInt64Result(kMaxResponseIdFromEntriesSql,
@@ -305,7 +307,7 @@ bool AppCacheDatabase::FindLastStorageIds(
return true;
}
-bool AppCacheDatabase::FindGroup(int64 group_id, GroupRecord* record) {
+bool AppCacheDatabase::FindGroup(int64_t group_id, GroupRecord* record) {
DCHECK(record);
if (!LazyOpen(kDontCreate))
return false;
@@ -377,7 +379,8 @@ bool AppCacheDatabase::FindGroupsForOrigin(
return statement.Succeeded();
}
-bool AppCacheDatabase::FindGroupForCache(int64 cache_id, GroupRecord* record) {
+bool AppCacheDatabase::FindGroupForCache(int64_t cache_id,
+ GroupRecord* record) {
DCHECK(record);
if (!LazyOpen(kDontCreate))
return false;
@@ -420,7 +423,7 @@ bool AppCacheDatabase::InsertGroup(const GroupRecord* record) {
return statement.Run();
}
-bool AppCacheDatabase::DeleteGroup(int64 group_id) {
+bool AppCacheDatabase::DeleteGroup(int64_t group_id) {
if (!LazyOpen(kDontCreate))
return false;
@@ -431,15 +434,14 @@ bool AppCacheDatabase::DeleteGroup(int64 group_id) {
return statement.Run();
}
-bool AppCacheDatabase::UpdateLastAccessTime(
- int64 group_id, base::Time time) {
+bool AppCacheDatabase::UpdateLastAccessTime(int64_t group_id, base::Time time) {
if (!LazyUpdateLastAccessTime(group_id, time))
return false;
return CommitLazyLastAccessTimes();
}
-bool AppCacheDatabase::LazyUpdateLastAccessTime(
- int64 group_id, base::Time time) {
+bool AppCacheDatabase::LazyUpdateLastAccessTime(int64_t group_id,
+ base::Time time) {
if (!LazyOpen(kCreateIfNeeded))
return false;
lazy_last_access_times_[group_id] = time;
@@ -468,7 +470,7 @@ bool AppCacheDatabase::CommitLazyLastAccessTimes() {
}
bool AppCacheDatabase::UpdateEvictionTimes(
- int64 group_id,
+ int64_t group_id,
base::Time last_full_update_check_time,
base::Time first_evictable_error_time) {
if (!LazyOpen(kCreateIfNeeded))
@@ -485,7 +487,7 @@ bool AppCacheDatabase::UpdateEvictionTimes(
return statement.Run(); // Will succeed even if group_id is invalid.
}
-bool AppCacheDatabase::FindCache(int64 cache_id, CacheRecord* record) {
+bool AppCacheDatabase::FindCache(int64_t cache_id, CacheRecord* record) {
DCHECK(record);
if (!LazyOpen(kDontCreate))
return false;
@@ -504,7 +506,8 @@ bool AppCacheDatabase::FindCache(int64 cache_id, CacheRecord* record) {
return true;
}
-bool AppCacheDatabase::FindCacheForGroup(int64 group_id, CacheRecord* record) {
+bool AppCacheDatabase::FindCacheForGroup(int64_t group_id,
+ CacheRecord* record) {
DCHECK(record);
if (!LazyOpen(kDontCreate))
return false;
@@ -559,7 +562,7 @@ bool AppCacheDatabase::InsertCache(const CacheRecord* record) {
return statement.Run();
}
-bool AppCacheDatabase::DeleteCache(int64 cache_id) {
+bool AppCacheDatabase::DeleteCache(int64_t cache_id) {
if (!LazyOpen(kDontCreate))
return false;
@@ -572,8 +575,8 @@ bool AppCacheDatabase::DeleteCache(int64 cache_id) {
return statement.Run();
}
-bool AppCacheDatabase::FindEntriesForCache(
- int64 cache_id, std::vector<EntryRecord>* records) {
+bool AppCacheDatabase::FindEntriesForCache(int64_t cache_id,
+ std::vector<EntryRecord>* records) {
DCHECK(records && records->empty());
if (!LazyOpen(kDontCreate))
return false;
@@ -616,8 +619,9 @@ bool AppCacheDatabase::FindEntriesForUrl(
return statement.Succeeded();
}
-bool AppCacheDatabase::FindEntry(
- int64 cache_id, const GURL& url, EntryRecord* record) {
+bool AppCacheDatabase::FindEntry(int64_t cache_id,
+ const GURL& url,
+ EntryRecord* record) {
DCHECK(record);
if (!LazyOpen(kDontCreate))
return false;
@@ -673,7 +677,7 @@ bool AppCacheDatabase::InsertEntryRecords(
return transaction.Commit();
}
-bool AppCacheDatabase::DeleteEntriesForCache(int64 cache_id) {
+bool AppCacheDatabase::DeleteEntriesForCache(int64_t cache_id) {
if (!LazyOpen(kDontCreate))
return false;
@@ -686,8 +690,9 @@ bool AppCacheDatabase::DeleteEntriesForCache(int64 cache_id) {
return statement.Run();
}
-bool AppCacheDatabase::AddEntryFlags(
- const GURL& entry_url, int64 cache_id, int additional_flags) {
+bool AppCacheDatabase::AddEntryFlags(const GURL& entry_url,
+ int64_t cache_id,
+ int additional_flags) {
if (!LazyOpen(kDontCreate))
return false;
@@ -724,7 +729,7 @@ bool AppCacheDatabase::FindNamespacesForOrigin(
}
bool AppCacheDatabase::FindNamespacesForCache(
- int64 cache_id,
+ int64_t cache_id,
std::vector<NamespaceRecord>* intercepts,
std::vector<NamespaceRecord>* fallbacks) {
DCHECK(intercepts && intercepts->empty());
@@ -789,7 +794,7 @@ bool AppCacheDatabase::InsertNamespaceRecords(
return transaction.Commit();
}
-bool AppCacheDatabase::DeleteNamespacesForCache(int64 cache_id) {
+bool AppCacheDatabase::DeleteNamespacesForCache(int64_t cache_id) {
if (!LazyOpen(kDontCreate))
return false;
@@ -803,7 +808,8 @@ bool AppCacheDatabase::DeleteNamespacesForCache(int64 cache_id) {
}
bool AppCacheDatabase::FindOnlineWhiteListForCache(
- int64 cache_id, std::vector<OnlineWhiteListRecord>* records) {
+ int64_t cache_id,
+ std::vector<OnlineWhiteListRecord>* records) {
DCHECK(records && records->empty());
if (!LazyOpen(kDontCreate))
return false;
@@ -856,7 +862,7 @@ bool AppCacheDatabase::InsertOnlineWhiteListRecords(
return transaction.Commit();
}
-bool AppCacheDatabase::DeleteOnlineWhiteListForCache(int64 cache_id) {
+bool AppCacheDatabase::DeleteOnlineWhiteListForCache(int64_t cache_id) {
if (!LazyOpen(kDontCreate))
return false;
@@ -870,7 +876,9 @@ bool AppCacheDatabase::DeleteOnlineWhiteListForCache(int64 cache_id) {
}
bool AppCacheDatabase::GetDeletableResponseIds(
- std::vector<int64>* response_ids, int64 max_rowid, int limit) {
+ std::vector<int64_t>* response_ids,
+ int64_t max_rowid,
+ int limit) {
if (!LazyOpen(kDontCreate))
return false;
@@ -889,22 +897,23 @@ bool AppCacheDatabase::GetDeletableResponseIds(
}
bool AppCacheDatabase::InsertDeletableResponseIds(
- const std::vector<int64>& response_ids) {
+ const std::vector<int64_t>& response_ids) {
const char kSql[] =
"INSERT INTO DeletableResponseIds (response_id) VALUES (?)";
return RunCachedStatementWithIds(SQL_FROM_HERE, kSql, response_ids);
}
bool AppCacheDatabase::DeleteDeletableResponseIds(
- const std::vector<int64>& response_ids) {
+ const std::vector<int64_t>& response_ids) {
const char kSql[] =
"DELETE FROM DeletableResponseIds WHERE response_id = ?";
return RunCachedStatementWithIds(SQL_FROM_HERE, kSql, response_ids);
}
bool AppCacheDatabase::RunCachedStatementWithIds(
- const sql::StatementID& statement_id, const char* sql,
- const std::vector<int64>& ids) {
+ const sql::StatementID& statement_id,
+ const char* sql,
+ const std::vector<int64_t>& ids) {
DCHECK(sql);
if (!LazyOpen(kCreateIfNeeded))
return false;
@@ -915,7 +924,7 @@ bool AppCacheDatabase::RunCachedStatementWithIds(
sql::Statement statement(db_->GetCachedStatement(statement_id, sql));
- std::vector<int64>::const_iterator iter = ids.begin();
+ std::vector<int64_t>::const_iterator iter = ids.begin();
while (iter != ids.end()) {
statement.BindInt64(0, *iter);
if (!statement.Run())
@@ -927,8 +936,8 @@ bool AppCacheDatabase::RunCachedStatementWithIds(
return transaction.Commit();
}
-bool AppCacheDatabase::RunUniqueStatementWithInt64Result(
- const char* sql, int64* result) {
+bool AppCacheDatabase::RunUniqueStatementWithInt64Result(const char* sql,
+ int64_t* result) {
DCHECK(sql);
sql::Statement statement(db_->GetUniqueStatement(sql));
if (!statement.Step()) {
@@ -939,8 +948,9 @@ bool AppCacheDatabase::RunUniqueStatementWithInt64Result(
}
bool AppCacheDatabase::FindResponseIdsForCacheHelper(
- int64 cache_id, std::vector<int64>* ids_vector,
- std::set<int64>* ids_set) {
+ int64_t cache_id,
+ std::vector<int64_t>* ids_vector,
+ std::set<int64_t>* ids_set) {
DCHECK(ids_vector || ids_set);
DCHECK(!(ids_vector && ids_set));
if (!LazyOpen(kDontCreate))
@@ -953,7 +963,7 @@ bool AppCacheDatabase::FindResponseIdsForCacheHelper(
statement.BindInt64(0, cache_id);
while (statement.Step()) {
- int64 id = statement.ColumnInt64(0);
+ int64_t id = statement.ColumnInt64(0);
if (ids_set)
ids_set->insert(id);
else
« no previous file with comments | « content/browser/appcache/appcache_database.h ('k') | content/browser/appcache/appcache_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698