diff options
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/appcache/appcache.h | 8 | ||||
-rw-r--r-- | webkit/appcache/appcache_database.cc | 71 | ||||
-rw-r--r-- | webkit/appcache/appcache_database.h | 6 | ||||
-rw-r--r-- | webkit/appcache/appcache_database_unittest.cc | 39 | ||||
-rw-r--r-- | webkit/appcache/appcache_group_unittest.cc | 18 | ||||
-rw-r--r-- | webkit/appcache/appcache_storage_impl.cc | 58 | ||||
-rw-r--r-- | webkit/appcache/appcache_storage_impl.h | 1 | ||||
-rw-r--r-- | webkit/appcache/appcache_storage_impl_unittest.cc | 8 | ||||
-rw-r--r-- | webkit/appcache/appcache_update_job.cc | 2 | ||||
-rw-r--r-- | webkit/appcache/appcache_update_job_unittest.cc | 14 |
10 files changed, 165 insertions, 60 deletions
diff --git a/webkit/appcache/appcache.h b/webkit/appcache/appcache.h index 45e2238..325c5113 100644 --- a/webkit/appcache/appcache.h +++ b/webkit/appcache/appcache.h @@ -59,6 +59,8 @@ class AppCache : public base::RefCounted<AppCache> { AppCacheHosts& associated_hosts() { return associated_hosts_; } bool IsNewerThan(AppCache* cache) const { + // TODO(michaeln): revisit, the system clock can be set + // back in time which would confuse this logic. if (update_time_ > cache->update_time_) return true; @@ -69,8 +71,8 @@ class AppCache : public base::RefCounted<AppCache> { return false; } - base::TimeTicks update_time() const { return update_time_; } - void set_update_time(base::TimeTicks ticks) { update_time_ = ticks; } + base::Time update_time() const { return update_time_; } + void set_update_time(base::Time ticks) { update_time_ = ticks; } // Initializes the cache with information in the manifest. // Do not use the manifest after this call. @@ -131,7 +133,7 @@ class AppCache : public base::RefCounted<AppCache> { bool is_complete_; // when this cache was last updated - base::TimeTicks update_time_; + base::Time update_time_; // to notify service when cache is deleted AppCacheService* service_; diff --git a/webkit/appcache/appcache_database.cc b/webkit/appcache/appcache_database.cc index 1553561..c4124c59 100644 --- a/webkit/appcache/appcache_database.cc +++ b/webkit/appcache/appcache_database.cc @@ -18,8 +18,8 @@ // Schema ------------------------------------------------------------------- namespace { -const int kCurrentVersion = 1; -const int kCompatibleVersion = 0; +const int kCurrentVersion = 2; +const int kCompatibleVersion = 2; const char* kGroupsTable = "Groups"; const char* kCachesTable = "Caches"; @@ -35,7 +35,9 @@ const struct { { kGroupsTable, "(group_id INTEGER PRIMARY KEY," " origin TEXT," - " manifest_url TEXT)" }, + " manifest_url TEXT," + " creation_time INTEGER," + " last_access_time INTEGER)" }, { kCachesTable, "(cache_id INTEGER PRIMARY KEY," @@ -248,7 +250,9 @@ bool AppCacheDatabase::FindGroup(int64 group_id, GroupRecord* record) { return false; const char* kSql = - "SELECT group_id, origin, manifest_url FROM Groups WHERE group_id = ?"; + "SELECT group_id, origin, manifest_url," + " creation_time, last_access_time" + " FROM Groups WHERE group_id = ?"; sql::Statement statement; if (!PrepareCachedStatement(SQL_FROM_HERE, kSql, &statement)) @@ -270,8 +274,9 @@ bool AppCacheDatabase::FindGroupForManifestUrl( return false; const char* kSql = - "SELECT group_id, origin, manifest_url FROM Groups" - " WHERE manifest_url = ?"; + "SELECT group_id, origin, manifest_url," + " creation_time, last_access_time" + " FROM Groups WHERE manifest_url = ?"; sql::Statement statement; if (!PrepareCachedStatement(SQL_FROM_HERE, kSql, &statement)) @@ -293,7 +298,9 @@ bool AppCacheDatabase::FindGroupsForOrigin( return false; const char* kSql = - "SELECT group_id, origin, manifest_url FROM Groups WHERE origin = ?"; + "SELECT group_id, origin, manifest_url," + " creation_time, last_access_time" + " FROM Groups WHERE origin = ?"; sql::Statement statement; if (!PrepareCachedStatement(SQL_FROM_HERE, kSql, &statement)) @@ -315,7 +322,9 @@ bool AppCacheDatabase::FindGroupForCache(int64 cache_id, GroupRecord* record) { return false; const char* kSql = - "SELECT g.group_id, g.origin, g.manifest_url FROM Groups g, Caches c" + "SELECT g.group_id, g.origin, g.manifest_url," + " g.creation_time, g.last_access_time" + " FROM Groups g, Caches c" " WHERE c.cache_id = ? AND c.group_id = g.group_id"; sql::Statement statement; @@ -330,13 +339,31 @@ bool AppCacheDatabase::FindGroupForCache(int64 cache_id, GroupRecord* record) { return true; } +bool AppCacheDatabase::UpdateGroupLastAccessTime( + int64 group_id, base::Time time) { + if (!LazyOpen(true)) + return false; + + const char* kSql = + "UPDATE Groups SET last_access_time = ? WHERE group_id = ?"; + + sql::Statement statement; + if (!PrepareCachedStatement(SQL_FROM_HERE, kSql, &statement)) + return false; + + statement.BindInt64(0, time.ToInternalValue()); + statement.BindInt64(1, group_id); + return statement.Run() && db_->GetLastChangeCount(); +} + bool AppCacheDatabase::InsertGroup(const GroupRecord* record) { if (!LazyOpen(true)) return false; const char* kSql = - "INSERT INTO Groups (group_id, origin, manifest_url)" - " VALUES(?, ?, ?)"; + "INSERT INTO Groups" + " (group_id, origin, manifest_url, creation_time, last_access_time)" + " VALUES(?, ?, ?, ?, ?)"; sql::Statement statement; if (!PrepareCachedStatement(SQL_FROM_HERE, kSql, &statement)) @@ -345,6 +372,8 @@ bool AppCacheDatabase::InsertGroup(const GroupRecord* record) { statement.BindInt64(0, record->group_id); statement.BindString(1, record->origin.spec()); statement.BindString(2, record->manifest_url.spec()); + statement.BindInt64(3, record->creation_time.ToInternalValue()); + statement.BindInt64(4, record->last_access_time.ToInternalValue()); return statement.Run(); } @@ -438,15 +467,8 @@ bool AppCacheDatabase::InsertCache(const CacheRecord* record) { statement.BindInt64(0, record->cache_id); statement.BindInt64(1, record->group_id); statement.BindBool(2, record->online_wildcard); - - // There are no convinient methods to convert TimeTicks to or - // from microseconds directly, so we compute TimeDelta's - // as an intermediary step. - statement.BindInt64(3, - (record->update_time - base::TimeTicks()).InMicroseconds()); - + statement.BindInt64(3, record->update_time.ToInternalValue()); statement.BindInt64(4, record->cache_size); - return statement.Run(); } @@ -901,6 +923,10 @@ void AppCacheDatabase::ReadGroupRecord( record->group_id = statement.ColumnInt64(0); record->origin = GURL(statement.ColumnString(1)); record->manifest_url = GURL(statement.ColumnString(2)); + record->creation_time = + base::Time::FromInternalValue(statement.ColumnInt64(3)); + record->last_access_time = + base::Time::FromInternalValue(statement.ColumnInt64(4)); } void AppCacheDatabase::ReadCacheRecord( @@ -908,13 +934,8 @@ void AppCacheDatabase::ReadCacheRecord( record->cache_id = statement.ColumnInt64(0); record->group_id = statement.ColumnInt64(1); record->online_wildcard = statement.ColumnBool(2); - - // There are no convinient methods to convert TimeTicks to or - // from microseconds directly, so we compute TimeDelta's - // as an intermediary step. - record->update_time = base::TimeTicks() + - base::TimeDelta::FromMicroseconds(statement.ColumnInt64(3)); - + record->update_time = + base::Time::FromInternalValue(statement.ColumnInt64(3)); record->cache_size = statement.ColumnInt64(4); } diff --git a/webkit/appcache/appcache_database.h b/webkit/appcache/appcache_database.h index 97ed9e2..1c02463 100644 --- a/webkit/appcache/appcache_database.h +++ b/webkit/appcache/appcache_database.h @@ -34,6 +34,8 @@ class AppCacheDatabase { int64 group_id; GURL origin; GURL manifest_url; + base::Time creation_time; + base::Time last_access_time; GroupRecord() : group_id(0) {} }; @@ -41,7 +43,7 @@ class AppCacheDatabase { int64 cache_id; int64 group_id; bool online_wildcard; - base::TimeTicks update_time; + base::Time update_time; int64 cache_size; // the sum of all response sizes in this cache CacheRecord() : cache_id(0), group_id(0), online_wildcard(false), cache_size(0) {} @@ -91,6 +93,8 @@ class AppCacheDatabase { bool FindGroupsForOrigin( const GURL& origin, std::vector<GroupRecord>* records); bool FindGroupForCache(int64 cache_id, GroupRecord* record); + bool UpdateGroupLastAccessTime( + int64 group_id, base::Time last_access_time); bool InsertGroup(const GroupRecord* record); bool DeleteGroup(int64 group_id); diff --git a/webkit/appcache/appcache_database_unittest.cc b/webkit/appcache/appcache_database_unittest.cc index 763cd9a..f024026 100644 --- a/webkit/appcache/appcache_database_unittest.cc +++ b/webkit/appcache/appcache_database_unittest.cc @@ -12,7 +12,7 @@ namespace { -const base::TimeTicks kZeroTimeTicks; +const base::Time kZeroTime; class TestErrorDelegate : public sql::ErrorDelegate { public: @@ -166,7 +166,7 @@ TEST(AppCacheDatabaseTest, CacheRecords) { record.cache_id = 1; record.group_id = 1; record.online_wildcard = true; - record.update_time = kZeroTimeTicks; + record.update_time = kZeroTime; record.cache_size = 100; EXPECT_TRUE(db.InsertCache(&record)); EXPECT_FALSE(db.InsertCache(&record)); @@ -176,7 +176,7 @@ TEST(AppCacheDatabaseTest, CacheRecords) { EXPECT_EQ(1, record.cache_id); EXPECT_EQ(1, record.group_id); EXPECT_TRUE(record.online_wildcard); - EXPECT_TRUE(kZeroTimeTicks == record.update_time); + EXPECT_TRUE(kZeroTime == record.update_time); EXPECT_EQ(100, record.cache_size); record = kZeroRecord; @@ -184,7 +184,7 @@ TEST(AppCacheDatabaseTest, CacheRecords) { EXPECT_EQ(1, record.cache_id); EXPECT_EQ(1, record.group_id); EXPECT_TRUE(record.online_wildcard); - EXPECT_TRUE(kZeroTimeTicks == record.update_time); + EXPECT_TRUE(kZeroTime == record.update_time); EXPECT_EQ(100, record.cache_size); EXPECT_TRUE(db.DeleteCache(1)); @@ -204,6 +204,9 @@ TEST(AppCacheDatabaseTest, GroupRecords) { const GURL kManifestUrl("http://blah/manifest"); const GURL kOrigin(kManifestUrl.GetOrigin()); + const base::Time kLastAccessTime = base::Time::Now(); + const base::Time kCreationTime = + kLastAccessTime - base::TimeDelta::FromDays(7); const AppCacheDatabase::GroupRecord kZeroRecord; AppCacheDatabase::GroupRecord record; @@ -220,6 +223,8 @@ TEST(AppCacheDatabaseTest, GroupRecords) { record.group_id = 1; record.manifest_url = kManifestUrl; record.origin = kOrigin; + record.last_access_time = kLastAccessTime; + record.creation_time = kCreationTime; EXPECT_TRUE(db.InsertGroup(&record)); EXPECT_FALSE(db.InsertGroup(&record)); @@ -231,16 +236,26 @@ TEST(AppCacheDatabaseTest, GroupRecords) { EXPECT_EQ(1, record.group_id); EXPECT_EQ(kManifestUrl, record.manifest_url); EXPECT_EQ(kOrigin, record.origin); + EXPECT_EQ(kCreationTime.ToInternalValue(), + record.creation_time.ToInternalValue()); + EXPECT_EQ(kLastAccessTime.ToInternalValue(), + record.last_access_time.ToInternalValue()); record = kZeroRecord; EXPECT_TRUE(db.FindGroupForManifestUrl(kManifestUrl, &record)); EXPECT_EQ(1, record.group_id); EXPECT_EQ(kManifestUrl, record.manifest_url); EXPECT_EQ(kOrigin, record.origin); + EXPECT_EQ(kCreationTime.ToInternalValue(), + record.creation_time.ToInternalValue()); + EXPECT_EQ(kLastAccessTime.ToInternalValue(), + record.last_access_time.ToInternalValue()); record.group_id = 2; record.manifest_url = kOrigin; record.origin = kOrigin; + record.last_access_time = kLastAccessTime; + record.creation_time = kCreationTime; EXPECT_TRUE(db.InsertGroup(&record)); record = kZeroRecord; @@ -248,6 +263,10 @@ TEST(AppCacheDatabaseTest, GroupRecords) { EXPECT_EQ(2, record.group_id); EXPECT_EQ(kOrigin, record.manifest_url); EXPECT_EQ(kOrigin, record.origin); + EXPECT_EQ(kCreationTime.ToInternalValue(), + record.creation_time.ToInternalValue()); + EXPECT_EQ(kLastAccessTime.ToInternalValue(), + record.last_access_time.ToInternalValue()); EXPECT_TRUE(db.FindGroupsForOrigin(kOrigin, &records)); EXPECT_EQ(2U, records.size()); @@ -266,6 +285,10 @@ TEST(AppCacheDatabaseTest, GroupRecords) { EXPECT_EQ(2, records[0].group_id); EXPECT_EQ(kOrigin, records[0].manifest_url); EXPECT_EQ(kOrigin, records[0].origin); + EXPECT_EQ(kCreationTime.ToInternalValue(), + record.creation_time.ToInternalValue()); + EXPECT_EQ(kLastAccessTime.ToInternalValue(), + record.last_access_time.ToInternalValue()); std::set<GURL> origins; EXPECT_TRUE(db.FindOriginsWithGroups(&origins)); @@ -289,7 +312,7 @@ TEST(AppCacheDatabaseTest, GroupRecords) { cache_record.cache_id = 1; cache_record.group_id = 1; cache_record.online_wildcard = true; - cache_record.update_time = kZeroTimeTicks; + cache_record.update_time = kZeroTime; EXPECT_TRUE(db.InsertCache(&cache_record)); record = kZeroRecord; @@ -546,7 +569,7 @@ TEST(AppCacheDatabaseTest, Quotas) { cache_record.cache_id = 1; cache_record.group_id = 1; cache_record.online_wildcard = true; - cache_record.update_time = kZeroTimeTicks; + cache_record.update_time = kZeroTime; cache_record.cache_size = 100; EXPECT_TRUE(db.InsertCache(&cache_record)); @@ -559,7 +582,7 @@ TEST(AppCacheDatabaseTest, Quotas) { cache_record.cache_id = 2; cache_record.group_id = 2; cache_record.online_wildcard = true; - cache_record.update_time = kZeroTimeTicks; + cache_record.update_time = kZeroTime; cache_record.cache_size = 1000; EXPECT_TRUE(db.InsertCache(&cache_record)); @@ -572,7 +595,7 @@ TEST(AppCacheDatabaseTest, Quotas) { cache_record.cache_id = 3; cache_record.group_id = 3; cache_record.online_wildcard = true; - cache_record.update_time = kZeroTimeTicks; + cache_record.update_time = kZeroTime; cache_record.cache_size = 5000; EXPECT_TRUE(db.InsertCache(&cache_record)); diff --git a/webkit/appcache/appcache_group_unittest.cc b/webkit/appcache/appcache_group_unittest.cc index 180cc3a..3508ace 100644 --- a/webkit/appcache/appcache_group_unittest.cc +++ b/webkit/appcache/appcache_group_unittest.cc @@ -79,38 +79,38 @@ TEST(AppCacheGroupTest, AddRemoveCache) { scoped_refptr<AppCacheGroup> group = new AppCacheGroup(&service, GURL("http://foo.com"), 111); - base::TimeTicks ticks = base::TimeTicks::Now(); + base::Time now = base::Time::Now(); scoped_refptr<AppCache> cache1 = new AppCache(&service, 111); cache1->set_complete(true); - cache1->set_update_time(ticks); + cache1->set_update_time(now); group->AddCache(cache1); EXPECT_EQ(cache1, group->newest_complete_cache()); // Adding older cache does not change newest complete cache. scoped_refptr<AppCache> cache2 = new AppCache(&service, 222); cache2->set_complete(true); - cache2->set_update_time(ticks - base::TimeDelta::FromDays(1)); + cache2->set_update_time(now - base::TimeDelta::FromDays(1)); group->AddCache(cache2); EXPECT_EQ(cache1, group->newest_complete_cache()); // Adding newer cache does change newest complete cache. scoped_refptr<AppCache> cache3 = new AppCache(&service, 333); cache3->set_complete(true); - cache3->set_update_time(ticks + base::TimeDelta::FromDays(1)); + cache3->set_update_time(now + base::TimeDelta::FromDays(1)); group->AddCache(cache3); EXPECT_EQ(cache3, group->newest_complete_cache()); // Adding cache with same update time uses one with larger ID. scoped_refptr<AppCache> cache4 = new AppCache(&service, 444); cache4->set_complete(true); - cache4->set_update_time(ticks + base::TimeDelta::FromDays(1)); // same as 3 + cache4->set_update_time(now + base::TimeDelta::FromDays(1)); // same as 3 group->AddCache(cache4); EXPECT_EQ(cache4, group->newest_complete_cache()); scoped_refptr<AppCache> cache5 = new AppCache(&service, 55); // smaller id cache5->set_complete(true); - cache5->set_update_time(ticks + base::TimeDelta::FromDays(1)); // same as 4 + cache5->set_update_time(now + base::TimeDelta::FromDays(1)); // same as 4 group->AddCache(cache5); EXPECT_EQ(cache4, group->newest_complete_cache()); // no change @@ -152,11 +152,11 @@ TEST(AppCacheGroupTest, CleanupUnusedGroup) { AppCacheHost host1(1, &frontend, &service); AppCacheHost host2(2, &frontend, &service); - base::TimeTicks ticks = base::TimeTicks::Now(); + base::Time now = base::Time::Now(); AppCache* cache1 = new AppCache(&service, 111); cache1->set_complete(true); - cache1->set_update_time(ticks); + cache1->set_update_time(now); group->AddCache(cache1); EXPECT_EQ(cache1, group->newest_complete_cache()); @@ -172,7 +172,7 @@ TEST(AppCacheGroupTest, CleanupUnusedGroup) { AppCache* cache2 = new AppCache(&service, 222); cache2->set_complete(true); - cache2->set_update_time(ticks + base::TimeDelta::FromDays(1)); + cache2->set_update_time(now + base::TimeDelta::FromDays(1)); group->AddCache(cache2); EXPECT_EQ(cache2, group->newest_complete_cache()); diff --git a/webkit/appcache/appcache_storage_impl.cc b/webkit/appcache/appcache_storage_impl.cc index 0d908aa..6fd5486 100644 --- a/webkit/appcache/appcache_storage_impl.cc +++ b/webkit/appcache/appcache_storage_impl.cc @@ -268,6 +268,10 @@ void AppCacheStorageImpl::CacheLoadTask::Run() { database_->FindCache(cache_id_, &cache_record_) && database_->FindGroup(cache_record_.group_id, &group_record_) && FindRelatedCacheRecords(cache_id_); + + if (success_) + database_->UpdateGroupLastAccessTime(group_record_.group_id, + base::Time::Now()); } void AppCacheStorageImpl::CacheLoadTask::RunCompleted() { @@ -302,6 +306,10 @@ void AppCacheStorageImpl::GroupLoadTask::Run() { database_->FindGroupForManifestUrl(manifest_url_, &group_record_) && database_->FindCacheForGroup(group_record_.group_id, &cache_record_) && FindRelatedCacheRecords(cache_record_.cache_id); + + if (success_) + database_->UpdateGroupLastAccessTime(group_record_.group_id, + base::Time::Now()); } void AppCacheStorageImpl::GroupLoadTask::RunCompleted() { @@ -366,12 +374,17 @@ void AppCacheStorageImpl::StoreGroupAndCacheTask::Run() { AppCacheDatabase::GroupRecord existing_group; success_ = database_->FindGroup(group_record_.group_id, &existing_group); if (!success_) { + group_record_.creation_time = base::Time::Now(); + group_record_.last_access_time = base::Time::Now(); success_ = database_->InsertGroup(&group_record_); } else { DCHECK(group_record_.group_id == existing_group.group_id); DCHECK(group_record_.manifest_url == existing_group.manifest_url); DCHECK(group_record_.origin == existing_group.origin); + database_->UpdateGroupLastAccessTime(group_record_.group_id, + base::Time::Now()); + AppCacheDatabase::CacheRecord cache; if (database_->FindCacheForGroup(group_record_.group_id, &cache)) { // Get the set of response ids in the old cache. @@ -685,8 +698,10 @@ class AppCacheStorageImpl::GetDeletableResponseIdsTask : public DatabaseTask { public: GetDeletableResponseIdsTask(AppCacheStorageImpl* storage, int64 max_rowid) : DatabaseTask(storage), max_rowid_(max_rowid) {} + virtual void Run(); virtual void RunCompleted(); + int64 max_rowid_; std::vector<int64> response_ids_; }; @@ -731,6 +746,25 @@ void AppCacheStorageImpl::DeleteDeletableResponseIdsTask::Run() { database_->DeleteDeletableResponseIds(response_ids_); } +// UpdateGroupLastAccessTimeTask ------- + +class AppCacheStorageImpl::UpdateGroupLastAccessTimeTask + : public DatabaseTask { + public: + UpdateGroupLastAccessTimeTask( + AppCacheStorageImpl* storage, int64 group_id, base::Time time) + : DatabaseTask(storage), group_id_(group_id), last_access_time_(time) {} + + virtual void Run(); + + int64 group_id_; + base::Time last_access_time_; +}; + +void AppCacheStorageImpl::UpdateGroupLastAccessTimeTask::Run() { + database_->UpdateGroupLastAccessTime(group_id_, last_access_time_); +} + // AppCacheStorageImpl --------------------------------------------------- @@ -780,9 +814,20 @@ void AppCacheStorageImpl::Disable() { void AppCacheStorageImpl::LoadCache(int64 id, Delegate* delegate) { DCHECK(delegate); + if (is_disabled_) { + delegate->OnCacheLoaded(NULL, id); + return; + } + AppCache* cache = working_set_.GetCache(id); - if (cache || is_disabled_) { + if (cache) { delegate->OnCacheLoaded(cache, id); + if (cache->owning_group()) { + scoped_refptr<DatabaseTask> update_task = + new UpdateGroupLastAccessTimeTask( + this, cache->owning_group()->group_id(), base::Time::Now()); + update_task->Schedule(); + } return; } scoped_refptr<CacheLoadTask> task = GetPendingCacheLoadTask(id); @@ -799,9 +844,18 @@ void AppCacheStorageImpl::LoadCache(int64 id, Delegate* delegate) { void AppCacheStorageImpl::LoadOrCreateGroup( const GURL& manifest_url, Delegate* delegate) { DCHECK(delegate); + if (is_disabled_) { + delegate->OnGroupLoaded(NULL, manifest_url); + return; + } + AppCacheGroup* group = working_set_.GetGroup(manifest_url); - if (group || is_disabled_) { + if (group) { delegate->OnGroupLoaded(group, manifest_url); + scoped_refptr<DatabaseTask> update_task = + new UpdateGroupLastAccessTimeTask( + this, group->group_id(), base::Time::Now()); + update_task->Schedule(); return; } diff --git a/webkit/appcache/appcache_storage_impl.h b/webkit/appcache/appcache_storage_impl.h index 9677801..b644eff 100644 --- a/webkit/appcache/appcache_storage_impl.h +++ b/webkit/appcache/appcache_storage_impl.h @@ -69,6 +69,7 @@ class AppCacheStorageImpl : public AppCacheStorage { class GetDeletableResponseIdsTask; class InsertDeletableResponseIdsTask; class DeleteDeletableResponseIdsTask; + class UpdateGroupLastAccessTimeTask; typedef std::deque<DatabaseTask*> DatabaseTaskQueue; typedef std::map<int64, CacheLoadTask*> PendingCacheLoads; diff --git a/webkit/appcache/appcache_storage_impl_unittest.cc b/webkit/appcache/appcache_storage_impl_unittest.cc index ad6a8310..c6160e0 100644 --- a/webkit/appcache/appcache_storage_impl_unittest.cc +++ b/webkit/appcache/appcache_storage_impl_unittest.cc @@ -22,7 +22,7 @@ namespace appcache { namespace { -const base::TimeTicks kZeroTimeTicks; +const base::Time kZeroTime; const GURL kManifestUrl("http://blah/manifest"); const GURL kManifestUrl2("http://blah/manifest2"); const GURL kEntryUrl("http://blah/entry"); @@ -491,7 +491,7 @@ class AppCacheStorageImplTest : public testing::Test { MakeCacheAndGroup(kManifestUrl, 1, 1, true); // Change the cache. - base::TimeTicks now = base::TimeTicks::Now(); + base::Time now = base::Time::Now(); cache_->AddEntry(kEntryUrl, AppCacheEntry(AppCacheEntry::MASTER, 1, 100)); cache_->set_update_time(now); @@ -506,7 +506,7 @@ class AppCacheStorageImplTest : public testing::Test { } void Verify_StoreExistingGroupExistingCache( - base::TimeTicks expected_update_time) { + base::Time expected_update_time) { EXPECT_TRUE(delegate()->stored_group_success_); EXPECT_EQ(cache_, group_->newest_complete_cache()); @@ -947,7 +947,7 @@ class AppCacheStorageImplTest : public testing::Test { cache_record.cache_id = cache_id; cache_record.group_id = group_id; cache_record.online_wildcard = false; - cache_record.update_time = kZeroTimeTicks; + cache_record.update_time = kZeroTime; EXPECT_TRUE(database()->InsertCache(&cache_record)); storage()->origins_with_groups_.insert(manifest_url.GetOrigin()); } diff --git a/webkit/appcache/appcache_update_job.cc b/webkit/appcache/appcache_update_job.cc index a022ed3..0941fc3 100644 --- a/webkit/appcache/appcache_update_job.cc +++ b/webkit/appcache/appcache_update_job.cc @@ -770,7 +770,7 @@ void AppCacheUpdateJob::StoreGroupAndCache() { newest_cache.swap(inprogress_cache_); else newest_cache = group_->newest_complete_cache(); - newest_cache->set_update_time(base::TimeTicks::Now()); + newest_cache->set_update_time(base::Time::Now()); service_->storage()->StoreGroupAndNewestCache(group_, newest_cache, this); // async } diff --git a/webkit/appcache/appcache_update_job_unittest.cc b/webkit/appcache/appcache_update_job_unittest.cc index 42efbff..1c715f0 100644 --- a/webkit/appcache/appcache_update_job_unittest.cc +++ b/webkit/appcache/appcache_update_job_unittest.cc @@ -1965,7 +1965,7 @@ class AppCacheUpdateJobTest : public testing::Test, // Reset the update time to null so we can verify it gets // modified in this test case by the UpdateJob. - cache->set_update_time(base::TimeTicks()); + cache->set_update_time(base::Time()); MockFrontend* frontend2 = MakeMockFrontend(); AppCacheHost* host2 = MakeHost(2, frontend2); @@ -2582,7 +2582,7 @@ class AppCacheUpdateJobTest : public testing::Test, AppCache* MakeCacheForGroup(int64 cache_id, int64 manifest_response_id) { AppCache* cache = new AppCache(service_.get(), cache_id); cache->set_complete(true); - cache->set_update_time(base::TimeTicks::Now()); + cache->set_update_time(base::Time::Now()); group_->AddCache(cache); // Add manifest entry to cache. @@ -2753,7 +2753,7 @@ class AppCacheUpdateJobTest : public testing::Test, EXPECT_TRUE(cache->online_whitelist_namespaces_.empty()); EXPECT_TRUE(cache->online_whitelist_all_); - EXPECT_TRUE(cache->update_time_ > base::TimeTicks()); + EXPECT_TRUE(cache->update_time_ > base::Time()); } void VerifyManifestMergedTypes(AppCache* cache) { @@ -2785,7 +2785,7 @@ class AppCacheUpdateJobTest : public testing::Test, http_server_->TestServerPage("files/online1"))); EXPECT_FALSE(cache->online_whitelist_all_); - EXPECT_TRUE(cache->update_time_ > base::TimeTicks()); + EXPECT_TRUE(cache->update_time_ > base::Time()); } void VerifyEmptyManifest(AppCache* cache) { @@ -2800,7 +2800,7 @@ class AppCacheUpdateJobTest : public testing::Test, EXPECT_TRUE(cache->online_whitelist_namespaces_.empty()); EXPECT_FALSE(cache->online_whitelist_all_); - EXPECT_TRUE(cache->update_time_ > base::TimeTicks()); + EXPECT_TRUE(cache->update_time_ > base::Time()); } void VerifyEmptyFileManifest(AppCache* cache) { @@ -2820,7 +2820,7 @@ class AppCacheUpdateJobTest : public testing::Test, EXPECT_TRUE(cache->online_whitelist_namespaces_.empty()); EXPECT_FALSE(cache->online_whitelist_all_); - EXPECT_TRUE(cache->update_time_ > base::TimeTicks()); + EXPECT_TRUE(cache->update_time_ > base::Time()); } void VerifyMasterEntryNoUpdate(AppCache* cache) { @@ -2846,7 +2846,7 @@ class AppCacheUpdateJobTest : public testing::Test, EXPECT_TRUE(cache->online_whitelist_namespaces_.empty()); EXPECT_FALSE(cache->online_whitelist_all_); - EXPECT_TRUE(cache->update_time_ > base::TimeTicks()); + EXPECT_TRUE(cache->update_time_ > base::Time()); } private: |