Index: net/http/http_cache_transaction.cc |
diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc |
index c429c3db4aa78db731187e23d5627fdf3083c8c4..1727db15b7bce7e33df512d783a92a9b8a9e4e31 100644 |
--- a/net/http/http_cache_transaction.cc |
+++ b/net/http/http_cache_transaction.cc |
@@ -39,6 +39,7 @@ |
#include "net/http/http_network_session.h" |
#include "net/http/http_request_info.h" |
#include "net/http/http_util.h" |
+#include "net/log/net_log_event_type.h" |
#include "net/ssl/ssl_cert_request_info.h" |
#include "net/ssl/ssl_config_service.h" |
@@ -877,13 +878,13 @@ int HttpCache::Transaction::DoLoop(int result) { |
int HttpCache::Transaction::DoGetBackend() { |
cache_pending_ = true; |
next_state_ = STATE_GET_BACKEND_COMPLETE; |
- net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_GET_BACKEND); |
+ net_log_.BeginEvent(NetLogEventType::HTTP_CACHE_GET_BACKEND); |
return cache_->GetBackendForTransaction(this); |
} |
int HttpCache::Transaction::DoGetBackendComplete(int result) { |
DCHECK(result == OK || result == ERR_FAILED); |
- net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_GET_BACKEND, |
+ net_log_.EndEventWithNetErrorCode(NetLogEventType::HTTP_CACHE_GET_BACKEND, |
result); |
cache_pending_ = false; |
@@ -965,7 +966,7 @@ int HttpCache::Transaction::DoOpenEntry() { |
DCHECK(!new_entry_); |
next_state_ = STATE_OPEN_ENTRY_COMPLETE; |
cache_pending_ = true; |
- net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY); |
+ net_log_.BeginEvent(NetLogEventType::HTTP_CACHE_OPEN_ENTRY); |
first_cache_access_since_ = TimeTicks::Now(); |
return cache_->OpenEntry(cache_key_, &new_entry_, this); |
} |
@@ -974,7 +975,8 @@ int HttpCache::Transaction::DoOpenEntryComplete(int result) { |
// It is important that we go to STATE_ADD_TO_ENTRY whenever the result is |
// OK, otherwise the cache will end up with an active entry without any |
// transaction attached. |
- net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY, result); |
+ net_log_.EndEventWithNetErrorCode(NetLogEventType::HTTP_CACHE_OPEN_ENTRY, |
+ result); |
cache_pending_ = false; |
if (result == OK) { |
next_state_ = STATE_ADD_TO_ENTRY; |
@@ -1016,12 +1018,13 @@ int HttpCache::Transaction::DoDoomEntry() { |
cache_pending_ = true; |
if (first_cache_access_since_.is_null()) |
first_cache_access_since_ = TimeTicks::Now(); |
- net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_DOOM_ENTRY); |
+ net_log_.BeginEvent(NetLogEventType::HTTP_CACHE_DOOM_ENTRY); |
return cache_->DoomEntry(cache_key_, this); |
} |
int HttpCache::Transaction::DoDoomEntryComplete(int result) { |
- net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_DOOM_ENTRY, result); |
+ net_log_.EndEventWithNetErrorCode(NetLogEventType::HTTP_CACHE_DOOM_ENTRY, |
+ result); |
next_state_ = STATE_CREATE_ENTRY; |
cache_pending_ = false; |
if (result == ERR_CACHE_RACE) |
@@ -1033,7 +1036,7 @@ int HttpCache::Transaction::DoCreateEntry() { |
DCHECK(!new_entry_); |
next_state_ = STATE_CREATE_ENTRY_COMPLETE; |
cache_pending_ = true; |
- net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY); |
+ net_log_.BeginEvent(NetLogEventType::HTTP_CACHE_CREATE_ENTRY); |
return cache_->CreateEntry(cache_key_, &new_entry_, this); |
} |
@@ -1041,7 +1044,7 @@ int HttpCache::Transaction::DoCreateEntryComplete(int result) { |
// It is important that we go to STATE_ADD_TO_ENTRY whenever the result is |
// OK, otherwise the cache will end up with an active entry without any |
// transaction attached. |
- net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY, |
+ net_log_.EndEventWithNetErrorCode(NetLogEventType::HTTP_CACHE_CREATE_ENTRY, |
result); |
cache_pending_ = false; |
switch (result) { |
@@ -1071,7 +1074,7 @@ int HttpCache::Transaction::DoAddToEntry() { |
DCHECK(new_entry_); |
cache_pending_ = true; |
next_state_ = STATE_ADD_TO_ENTRY_COMPLETE; |
- net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY); |
+ net_log_.BeginEvent(NetLogEventType::HTTP_CACHE_ADD_TO_ENTRY); |
DCHECK(entry_lock_waiting_since_.is_null()); |
entry_lock_waiting_since_ = TimeTicks::Now(); |
int rv = cache_->AddTransactionToEntry(new_entry_, this); |
@@ -1109,7 +1112,7 @@ int HttpCache::Transaction::DoAddToEntry() { |
} |
int HttpCache::Transaction::DoAddToEntryComplete(int result) { |
- net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY, |
+ net_log_.EndEventWithNetErrorCode(NetLogEventType::HTTP_CACHE_ADD_TO_ENTRY, |
result); |
const TimeDelta entry_lock_wait = |
TimeTicks::Now() - entry_lock_waiting_since_; |
@@ -1167,13 +1170,14 @@ int HttpCache::Transaction::DoCacheReadResponse() { |
io_buf_len_ = entry_->disk_entry->GetDataSize(kResponseInfoIndex); |
read_buf_ = new IOBuffer(io_buf_len_); |
- net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_READ_INFO); |
+ net_log_.BeginEvent(NetLogEventType::HTTP_CACHE_READ_INFO); |
return entry_->disk_entry->ReadData(kResponseInfoIndex, 0, read_buf_.get(), |
io_buf_len_, io_callback_); |
} |
int HttpCache::Transaction::DoCacheReadResponseComplete(int result) { |
- net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_READ_INFO, result); |
+ net_log_.EndEventWithNetErrorCode(NetLogEventType::HTTP_CACHE_READ_INFO, |
+ result); |
if (result != io_buf_len_ || |
!HttpCache::ParseResponseInfo(read_buf_->data(), io_buf_len_, &response_, |
&truncated_)) { |
@@ -1423,7 +1427,7 @@ int HttpCache::Transaction::DoSuccessfulSendRequest() { |
// If we have an authentication response, we are exposed to weird things |
// hapenning if the user cancels the authentication before we receive |
// the new response. |
- net_log_.AddEvent(NetLog::TYPE_HTTP_CACHE_RE_SEND_PARTIAL_REQUEST); |
+ net_log_.AddEvent(NetLogEventType::HTTP_CACHE_RE_SEND_PARTIAL_REQUEST); |
UpdateCacheEntryStatus(CacheEntryStatus::ENTRY_OTHER); |
SetResponse(HttpResponseInfo()); |
ResetNetworkTransaction(); |
@@ -1617,7 +1621,7 @@ int HttpCache::Transaction::DoTruncateCachedData() { |
if (!entry_) |
return OK; |
if (net_log_.IsCapturing()) |
- net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WRITE_DATA); |
+ net_log_.BeginEvent(NetLogEventType::HTTP_CACHE_WRITE_DATA); |
// Truncate the stream. |
return WriteToEntry(kResponseContentIndex, 0, NULL, 0, io_callback_); |
} |
@@ -1625,7 +1629,7 @@ int HttpCache::Transaction::DoTruncateCachedData() { |
int HttpCache::Transaction::DoTruncateCachedDataComplete(int result) { |
if (entry_) { |
if (net_log_.IsCapturing()) { |
- net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_WRITE_DATA, |
+ net_log_.EndEventWithNetErrorCode(NetLogEventType::HTTP_CACHE_WRITE_DATA, |
result); |
} |
} |
@@ -1640,14 +1644,14 @@ int HttpCache::Transaction::DoTruncateCachedMetadata() { |
return OK; |
if (net_log_.IsCapturing()) |
- net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WRITE_INFO); |
+ net_log_.BeginEvent(NetLogEventType::HTTP_CACHE_WRITE_INFO); |
return WriteToEntry(kMetadataIndex, 0, NULL, 0, io_callback_); |
} |
int HttpCache::Transaction::DoTruncateCachedMetadataComplete(int result) { |
if (entry_) { |
if (net_log_.IsCapturing()) { |
- net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_WRITE_INFO, |
+ net_log_.EndEventWithNetErrorCode(NetLogEventType::HTTP_CACHE_WRITE_INFO, |
result); |
} |
} |
@@ -1686,7 +1690,7 @@ int HttpCache::Transaction::DoCacheReadMetadata() { |
response_.metadata = |
new IOBufferWithSize(entry_->disk_entry->GetDataSize(kMetadataIndex)); |
- net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_READ_INFO); |
+ net_log_.BeginEvent(NetLogEventType::HTTP_CACHE_READ_INFO); |
return entry_->disk_entry->ReadData(kMetadataIndex, 0, |
response_.metadata.get(), |
response_.metadata->size(), |
@@ -1694,7 +1698,8 @@ int HttpCache::Transaction::DoCacheReadMetadata() { |
} |
int HttpCache::Transaction::DoCacheReadMetadataComplete(int result) { |
- net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_READ_INFO, result); |
+ net_log_.EndEventWithNetErrorCode(NetLogEventType::HTTP_CACHE_READ_INFO, |
+ result); |
if (result != response_.metadata->size()) |
return OnCacheReadError(result, false); |
return OK; |
@@ -1728,7 +1733,7 @@ int HttpCache::Transaction::DoCacheReadData() { |
next_state_ = STATE_CACHE_READ_DATA_COMPLETE; |
if (net_log_.IsCapturing()) |
- net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_READ_DATA); |
+ net_log_.BeginEvent(NetLogEventType::HTTP_CACHE_READ_DATA); |
if (partial_) { |
return partial_->CacheRead(entry_->disk_entry, read_buf_.get(), io_buf_len_, |
io_callback_); |
@@ -1741,7 +1746,7 @@ int HttpCache::Transaction::DoCacheReadData() { |
int HttpCache::Transaction::DoCacheReadDataComplete(int result) { |
if (net_log_.IsCapturing()) { |
- net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_READ_DATA, |
+ net_log_.EndEventWithNetErrorCode(NetLogEventType::HTTP_CACHE_READ_DATA, |
result); |
} |
@@ -1772,7 +1777,7 @@ int HttpCache::Transaction::DoCacheWriteData(int num_bytes) { |
write_len_ = num_bytes; |
if (entry_) { |
if (net_log_.IsCapturing()) |
- net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WRITE_DATA); |
+ net_log_.BeginEvent(NetLogEventType::HTTP_CACHE_WRITE_DATA); |
} |
if (!entry_ || !num_bytes) |
@@ -1786,7 +1791,7 @@ int HttpCache::Transaction::DoCacheWriteData(int num_bytes) { |
int HttpCache::Transaction::DoCacheWriteDataComplete(int result) { |
if (entry_) { |
if (net_log_.IsCapturing()) { |
- net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_WRITE_DATA, |
+ net_log_.EndEventWithNetErrorCode(NetLogEventType::HTTP_CACHE_WRITE_DATA, |
result); |
} |
} |
@@ -1900,7 +1905,7 @@ void HttpCache::Transaction::SetRequest(const BoundNetLog& net_log, |
// Log the headers before request_ is modified. |
std::string empty; |
net_log_.AddEvent( |
- NetLog::TYPE_HTTP_CACHE_CALLER_REQUEST_HEADERS, |
+ NetLogEventType::HTTP_CACHE_CALLER_REQUEST_HEADERS, |
base::Bind(&HttpRequestHeaders::NetLogCallback, |
base::Unretained(&request_->extra_headers), &empty)); |
} |
@@ -2523,7 +2528,7 @@ int HttpCache::Transaction::WriteResponseInfoToEntry(bool truncated) { |
return OK; |
if (net_log_.IsCapturing()) |
- net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WRITE_INFO); |
+ net_log_.BeginEvent(NetLogEventType::HTTP_CACHE_WRITE_INFO); |
// Do not cache no-store content. Do not cache content with cert errors |
// either. This is to prevent not reporting net errors when loading a |
@@ -2538,7 +2543,7 @@ int HttpCache::Transaction::WriteResponseInfoToEntry(bool truncated) { |
IsCertStatusError(response_.ssl_info.cert_status)) { |
DoneWritingToEntry(false); |
if (net_log_.IsCapturing()) |
- net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_WRITE_INFO); |
+ net_log_.EndEvent(NetLogEventType::HTTP_CACHE_WRITE_INFO); |
return OK; |
} |
@@ -2560,7 +2565,7 @@ int HttpCache::Transaction::OnWriteResponseInfoToEntryComplete(int result) { |
if (!entry_) |
return OK; |
if (net_log_.IsCapturing()) { |
- net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_WRITE_INFO, |
+ net_log_.EndEventWithNetErrorCode(NetLogEventType::HTTP_CACHE_WRITE_INFO, |
result); |
} |
@@ -2661,7 +2666,7 @@ int HttpCache::Transaction::DoPartialCacheReadCompleted(int result) { |
int HttpCache::Transaction::DoRestartPartialRequest() { |
// The stored data cannot be used. Get rid of it and restart this request. |
- net_log_.AddEvent(NetLog::TYPE_HTTP_CACHE_RESTART_PARTIAL_REQUEST); |
+ net_log_.AddEvent(NetLogEventType::HTTP_CACHE_RESTART_PARTIAL_REQUEST); |
// WRITE + Doom + STATE_INIT_ENTRY == STATE_CREATE_ENTRY (without an attempt |
// to Doom the entry again). |