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

Unified Diff: net/http/http_cache.cc

Issue 201035: Add some trace-points to HttpCache for request profiling (cache entry "open",... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Sync and resolve conflict Created 11 years, 3 months 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 | « net/base/load_log_event_type_list.h ('k') | net/http/http_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_cache.cc
===================================================================
--- net/http/http_cache.cc (revision 25573)
+++ net/http/http_cache.cc (working copy)
@@ -20,6 +20,7 @@
#include "base/time.h"
#include "net/base/io_buffer.h"
#include "net/base/load_flags.h"
+#include "net/base/load_log.h"
#include "net/base/net_errors.h"
#include "net/base/ssl_cert_request_info.h"
#include "net/disk_cache/disk_cache.h"
@@ -635,7 +636,9 @@
} else {
entry = cache_->FindActiveEntry(cache_key_);
if (!entry) {
+ LoadLog::BeginEvent(load_log_, LoadLog::TYPE_HTTP_CACHE_OPEN_ENTRY);
entry = cache_->OpenEntry(cache_key_);
+ LoadLog::EndEvent(load_log_, LoadLog::TYPE_HTTP_CACHE_OPEN_ENTRY);
if (!entry) {
if (mode_ == READ_WRITE) {
mode_ = WRITE;
@@ -657,7 +660,9 @@
if (mode_ == WRITE) {
DCHECK(!entry);
+ LoadLog::BeginEvent(load_log_, LoadLog::TYPE_HTTP_CACHE_CREATE_ENTRY);
entry = cache_->CreateEntry(cache_key_);
+ LoadLog::EndEvent(load_log_, LoadLog::TYPE_HTTP_CACHE_CREATE_ENTRY);
if (!entry) {
DLOG(WARNING) << "unable to create cache entry";
mode_ = NONE;
@@ -665,10 +670,14 @@
}
}
+
+ LoadLog::BeginEvent(load_log_, LoadLog::TYPE_HTTP_CACHE_WAITING);
return cache_->AddTransactionToEntry(entry, this);
}
int HttpCache::Transaction::EntryAvailable(ActiveEntry* entry) {
+ LoadLog::EndEvent(load_log_, LoadLog::TYPE_HTTP_CACHE_WAITING);
+
// We now have access to the cache entry.
//
// o if we are the writer for the transaction, then we can start the network
@@ -1273,9 +1282,12 @@
int HttpCache::Transaction::ReadResponseInfoFromEntry() {
DCHECK(entry_);
- if (!HttpCache::ReadResponseInfo(entry_->disk_entry, &response_, &truncated_))
- return ERR_CACHE_READ_FAILURE;
- return OK;
+ LoadLog::BeginEvent(load_log_, LoadLog::TYPE_HTTP_CACHE_READ_INFO);
+ bool read_ok =
+ HttpCache::ReadResponseInfo(entry_->disk_entry, &response_, &truncated_);
+ LoadLog::EndEvent(load_log_, LoadLog::TYPE_HTTP_CACHE_READ_INFO);
+
+ return read_ok ? OK : ERR_CACHE_READ_FAILURE;
}
void HttpCache::Transaction::WriteToEntry(int index, int offset,
« no previous file with comments | « net/base/load_log_event_type_list.h ('k') | net/http/http_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698