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

Unified Diff: storage/browser/quota/quota_database.cc

Issue 1424653002: Add access count and time-since-accessed histograms to temp storage eviction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@quota_uma
Patch Set: fix test Created 5 years, 1 month 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
« no previous file with comments | « storage/browser/quota/quota_database.h ('k') | storage/browser/quota/quota_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: storage/browser/quota/quota_database.cc
diff --git a/storage/browser/quota/quota_database.cc b/storage/browser/quota/quota_database.cc
index f1fefb6be401860b6356daff44f4e0fdf056427c..b11115c26096ad6d97f9eae4c754fb11b7331ae3 100644
--- a/storage/browser/quota/quota_database.cc
+++ b/storage/browser/quota/quota_database.cc
@@ -286,7 +286,7 @@ bool QuotaDatabase::GetOriginLastEvictionTime(const GURL& origin,
statement.BindInt(1, static_cast<int>(type));
if (!statement.Step())
- return statement.Succeeded();
+ return false;
*last_modified_time = base::Time::FromInternalValue(statement.ColumnInt64(0));
return true;
@@ -357,6 +357,31 @@ bool QuotaDatabase::RegisterInitialOriginInfo(
return true;
}
+bool QuotaDatabase::GetOriginInfo(const GURL& origin,
+ StorageType type,
+ QuotaDatabase::OriginInfoTableEntry* entry) {
+ if (!LazyOpen(false))
+ return false;
+
+ const char* kSql =
+ "SELECT * FROM OriginInfoTable"
+ " WHERE origin = ? AND type = ?";
+ sql::Statement statement(db_->GetCachedStatement(SQL_FROM_HERE, kSql));
+ statement.BindString(0, origin.spec());
+ statement.BindInt(1, static_cast<int>(type));
+
+ if (!statement.Step())
+ return false;
+
+ *entry = OriginInfoTableEntry(
+ GURL(statement.ColumnString(0)),
+ static_cast<StorageType>(statement.ColumnInt(1)), statement.ColumnInt(2),
+ base::Time::FromInternalValue(statement.ColumnInt64(3)),
+ base::Time::FromInternalValue(statement.ColumnInt64(4)));
+
+ return true;
+}
+
bool QuotaDatabase::DeleteHostQuota(
const std::string& host, StorageType type) {
if (!LazyOpen(false))
« no previous file with comments | « storage/browser/quota/quota_database.h ('k') | storage/browser/quota/quota_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698