| Index: net/disk_cache/simple/simple_entry_impl.cc
|
| diff --git a/net/disk_cache/simple/simple_entry_impl.cc b/net/disk_cache/simple/simple_entry_impl.cc
|
| index 1817bfc6018e91124c7fa8f41a13710882419825..afb2d028f83ebf453d90a48e06adb44702b00b87 100644
|
| --- a/net/disk_cache/simple/simple_entry_impl.cc
|
| +++ b/net/disk_cache/simple/simple_entry_impl.cc
|
| @@ -346,7 +346,7 @@ int SimpleEntryImpl::ReadData(int stream_index,
|
| const CompletionCallback& callback) {
|
| DCHECK(io_thread_checker_.CalledOnValidThread());
|
|
|
| - if (net_log_.GetCaptureMode().enabled()) {
|
| + if (net_log_.HasObservers()) {
|
| net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_CALL,
|
| CreateNetLogReadWriteDataCallback(stream_index, offset, buf_len,
|
| false));
|
| @@ -354,7 +354,7 @@ int SimpleEntryImpl::ReadData(int stream_index,
|
|
|
| if (stream_index < 0 || stream_index >= kSimpleEntryStreamCount ||
|
| buf_len < 0) {
|
| - if (net_log_.GetCaptureMode().enabled()) {
|
| + if (net_log_.HasObservers()) {
|
| net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_END,
|
| CreateNetLogReadWriteCompleteCallback(net::ERR_INVALID_ARGUMENT));
|
| }
|
| @@ -364,7 +364,7 @@ int SimpleEntryImpl::ReadData(int stream_index,
|
| }
|
| if (pending_operations_.empty() && (offset >= GetDataSize(stream_index) ||
|
| offset < 0 || !buf_len)) {
|
| - if (net_log_.GetCaptureMode().enabled()) {
|
| + if (net_log_.HasObservers()) {
|
| net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_END,
|
| CreateNetLogReadWriteCompleteCallback(0));
|
| }
|
| @@ -393,7 +393,7 @@ int SimpleEntryImpl::WriteData(int stream_index,
|
| bool truncate) {
|
| DCHECK(io_thread_checker_.CalledOnValidThread());
|
|
|
| - if (net_log_.GetCaptureMode().enabled()) {
|
| + if (net_log_.HasObservers()) {
|
| net_log_.AddEvent(
|
| net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_CALL,
|
| CreateNetLogReadWriteDataCallback(stream_index, offset, buf_len,
|
| @@ -402,7 +402,7 @@ int SimpleEntryImpl::WriteData(int stream_index,
|
|
|
| if (stream_index < 0 || stream_index >= kSimpleEntryStreamCount ||
|
| offset < 0 || buf_len < 0) {
|
| - if (net_log_.GetCaptureMode().enabled()) {
|
| + if (net_log_.HasObservers()) {
|
| net_log_.AddEvent(
|
| net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_END,
|
| CreateNetLogReadWriteCompleteCallback(net::ERR_INVALID_ARGUMENT));
|
| @@ -411,7 +411,7 @@ int SimpleEntryImpl::WriteData(int stream_index,
|
| return net::ERR_INVALID_ARGUMENT;
|
| }
|
| if (backend_.get() && offset + buf_len > backend_->GetMaxFileSize()) {
|
| - if (net_log_.GetCaptureMode().enabled()) {
|
| + if (net_log_.HasObservers()) {
|
| net_log_.AddEvent(
|
| net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_END,
|
| CreateNetLogReadWriteCompleteCallback(net::ERR_FAILED));
|
| @@ -453,7 +453,7 @@ int SimpleEntryImpl::WriteData(int stream_index,
|
| }
|
| op_callback = CompletionCallback();
|
| ret_value = buf_len;
|
| - if (net_log_.GetCaptureMode().enabled()) {
|
| + if (net_log_.HasObservers()) {
|
| net_log_.AddEvent(
|
| net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_OPTIMISTIC,
|
| CreateNetLogReadWriteCompleteCallback(buf_len));
|
| @@ -808,7 +808,7 @@ void SimpleEntryImpl::ReadDataInternal(int stream_index,
|
| DCHECK(io_thread_checker_.CalledOnValidThread());
|
| ScopedOperationRunner operation_runner(this);
|
|
|
| - if (net_log_.GetCaptureMode().enabled()) {
|
| + if (net_log_.HasObservers()) {
|
| net_log_.AddEvent(
|
| net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_BEGIN,
|
| CreateNetLogReadWriteDataCallback(stream_index, offset, buf_len,
|
| @@ -824,7 +824,7 @@ void SimpleEntryImpl::ReadDataInternal(int stream_index,
|
| base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| FROM_HERE, base::Bind(callback, net::ERR_FAILED));
|
| }
|
| - if (net_log_.GetCaptureMode().enabled()) {
|
| + if (net_log_.HasObservers()) {
|
| net_log_.AddEvent(
|
| net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_END,
|
| CreateNetLogReadWriteCompleteCallback(net::ERR_FAILED));
|
| @@ -891,7 +891,7 @@ void SimpleEntryImpl::WriteDataInternal(int stream_index,
|
| DCHECK(io_thread_checker_.CalledOnValidThread());
|
| ScopedOperationRunner operation_runner(this);
|
|
|
| - if (net_log_.GetCaptureMode().enabled()) {
|
| + if (net_log_.HasObservers()) {
|
| net_log_.AddEvent(
|
| net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_BEGIN,
|
| CreateNetLogReadWriteDataCallback(stream_index, offset, buf_len,
|
| @@ -900,7 +900,7 @@ void SimpleEntryImpl::WriteDataInternal(int stream_index,
|
|
|
| if (state_ == STATE_FAILURE || state_ == STATE_UNINITIALIZED) {
|
| RecordWriteResult(cache_type_, WRITE_RESULT_BAD_STATE);
|
| - if (net_log_.GetCaptureMode().enabled()) {
|
| + if (net_log_.HasObservers()) {
|
| net_log_.AddEvent(
|
| net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_END,
|
| CreateNetLogReadWriteCompleteCallback(net::ERR_FAILED));
|
| @@ -1229,7 +1229,7 @@ void SimpleEntryImpl::ReadOperationComplete(
|
| crc_check_state_[stream_index] = CRC_CHECK_NOT_DONE;
|
| }
|
| }
|
| - if (net_log_.GetCaptureMode().enabled()) {
|
| + if (net_log_.HasObservers()) {
|
| net_log_.AddEvent(
|
| net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_END,
|
| CreateNetLogReadWriteCompleteCallback(*result));
|
| @@ -1247,7 +1247,7 @@ void SimpleEntryImpl::WriteOperationComplete(
|
| RecordWriteResult(cache_type_, WRITE_RESULT_SUCCESS);
|
| else
|
| RecordWriteResult(cache_type_, WRITE_RESULT_SYNC_WRITE_FAILURE);
|
| - if (net_log_.GetCaptureMode().enabled()) {
|
| + if (net_log_.HasObservers()) {
|
| net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_END,
|
| CreateNetLogReadWriteCompleteCallback(*result));
|
| }
|
| @@ -1318,7 +1318,7 @@ void SimpleEntryImpl::ChecksumOperationComplete(
|
| DCHECK_EQ(STATE_IO_PENDING, state_);
|
| DCHECK(result);
|
|
|
| - if (net_log_.GetCaptureMode().enabled()) {
|
| + if (net_log_.HasObservers()) {
|
| net_log_.AddEventWithNetErrorCode(
|
| net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_CHECKSUM_END,
|
| *result);
|
| @@ -1333,7 +1333,7 @@ void SimpleEntryImpl::ChecksumOperationComplete(
|
| } else {
|
| RecordReadResult(cache_type_, READ_RESULT_SYNC_CHECKSUM_FAILURE);
|
| }
|
| - if (net_log_.GetCaptureMode().enabled()) {
|
| + if (net_log_.HasObservers()) {
|
| net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_END,
|
| CreateNetLogReadWriteCompleteCallback(*result));
|
| }
|
|
|