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

Unified Diff: net/disk_cache/simple/simple_entry_impl.cc

Issue 1423063007: Simple Cache: Record sparse reads/writes in NetLog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@buf_not_buff
Patch Set: rebase, again Created 4 years, 11 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 | « no previous file | net/log/net_log_event_type_list.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 efdd65a589a02b407ea43ad4ac1974ecffdc7f34..2c25d0ff8d02c2b8453501d33930ad2a83e6bba6 100644
--- a/net/disk_cache/simple/simple_entry_impl.cc
+++ b/net/disk_cache/simple/simple_entry_impl.cc
@@ -479,6 +479,11 @@ int SimpleEntryImpl::ReadSparseData(int64_t offset,
const CompletionCallback& callback) {
DCHECK(io_thread_checker_.CalledOnValidThread());
+ if (net_log_.IsCapturing()) {
+ net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_SPARSE_CALL,
+ CreateNetLogSparseOperationCallback(offset, buf_len));
+ }
+
ScopedOperationRunner operation_runner(this);
pending_operations_.push(SimpleEntryOperation::ReadSparseOperation(
this, offset, buf_len, buf, callback));
@@ -491,6 +496,11 @@ int SimpleEntryImpl::WriteSparseData(int64_t offset,
const CompletionCallback& callback) {
DCHECK(io_thread_checker_.CalledOnValidThread());
+ if (net_log_.IsCapturing()) {
+ net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_SPARSE_CALL,
+ CreateNetLogSparseOperationCallback(offset, buf_len));
+ }
+
ScopedOperationRunner operation_runner(this);
pending_operations_.push(SimpleEntryOperation::WriteSparseOperation(
this, offset, buf_len, buf, callback));
@@ -992,6 +1002,12 @@ void SimpleEntryImpl::ReadSparseDataInternal(
DCHECK(io_thread_checker_.CalledOnValidThread());
ScopedOperationRunner operation_runner(this);
+ if (net_log_.IsCapturing()) {
+ net_log_.AddEvent(
+ net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_SPARSE_BEGIN,
+ CreateNetLogSparseOperationCallback(sparse_offset, buf_len));
+ }
+
DCHECK_EQ(STATE_READY, state_);
state_ = STATE_IO_PENDING;
@@ -1020,6 +1036,12 @@ void SimpleEntryImpl::WriteSparseDataInternal(
DCHECK(io_thread_checker_.CalledOnValidThread());
ScopedOperationRunner operation_runner(this);
+ if (net_log_.IsCapturing()) {
+ net_log_.AddEvent(
+ net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_SPARSE_BEGIN,
+ CreateNetLogSparseOperationCallback(sparse_offset, buf_len));
+ }
+
DCHECK_EQ(STATE_READY, state_);
state_ = STATE_IO_PENDING;
@@ -1264,6 +1286,11 @@ void SimpleEntryImpl::ReadSparseOperationComplete(
DCHECK(synchronous_entry_);
DCHECK(result);
+ if (net_log_.IsCapturing()) {
+ net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_SPARSE_END,
+ CreateNetLogReadWriteCompleteCallback(*result));
+ }
+
SimpleEntryStat entry_stat(*last_used, last_modified_, data_size_,
sparse_data_size_);
EntryOperationComplete(completion_callback, entry_stat, std::move(result));
@@ -1277,6 +1304,11 @@ void SimpleEntryImpl::WriteSparseOperationComplete(
DCHECK(synchronous_entry_);
DCHECK(result);
+ if (net_log_.IsCapturing()) {
+ net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_SPARSE_END,
+ CreateNetLogReadWriteCompleteCallback(*result));
+ }
+
EntryOperationComplete(completion_callback, *entry_stat, std::move(result));
}
« no previous file with comments | « no previous file | net/log/net_log_event_type_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698