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

Unified Diff: net/disk_cache/sparse_control.cc

Issue 4067002: First pass at adding http/backend cache to NetLog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Add back mysteriously missing files Created 10 years 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
Index: net/disk_cache/sparse_control.cc
===================================================================
--- net/disk_cache/sparse_control.cc (revision 68857)
+++ net/disk_cache/sparse_control.cc (working copy)
@@ -223,6 +223,7 @@
finished_ = false;
abort_ = false;
+ entry_->net_log().BeginEvent(net::NetLog::TYPE_SPARSE_CONTROL, NULL);
rvargas (doing something else) 2010/12/13 23:34:39 It would be nice to log |op| here. Actually, prob
mmenke 2010/12/14 00:04:43 I should have mentioned this earlier...But I'm not
rvargas (doing something else) 2010/12/14 00:14:26 Just go to a page with HTML5 <video> or <audio>...
mmenke 2010/12/14 17:53:43 I thought about doing that with this CL, but thoug
rvargas (doing something else) 2010/12/14 19:48:57 Sure, that's the right thing to do.
mmenke 2010/12/14 20:10:21 There's no obvious place to log an end event in Re
DoChildrenIO();
if (!pending_) {
@@ -610,8 +611,11 @@
void SparseControl::DoChildrenIO() {
while (DoChildIO()) continue;
- if (pending_ && finished_)
- DoUserCallback();
+ if (finished_) {
+ entry_->net_log().EndEvent(net::NetLog::TYPE_SPARSE_CONTROL, NULL);
+ if (pending_)
+ DoUserCallback();
+ }
}
bool SparseControl::DoChildIO() {
@@ -632,14 +636,32 @@
int rv = 0;
switch (operation_) {
case kReadOperation:
+ if (entry_->net_log().IsLoggingAllEvents()) {
+ entry_->net_log().BeginEvent(
+ net::NetLog::TYPE_SPARSE_CONTROL_READ,
rvargas (doing something else) 2010/12/14 19:48:57 It would be helpful to log child_len_ here
+ make_scoped_refptr(new net::NetLogSourceParameter(
+ "source_dependency",
+ child_->net_log().source())));
+ }
rv = child_->ReadDataImpl(kSparseData, child_offset_, user_buf_,
child_len_, callback);
break;
case kWriteOperation:
+ if (entry_->net_log().IsLoggingAllEvents()) {
+ entry_->net_log().BeginEvent(
+ net::NetLog::TYPE_SPARSE_CONTROL_WRITE,
rvargas (doing something else) 2010/12/14 19:48:57 and here
+ make_scoped_refptr(new net::NetLogSourceParameter(
+ "source_dependency",
+ child_->net_log().source())));
+ }
rv = child_->WriteDataImpl(kSparseData, child_offset_, user_buf_,
child_len_, callback, false);
break;
case kGetRangeOperation:
+ if (entry_->net_log().IsLoggingAllEvents()) {
+ entry_->net_log().BeginEvent(net::NetLog::TYPE_SPARSE_CONTROL_GET_RANGE,
+ NULL);
+ }
rv = DoGetAvailableRange();
break;
default:
@@ -712,6 +734,23 @@
}
void SparseControl::DoChildIOCompleted(int result) {
+ if (entry_->net_log().IsLoggingAllEvents()) {
+ net::NetLog::EventType event_type;
+ switch (operation_) {
+ case kReadOperation:
+ event_type = net::NetLog::TYPE_SPARSE_CONTROL_READ;
+ break;
+ case kWriteOperation:
+ event_type = net::NetLog::TYPE_SPARSE_CONTROL_WRITE;
+ break;
+ case kGetRangeOperation:
+ event_type = net::NetLog::TYPE_SPARSE_CONTROL_GET_RANGE;
+ break;
+ default:
+ NOTREACHED();
+ }
+ entry_->net_log().EndEventWithErrorCode(event_type, result);
+ }
if (result < 0) {
// We fail the whole operation if we encounter an error.
result_ = result;
@@ -737,6 +776,8 @@
// We'll return the current result of the operation, which may be less than
// the bytes to read or write, but the user cancelled the operation.
abort_ = false;
+ entry_->net_log().AddEvent(net::NetLog::TYPE_CANCELLED, NULL);
+ entry_->net_log().EndEvent(net::NetLog::TYPE_SPARSE_CONTROL, NULL);
DoUserCallback();
return DoAbortCallbacks();
}

Powered by Google App Engine
This is Rietveld 408576698