diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-06 03:50:42 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-06 03:50:42 +0000 |
commit | ee3cd175f8592b2b1f2ccd14b071d56ca733a5c6 (patch) | |
tree | 87a1e45bb6e93e1140a8719681fb653464bcea5e /webkit/appcache | |
parent | fd4882e6faab19e1de6d791acebfa3b34faf5701 (diff) | |
download | chromium_src-ee3cd175f8592b2b1f2ccd14b071d56ca733a5c6.zip chromium_src-ee3cd175f8592b2b1f2ccd14b071d56ca733a5c6.tar.gz chromium_src-ee3cd175f8592b2b1f2ccd14b071d56ca733a5c6.tar.bz2 |
Revert 35609 - AppCache quota tracking groundwork, store response sizes in the SQL database.
TEST=updated existing unittests
BUG=none
Review URL: http://codereview.chromium.org/523046
TBR=michaeln@chromium.org
Review URL: http://codereview.chromium.org/525059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35610 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache')
-rw-r--r-- | webkit/appcache/appcache.cc | 10 | ||||
-rw-r--r-- | webkit/appcache/appcache.h | 5 | ||||
-rw-r--r-- | webkit/appcache/appcache_database.cc | 30 | ||||
-rw-r--r-- | webkit/appcache/appcache_database.h | 2 | ||||
-rw-r--r-- | webkit/appcache/appcache_database_unittest.cc | 9 | ||||
-rw-r--r-- | webkit/appcache/appcache_entry.h | 14 | ||||
-rw-r--r-- | webkit/appcache/appcache_response.cc | 2 | ||||
-rw-r--r-- | webkit/appcache/appcache_response.h | 6 | ||||
-rw-r--r-- | webkit/appcache/appcache_response_unittest.cc | 35 | ||||
-rw-r--r-- | webkit/appcache/appcache_storage.h | 8 | ||||
-rw-r--r-- | webkit/appcache/appcache_storage_impl_unittest.cc | 6 | ||||
-rw-r--r-- | webkit/appcache/appcache_unittest.cc | 5 | ||||
-rw-r--r-- | webkit/appcache/appcache_update_job.cc | 25 |
13 files changed, 29 insertions, 128 deletions
diff --git a/webkit/appcache/appcache.cc b/webkit/appcache/appcache.cc index e1819d4..ec00cc4 100644 --- a/webkit/appcache/appcache.cc +++ b/webkit/appcache/appcache.cc @@ -44,15 +44,13 @@ void AppCache::AddEntry(const GURL& url, const AppCacheEntry& entry) { entries_.insert(EntryMap::value_type(url, entry)); } -bool AppCache::AddOrModifyEntry(const GURL& url, const AppCacheEntry& entry) { +void AppCache::AddOrModifyEntry(const GURL& url, const AppCacheEntry& entry) { std::pair<EntryMap::iterator, bool> ret = entries_.insert(EntryMap::value_type(url, entry)); // Entry already exists. Merge the types of the new and existing entries. if (!ret.second) ret.first->second.add_types(entry.types()); - - return ret.second; } AppCacheEntry* AppCache::GetEntry(const GURL& url) { @@ -92,8 +90,7 @@ void AppCache::InitializeWithDatabaseRecords( for (size_t i = 0; i < entries.size(); ++i) { const AppCacheDatabase::EntryRecord& entry = entries.at(i); - AddEntry(entry.url, AppCacheEntry(entry.flags, entry.response_id, - entry.response_size)); + AddEntry(entry.url, AppCacheEntry(entry.flags, entry.response_id)); } for (size_t i = 0; i < fallbacks.size(); ++i) { @@ -127,7 +124,6 @@ void AppCache::ToDatabaseRecords( cache_record->group_id = group->group_id(); cache_record->online_wildcard = online_whitelist_all_; cache_record->update_time = update_time_; - cache_record->cache_size = 0; for (EntryMap::const_iterator iter = entries_.begin(); iter != entries_.end(); ++iter) { @@ -137,8 +133,6 @@ void AppCache::ToDatabaseRecords( record.cache_id = cache_id_; record.flags = iter->second.types(); record.response_id = iter->second.response_id(); - record.response_size = iter->second.response_size(); - cache_record->cache_size += record.response_size; } GURL origin = group->manifest_url().GetOrigin(); diff --git a/webkit/appcache/appcache.h b/webkit/appcache/appcache.h index d99393f..c4446f9 100644 --- a/webkit/appcache/appcache.h +++ b/webkit/appcache/appcache.h @@ -47,9 +47,8 @@ class AppCache : public base::RefCounted<AppCache> { void AddEntry(const GURL& url, const AppCacheEntry& entry); // Adds a new entry or modifies an existing entry by merging the types - // of the new entry with the existing entry. Returns true if a new entry - // is added, false if the flags are merged into an existing entry. - bool AddOrModifyEntry(const GURL& url, const AppCacheEntry& entry); + // of the new entry with the existing entry. + void AddOrModifyEntry(const GURL& url, const AppCacheEntry& entry); // Do not store the returned object as it could be deleted anytime. AppCacheEntry* GetEntry(const GURL& url); diff --git a/webkit/appcache/appcache_database.cc b/webkit/appcache/appcache_database.cc index 606d6c1..fd2a9e9 100644 --- a/webkit/appcache/appcache_database.cc +++ b/webkit/appcache/appcache_database.cc @@ -38,15 +38,13 @@ const struct { "(cache_id INTEGER PRIMARY KEY," " group_id INTEGER," " online_wildcard INTEGER CHECK(online_wildcard IN (0, 1))," - " update_time INTEGER," - " cache_size INTEGER)" }, // intentionally not normalized + " update_time INTEGER)" }, { kEntriesTable, "(cache_id INTEGER," " url TEXT," " flags INTEGER," - " response_id INTEGER," - " response_size INTEGER)" }, + " response_id INTEGER)" }, { kFallbackNameSpacesTable, "(cache_id INTEGER," @@ -317,7 +315,7 @@ bool AppCacheDatabase::FindCache(int64 cache_id, CacheRecord* record) { return false; const char* kSql = - "SELECT cache_id, group_id, online_wildcard, update_time, cache_size" + "SELECT cache_id, group_id, online_wildcard, update_time" " FROM Caches WHERE cache_id = ?"; sql::Statement statement; @@ -338,7 +336,7 @@ bool AppCacheDatabase::FindCacheForGroup(int64 group_id, CacheRecord* record) { return false; const char* kSql = - "SELECT cache_id, group_id, online_wildcard, update_time, cache_size" + "SELECT cache_id, group_id, online_wildcard, update_time" " FROM Caches WHERE group_id = ?"; sql::Statement statement; @@ -359,8 +357,8 @@ bool AppCacheDatabase::InsertCache(const CacheRecord* record) { const char* kSql = "INSERT INTO Caches (cache_id, group_id, online_wildcard," - " update_time, cache_size)" - " VALUES(?, ?, ?, ?, ?)"; + " update_time)" + " VALUES(?, ?, ?, ?)"; sql::Statement statement; if (!PrepareCachedStatement(SQL_FROM_HERE, kSql, &statement)) @@ -376,8 +374,6 @@ bool AppCacheDatabase::InsertCache(const CacheRecord* record) { statement.BindInt64(3, (record->update_time - base::TimeTicks()).InMicroseconds()); - statement.BindInt64(4, record->cache_size); - return statement.Run(); } @@ -403,7 +399,7 @@ bool AppCacheDatabase::FindEntriesForCache( return false; const char* kSql = - "SELECT cache_id, url, flags, response_id, response_size FROM Entries" + "SELECT cache_id, url, flags, response_id FROM Entries" " WHERE cache_id = ?"; sql::Statement statement; @@ -427,7 +423,7 @@ bool AppCacheDatabase::FindEntriesForUrl( return false; const char* kSql = - "SELECT cache_id, url, flags, response_id, response_size FROM Entries" + "SELECT cache_id, url, flags, response_id FROM Entries" " WHERE url = ?"; sql::Statement statement; @@ -452,7 +448,7 @@ bool AppCacheDatabase::FindEntry( return false; const char* kSql = - "SELECT cache_id, url, flags, response_id, response_size FROM Entries" + "SELECT cache_id, url, flags, response_id FROM Entries" " WHERE cache_id = ? AND url = ?"; sql::Statement statement; @@ -475,8 +471,8 @@ bool AppCacheDatabase::InsertEntry(const EntryRecord* record) { return false; const char* kSql = - "INSERT INTO Entries (cache_id, url, flags, response_id, response_size)" - " VALUES(?, ?, ?, ?, ?)"; + "INSERT INTO Entries (cache_id, url, flags, response_id)" + " VALUES(?, ?, ?, ?)"; sql::Statement statement; if (!PrepareCachedStatement(SQL_FROM_HERE, kSql, &statement)) @@ -486,7 +482,6 @@ bool AppCacheDatabase::InsertEntry(const EntryRecord* record) { statement.BindString(1, record->url.spec()); statement.BindInt(2, record->flags); statement.BindInt64(3, record->response_id); - statement.BindInt64(4, record->response_size); return statement.Run(); } @@ -733,8 +728,6 @@ void AppCacheDatabase::ReadCacheRecord( // as an intermediary step. record->update_time = base::TimeTicks() + base::TimeDelta::FromMicroseconds(statement.ColumnInt64(3)); - - record->cache_size = statement.ColumnInt64(4); } void AppCacheDatabase::ReadEntryRecord( @@ -743,7 +736,6 @@ void AppCacheDatabase::ReadEntryRecord( record->url = GURL(statement.ColumnString(1)); record->flags = statement.ColumnInt(2); record->response_id = statement.ColumnInt64(3); - record->response_size = statement.ColumnInt64(4); } void AppCacheDatabase::ReadFallbackNameSpaceRecord( diff --git a/webkit/appcache/appcache_database.h b/webkit/appcache/appcache_database.h index 968a188..89ff701 100644 --- a/webkit/appcache/appcache_database.h +++ b/webkit/appcache/appcache_database.h @@ -37,7 +37,6 @@ class AppCacheDatabase { int64 group_id; bool online_wildcard; base::TimeTicks update_time; - int64 cache_size; // the sum of all response sizes in this cache }; struct EntryRecord { @@ -45,7 +44,6 @@ class AppCacheDatabase { GURL url; int flags; int64 response_id; - int64 response_size; }; struct FallbackNameSpaceRecord { diff --git a/webkit/appcache/appcache_database_unittest.cc b/webkit/appcache/appcache_database_unittest.cc index baaeb16..62ff4ca 100644 --- a/webkit/appcache/appcache_database_unittest.cc +++ b/webkit/appcache/appcache_database_unittest.cc @@ -89,7 +89,6 @@ TEST(AppCacheDatabaseTest, EntryRecords) { entry.url = GURL("http://blah/1"); entry.flags = AppCacheEntry::MASTER; entry.response_id = 1; - entry.response_size = 100; EXPECT_TRUE(db.InsertEntry(&entry)); EXPECT_FALSE(db.InsertEntry(&entry)); @@ -97,14 +96,12 @@ TEST(AppCacheDatabaseTest, EntryRecords) { entry.url = GURL("http://blah/2"); entry.flags = AppCacheEntry::EXPLICIT; entry.response_id = 2; - entry.response_size = 200; EXPECT_TRUE(db.InsertEntry(&entry)); entry.cache_id = 2; entry.url = GURL("http://blah/3"); entry.flags = AppCacheEntry::MANIFEST; entry.response_id = 3; - entry.response_size = 300; EXPECT_TRUE(db.InsertEntry(&entry)); std::vector<AppCacheDatabase::EntryRecord> found; @@ -115,7 +112,6 @@ TEST(AppCacheDatabaseTest, EntryRecords) { EXPECT_EQ(GURL("http://blah/1"), found[0].url); EXPECT_EQ(AppCacheEntry::MASTER, found[0].flags); EXPECT_EQ(1, found[0].response_id); - EXPECT_EQ(100, found[0].response_size); found.clear(); EXPECT_TRUE(db.AddEntryFlags(GURL("http://blah/1"), 1, @@ -131,12 +127,10 @@ TEST(AppCacheDatabaseTest, EntryRecords) { EXPECT_EQ(GURL("http://blah/2"), found[0].url); EXPECT_EQ(AppCacheEntry::EXPLICIT, found[0].flags); EXPECT_EQ(2, found[0].response_id); - EXPECT_EQ(200, found[0].response_size); EXPECT_EQ(2, found[1].cache_id); EXPECT_EQ(GURL("http://blah/3"), found[1].url); EXPECT_EQ(AppCacheEntry::MANIFEST, found[1].flags); EXPECT_EQ(3, found[1].response_id); - EXPECT_EQ(300, found[1].response_size); found.clear(); EXPECT_TRUE(db.DeleteEntriesForCache(2)); @@ -165,7 +159,6 @@ TEST(AppCacheDatabaseTest, CacheRecords) { record.group_id = 1; record.online_wildcard = true; record.update_time = kZeroTimeTicks; - record.cache_size = 100; EXPECT_TRUE(db.InsertCache(&record)); EXPECT_FALSE(db.InsertCache(&record)); @@ -175,7 +168,6 @@ TEST(AppCacheDatabaseTest, CacheRecords) { EXPECT_EQ(1, record.group_id); EXPECT_TRUE(record.online_wildcard); EXPECT_TRUE(kZeroTimeTicks == record.update_time); - EXPECT_EQ(100, record.cache_size); record = kZeroRecord; EXPECT_TRUE(db.FindCacheForGroup(1, &record)); @@ -183,7 +175,6 @@ TEST(AppCacheDatabaseTest, CacheRecords) { EXPECT_EQ(1, record.group_id); EXPECT_TRUE(record.online_wildcard); EXPECT_TRUE(kZeroTimeTicks == record.update_time); - EXPECT_EQ(100, record.cache_size); EXPECT_TRUE(db.DeleteCache(1)); EXPECT_FALSE(db.FindCache(1, &record)); diff --git a/webkit/appcache/appcache_entry.h b/webkit/appcache/appcache_entry.h index 71239e2..ac67ac3 100644 --- a/webkit/appcache/appcache_entry.h +++ b/webkit/appcache/appcache_entry.h @@ -24,17 +24,13 @@ class AppCacheEntry { FALLBACK = 1 << 4, }; - AppCacheEntry() - : types_(0), response_id_(kNoResponseId), response_size_(0) {} + AppCacheEntry() : types_(0), response_id_(kNoResponseId) {} explicit AppCacheEntry(int type) - : types_(type), response_id_(kNoResponseId), response_size_(0) {} + : types_(type), response_id_(kNoResponseId) {} AppCacheEntry(int type, int64 response_id) - : types_(type), response_id_(response_id), response_size_(0) {} - - AppCacheEntry(int type, int64 response_id, int64 response_size) - : types_(type), response_id_(response_id), response_size_(response_size) {} + : types_(type), response_id_(response_id) {} int types() const { return types_; } void add_types(int added_types) { types_ |= added_types; } @@ -48,13 +44,9 @@ class AppCacheEntry { void set_response_id(int64 id) { response_id_ = id; } bool has_response_id() const { return response_id_ != kNoResponseId; } - int64 response_size() const { return response_size_; } - void set_response_size(int64 size) { response_size_ = size; } - private: int types_; int64 response_id_; - int64 response_size_; }; } // namespace appcache diff --git a/webkit/appcache/appcache_response.cc b/webkit/appcache/appcache_response.cc index 5f92439..09894a2 100644 --- a/webkit/appcache/appcache_response.cc +++ b/webkit/appcache/appcache_response.cc @@ -256,8 +256,6 @@ void AppCacheResponseWriter::OnIOComplete(int result) { DCHECK(write_amount_ == result); if (!info_buffer_.get()) write_position_ += result; - else - info_size_ = result; } InvokeUserCompletionCallback(result); } diff --git a/webkit/appcache/appcache_response.h b/webkit/appcache/appcache_response.h index f8ffcc6..419e739 100644 --- a/webkit/appcache/appcache_response.h +++ b/webkit/appcache/appcache_response.h @@ -184,9 +184,6 @@ class AppCacheResponseWriter : public AppCacheResponseIO { // Returns true if there is a write pending. bool IsWritePending() { return IsIOPending(); } - // Returns the amount written, info and data. - int64 amount_written() { return info_size_ + write_position_; } - private: friend class AppCacheStorageImpl; friend class MockAppCacheStorage; @@ -194,12 +191,11 @@ class AppCacheResponseWriter : public AppCacheResponseIO { // Should only be constructed by the storage class. AppCacheResponseWriter(int64 response_id, disk_cache::Backend* disk_cache) : AppCacheResponseIO(response_id, disk_cache), - info_size_(0), write_position_(0), write_amount_(0) {} + write_position_(0), write_amount_(0) {} virtual void OnIOComplete(int result); bool CreateEntryIfNeeded(); - int info_size_; int write_position_; int write_amount_; }; diff --git a/webkit/appcache/appcache_response_unittest.cc b/webkit/appcache/appcache_response_unittest.cc index 2989592..824e73c 100644 --- a/webkit/appcache/appcache_response_unittest.cc +++ b/webkit/appcache/appcache_response_unittest.cc @@ -371,37 +371,6 @@ class AppCacheResponseTest : public testing::Test { TestFinished(); } - // AmountWritten ---------------------------------------------------- - - void AmountWritten() { - static const char kHttpHeaders[] = - "HTTP/1.0 200 OK\0\0"; - std::string raw_headers(kHttpHeaders, arraysize(kHttpHeaders)); - net::HttpResponseInfo* head = MakeHttpResponseInfo(raw_headers); - int expected_amount_written = - GetHttpResponseInfoSize(head) + kNumBlocks * kBlockSize; - - // Push tasks in reverse order. - PushNextTask(method_factory_.NewRunnableMethod( - &AppCacheResponseTest::Verify_AmountWritten, expected_amount_written)); - for (int i = 0; i < kNumBlocks; ++i) { - PushNextTask(method_factory_.NewRunnableMethod( - &AppCacheResponseTest::WriteOneBlock, kNumBlocks - i)); - } - PushNextTask(method_factory_.NewRunnableMethod( - &AppCacheResponseTest::WriteResponseHead, head)); - - writer_.reset(service_->storage()->CreateResponseWriter(GURL())); - written_response_id_ = writer_->response_id(); - ScheduleNextTask(); - } - - void Verify_AmountWritten(int expected_amount_written) { - EXPECT_EQ(expected_amount_written, writer_->amount_written()); - TestFinished(); - } - - // WriteThenVariouslyReadResponse ------------------------------------------- void WriteThenVariouslyReadResponse() { @@ -689,10 +658,6 @@ TEST_F(AppCacheResponseTest, LoadResponseInfo_Hit) { RunTestOnIOThread(&AppCacheResponseTest::LoadResponseInfo_Hit); } -TEST_F(AppCacheResponseTest, AmountWritten) { - RunTestOnIOThread(&AppCacheResponseTest::AmountWritten); -} - TEST_F(AppCacheResponseTest, WriteThenVariouslyReadResponse) { RunTestOnIOThread(&AppCacheResponseTest::WriteThenVariouslyReadResponse); } diff --git a/webkit/appcache/appcache_storage.h b/webkit/appcache/appcache_storage.h index 7c31ca5..aa09eb6 100644 --- a/webkit/appcache/appcache_storage.h +++ b/webkit/appcache/appcache_storage.h @@ -140,16 +140,10 @@ class AppCacheStorage { virtual AppCacheResponseWriter* CreateResponseWriter( const GURL& manifest_url) = 0; - // Schedules the imminent deletion of many responses. + // Schedules the deletion of many responses. virtual void DoomResponses( const GURL& manifest_url, const std::vector<int64>& response_ids) = 0; - // Schedules the imminent deletion of a single response. - void DoomResponse(const GURL& manifest_url, int64 response_id) { - std::vector<int64> response_ids(1, response_id); - DoomResponses(manifest_url, response_ids); - } - // Generates unique storage ids for different object types. int64 NewCacheId() { return ++last_cache_id_; diff --git a/webkit/appcache/appcache_storage_impl_unittest.cc b/webkit/appcache/appcache_storage_impl_unittest.cc index cbb366a..1db4aa8 100644 --- a/webkit/appcache/appcache_storage_impl_unittest.cc +++ b/webkit/appcache/appcache_storage_impl_unittest.cc @@ -458,7 +458,7 @@ class AppCacheStorageImplTest : public testing::Test { // Change the cache. base::TimeTicks now = base::TimeTicks::Now(); - cache_->AddEntry(kEntryUrl, AppCacheEntry(AppCacheEntry::MASTER, 1, 100)); + cache_->AddEntry(kEntryUrl, AppCacheEntry(AppCacheEntry::MASTER)); cache_->set_update_time(now); PushNextTask(method_factory_.NewRunnableMethod( @@ -482,7 +482,6 @@ class AppCacheStorageImplTest : public testing::Test { EXPECT_EQ(1, cache_record.group_id); EXPECT_FALSE(cache_record.online_wildcard); EXPECT_TRUE(expected_update_time == cache_record.update_time); - EXPECT_EQ(100, cache_record.cache_size); std::vector<AppCacheDatabase::EntryRecord> entry_records; EXPECT_TRUE(database()->FindEntriesForCache(1, &entry_records)); @@ -490,8 +489,7 @@ class AppCacheStorageImplTest : public testing::Test { EXPECT_EQ(1 , entry_records[0].cache_id); EXPECT_EQ(kEntryUrl, entry_records[0].url); EXPECT_EQ(AppCacheEntry::MASTER, entry_records[0].flags); - EXPECT_EQ(1, entry_records[0].response_id); - EXPECT_EQ(100, entry_records[0].response_size); + EXPECT_EQ(0, entry_records[0].response_id); TestFinished(); } diff --git a/webkit/appcache/appcache_unittest.cc b/webkit/appcache/appcache_unittest.cc index 6177d13..9f41cd0e7 100644 --- a/webkit/appcache/appcache_unittest.cc +++ b/webkit/appcache/appcache_unittest.cc @@ -43,12 +43,11 @@ TEST(AppCacheTest, AddModifyEntry) { const GURL kUrl2("http://bar.com"); AppCacheEntry entry2(AppCacheEntry::FALLBACK); - EXPECT_TRUE(cache->AddOrModifyEntry(kUrl2, entry2)); + cache->AddOrModifyEntry(kUrl2, entry2); EXPECT_EQ(entry2.types(), cache->GetEntry(kUrl2)->types()); - // Expected to return false when an existing entry is modified. AppCacheEntry entry3(AppCacheEntry::EXPLICIT); - EXPECT_FALSE(cache->AddOrModifyEntry(kUrl1, entry3)); + cache->AddOrModifyEntry(kUrl1, entry3); EXPECT_EQ((AppCacheEntry::MASTER | AppCacheEntry::EXPLICIT), cache->GetEntry(kUrl1)->types()); EXPECT_EQ(entry2.types(), cache->GetEntry(kUrl2)->types()); // unchanged diff --git a/webkit/appcache/appcache_update_job.cc b/webkit/appcache/appcache_update_job.cc index a1f4ec5..04c409e 100644 --- a/webkit/appcache/appcache_update_job.cc +++ b/webkit/appcache/appcache_update_job.cc @@ -539,10 +539,8 @@ void AppCacheUpdateJob::HandleUrlFetchCompleted(URLRequest* request) { static_cast<UpdateJobInfo*>(request->GetUserData(this)); DCHECK(info->response_writer_.get()); entry.set_response_id(info->response_writer_->response_id()); - entry.set_response_size(info->response_writer_->amount_written()); - if (!inprogress_cache_->AddOrModifyEntry(url, entry)) - service_->storage()->DoomResponse(manifest_url_, entry.response_id()); + inprogress_cache_->AddOrModifyEntry(url, entry); // Foreign entries will be detected during cache selection. // Note: 6.9.4, step 17.9 possible optimization: if resource is HTML or XML @@ -569,7 +567,6 @@ void AppCacheUpdateJob::HandleUrlFetchCompleted(URLRequest* request) { AppCacheEntry* copy = cache->GetEntry(url); if (copy) { entry.set_response_id(copy->response_id()); - entry.set_response_size(copy->response_size()); inprogress_cache_->AddOrModifyEntry(url, entry); } } @@ -610,12 +607,8 @@ void AppCacheUpdateJob::HandleMasterEntryFetchCompleted(URLRequest* request) { group_->newest_complete_cache(); DCHECK(info->response_writer_.get()); AppCacheEntry master_entry(AppCacheEntry::MASTER, - info->response_writer_->response_id(), - info->response_writer_->amount_written()); - if (!cache->AddOrModifyEntry(url, master_entry)) { - service_->storage()->DoomResponse( - manifest_url_, master_entry.response_id()); - } + info->response_writer_->response_id()); + cache->AddOrModifyEntry(url, master_entry); // In no-update case, associate host with the newest cache. if (!inprogress_cache_) { @@ -708,10 +701,8 @@ void AppCacheUpdateJob::OnManifestInfoWriteComplete(int result) { void AppCacheUpdateJob::OnManifestDataWriteComplete(int result) { if (result > 0) { AppCacheEntry entry(AppCacheEntry::MANIFEST, - manifest_response_writer_->response_id(), - manifest_response_writer_->amount_written()); - if (!inprogress_cache_->AddOrModifyEntry(manifest_url_, entry)) - service_->storage()->DoomResponse(manifest_url_, entry.response_id()); + manifest_response_writer_->response_id()); + inprogress_cache_->AddOrModifyEntry(manifest_url_, entry); CompleteInprogressCache(); } else { // Treat storage failure as if refetch of manifest failed. @@ -1105,16 +1096,10 @@ void AppCacheUpdateJob::OnResponseInfoLoaded( http_info->headers->EnumerateHeader(&iter, name, &value)) { LoadFromNewestCacheFailed(url); } else { - DCHECK(group_->newest_complete_cache()); - AppCacheEntry* copy_me = group_->newest_complete_cache()->GetEntry(url); - DCHECK(copy_me); - DCHECK(copy_me->response_id() == response_id); - AppCache::EntryMap::iterator it = url_file_list_.find(url); DCHECK(it != url_file_list_.end()); AppCacheEntry& entry = it->second; entry.set_response_id(response_id); - entry.set_response_size(copy_me->response_size()); inprogress_cache_->AddOrModifyEntry(url, entry); ++url_fetches_completed_; } |