summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-11 00:12:15 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-11 00:12:15 +0000
commit9393b71775c7ea64004df0461d0564361bddd553 (patch)
treeec7f19a42d4e5907d4fffe862b672984e08d8f76
parentdefdc7d6edbccc329940f717038c8769ae125d52 (diff)
downloadchromium_src-9393b71775c7ea64004df0461d0564361bddd553.zip
chromium_src-9393b71775c7ea64004df0461d0564361bddd553.tar.gz
chromium_src-9393b71775c7ea64004df0461d0564361bddd553.tar.bz2
Http Cache: Add a load log to the DoomEntry operation.
BUG=26729 TEST=unittest Review URL: http://codereview.chromium.org/603011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38713 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--net/base/load_log_event_type_list.h3
-rw-r--r--net/http/http_cache_transaction.cc3
-rw-r--r--net/http/http_cache_unittest.cc23
3 files changed, 25 insertions, 4 deletions
diff --git a/net/base/load_log_event_type_list.h b/net/base/load_log_event_type_list.h
index a4eb5c4..99d1e63 100644
--- a/net/base/load_log_event_type_list.h
+++ b/net/base/load_log_event_type_list.h
@@ -136,6 +136,9 @@ EVENT_TYPE(HTTP_CACHE_OPEN_ENTRY)
// Measures the time while creating a disk cache entry.
EVENT_TYPE(HTTP_CACHE_CREATE_ENTRY)
+// Measures the time while deleting a disk cache entry.
+EVENT_TYPE(HTTP_CACHE_DOOM_ENTRY)
+
// Measures the time while reading the response info from a disk cache entry.
EVENT_TYPE(HTTP_CACHE_READ_INFO)
diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc
index 4db23f9..b35fd55 100644
--- a/net/http/http_cache_transaction.cc
+++ b/net/http/http_cache_transaction.cc
@@ -402,11 +402,12 @@ int HttpCache::Transaction::DoInitEntry() {
int HttpCache::Transaction::DoDoomEntry() {
next_state_ = STATE_DOOM_ENTRY_COMPLETE;
cache_pending_ = true;
- // TODO(rvargas): Add a LoadLog event.
+ LoadLog::BeginEvent(load_log_, LoadLog::TYPE_HTTP_CACHE_DOOM_ENTRY);
return cache_->DoomEntry(cache_key_, &io_callback_);
}
int HttpCache::Transaction::DoDoomEntryComplete(int result) {
+ LoadLog::EndEvent(load_log_, LoadLog::TYPE_HTTP_CACHE_DOOM_ENTRY);
next_state_ = STATE_CREATE_ENTRY;
cache_pending_ = false;
if (result == ERR_CACHE_RACE)
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
index c62052f..663176c 100644
--- a/net/http/http_cache_unittest.cc
+++ b/net/http/http_cache_unittest.cc
@@ -1106,14 +1106,31 @@ TEST(HttpCache, SimpleGET_LoadPreferringCache_Miss) {
TEST(HttpCache, SimpleGET_LoadBypassCache) {
MockHttpCache cache;
- // write to the cache
+ // Write to the cache.
RunTransactionTest(cache.http_cache(), kSimpleGET_Transaction);
- // force this transaction to write to the cache again
+ // Force this transaction to write to the cache again.
MockTransaction transaction(kSimpleGET_Transaction);
transaction.load_flags |= net::LOAD_BYPASS_CACHE;
- RunTransactionTest(cache.http_cache(), transaction);
+ scoped_refptr<net::LoadLog> log(new net::LoadLog(net::LoadLog::kUnbounded));
+
+ RunTransactionTestWithLog(cache.http_cache(), transaction, log);
+
+ // Check that the LoadLog was filled as expected.
+ EXPECT_EQ(6u, log->entries().size());
+ EXPECT_TRUE(net::LogContainsBeginEvent(
+ *log, 0, net::LoadLog::TYPE_HTTP_CACHE_DOOM_ENTRY));
+ EXPECT_TRUE(net::LogContainsEndEvent(
+ *log, 1, net::LoadLog::TYPE_HTTP_CACHE_DOOM_ENTRY));
+ EXPECT_TRUE(net::LogContainsBeginEvent(
+ *log, 2, net::LoadLog::TYPE_HTTP_CACHE_CREATE_ENTRY));
+ EXPECT_TRUE(net::LogContainsEndEvent(
+ *log, 3, net::LoadLog::TYPE_HTTP_CACHE_CREATE_ENTRY));
+ EXPECT_TRUE(net::LogContainsBeginEvent(
+ *log, 4, net::LoadLog::TYPE_HTTP_CACHE_WAITING));
+ EXPECT_TRUE(net::LogContainsEndEvent(
+ *log, 5, net::LoadLog::TYPE_HTTP_CACHE_WAITING));
EXPECT_EQ(2, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());