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

Unified Diff: net/disk_cache/memory/mem_entry_impl.cc

Issue 1059843002: Refactor NetLog::LogLevel --> NetLogCaptureMode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again to fix a merge conflict Created 5 years, 8 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/disk_cache/blockfile/sparse_control_v3.cc ('k') | net/disk_cache/net_log_parameters.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/memory/mem_entry_impl.cc
diff --git a/net/disk_cache/memory/mem_entry_impl.cc b/net/disk_cache/memory/mem_entry_impl.cc
index 7c6199b951b28febf2c2d2cb3b1c595a67ab0324..c1dc8cfebd10b142b7d5eb81b22bc6d9bb9e8485 100644
--- a/net/disk_cache/memory/mem_entry_impl.cc
+++ b/net/disk_cache/memory/mem_entry_impl.cc
@@ -48,7 +48,7 @@ std::string GenerateChildName(const std::string& base_name, int child_id) {
base::Value* NetLogChildEntryCreationCallback(
const disk_cache::MemEntryImpl* parent,
int child_id,
- net::NetLog::LogLevel /* log_level */) {
+ net::NetLogCaptureMode /* capture_mode */) {
base::DictionaryValue* dict = new base::DictionaryValue();
dict->SetString("key", GenerateChildName(parent->GetKey(), child_id));
dict->SetBoolean("created", true);
@@ -185,7 +185,7 @@ int32 MemEntryImpl::GetDataSize(int index) const {
int MemEntryImpl::ReadData(int index, int offset, IOBuffer* buf, int buf_len,
const CompletionCallback& callback) {
- if (net_log_.IsLogging()) {
+ if (net_log_.GetCaptureMode().enabled()) {
net_log_.BeginEvent(
net::NetLog::TYPE_ENTRY_READ_DATA,
CreateNetLogReadWriteDataCallback(index, offset, buf_len, false));
@@ -193,7 +193,7 @@ int MemEntryImpl::ReadData(int index, int offset, IOBuffer* buf, int buf_len,
int result = InternalReadData(index, offset, buf, buf_len);
- if (net_log_.IsLogging()) {
+ if (net_log_.GetCaptureMode().enabled()) {
net_log_.EndEvent(
net::NetLog::TYPE_ENTRY_READ_DATA,
CreateNetLogReadWriteCompleteCallback(result));
@@ -203,7 +203,7 @@ int MemEntryImpl::ReadData(int index, int offset, IOBuffer* buf, int buf_len,
int MemEntryImpl::WriteData(int index, int offset, IOBuffer* buf, int buf_len,
const CompletionCallback& callback, bool truncate) {
- if (net_log_.IsLogging()) {
+ if (net_log_.GetCaptureMode().enabled()) {
net_log_.BeginEvent(
net::NetLog::TYPE_ENTRY_WRITE_DATA,
CreateNetLogReadWriteDataCallback(index, offset, buf_len, truncate));
@@ -211,7 +211,7 @@ int MemEntryImpl::WriteData(int index, int offset, IOBuffer* buf, int buf_len,
int result = InternalWriteData(index, offset, buf, buf_len, truncate);
- if (net_log_.IsLogging()) {
+ if (net_log_.GetCaptureMode().enabled()) {
net_log_.EndEvent(
net::NetLog::TYPE_ENTRY_WRITE_DATA,
CreateNetLogReadWriteCompleteCallback(result));
@@ -221,39 +221,39 @@ int MemEntryImpl::WriteData(int index, int offset, IOBuffer* buf, int buf_len,
int MemEntryImpl::ReadSparseData(int64 offset, IOBuffer* buf, int buf_len,
const CompletionCallback& callback) {
- if (net_log_.IsLogging()) {
+ if (net_log_.GetCaptureMode().enabled()) {
net_log_.BeginEvent(
net::NetLog::TYPE_SPARSE_READ,
CreateNetLogSparseOperationCallback(offset, buf_len));
}
int result = InternalReadSparseData(offset, buf, buf_len);
- if (net_log_.IsLogging())
+ if (net_log_.GetCaptureMode().enabled())
net_log_.EndEvent(net::NetLog::TYPE_SPARSE_READ);
return result;
}
int MemEntryImpl::WriteSparseData(int64 offset, IOBuffer* buf, int buf_len,
const CompletionCallback& callback) {
- if (net_log_.IsLogging()) {
+ if (net_log_.GetCaptureMode().enabled()) {
net_log_.BeginEvent(
net::NetLog::TYPE_SPARSE_WRITE,
CreateNetLogSparseOperationCallback(offset, buf_len));
}
int result = InternalWriteSparseData(offset, buf, buf_len);
- if (net_log_.IsLogging())
+ if (net_log_.GetCaptureMode().enabled())
net_log_.EndEvent(net::NetLog::TYPE_SPARSE_WRITE);
return result;
}
int MemEntryImpl::GetAvailableRange(int64 offset, int len, int64* start,
const CompletionCallback& callback) {
- if (net_log_.IsLogging()) {
+ if (net_log_.GetCaptureMode().enabled()) {
net_log_.BeginEvent(
net::NetLog::TYPE_SPARSE_GET_RANGE,
CreateNetLogSparseOperationCallback(offset, len));
}
int result = GetAvailableRange(offset, len, start);
- if (net_log_.IsLogging()) {
+ if (net_log_.GetCaptureMode().enabled()) {
net_log_.EndEvent(
net::NetLog::TYPE_SPARSE_GET_RANGE,
CreateNetLogGetAvailableRangeResultCallback(*start, result));
@@ -373,7 +373,7 @@ int MemEntryImpl::InternalReadSparseData(int64 offset, IOBuffer* buf,
// we should stop.
if (child_offset < child->child_first_pos_)
break;
- if (net_log_.IsLogging()) {
+ if (net_log_.GetCaptureMode().enabled()) {
net_log_.BeginEvent(
net::NetLog::TYPE_SPARSE_READ_CHILD_DATA,
CreateNetLogSparseReadWriteCallback(child->net_log().source(),
@@ -381,7 +381,7 @@ int MemEntryImpl::InternalReadSparseData(int64 offset, IOBuffer* buf,
}
int ret = child->ReadData(kSparseData, child_offset, io_buf.get(),
io_buf->BytesRemaining(), CompletionCallback());
- if (net_log_.IsLogging()) {
+ if (net_log_.GetCaptureMode().enabled()) {
net_log_.EndEventWithNetErrorCode(
net::NetLog::TYPE_SPARSE_READ_CHILD_DATA, ret);
}
@@ -430,7 +430,7 @@ int MemEntryImpl::InternalWriteSparseData(int64 offset, IOBuffer* buf,
// Keep a record of the last byte position (exclusive) in the child.
int data_size = child->GetDataSize(kSparseData);
- if (net_log_.IsLogging()) {
+ if (net_log_.GetCaptureMode().enabled()) {
net_log_.BeginEvent(
net::NetLog::TYPE_SPARSE_WRITE_CHILD_DATA,
CreateNetLogSparseReadWriteCallback(child->net_log().source(),
@@ -443,7 +443,7 @@ int MemEntryImpl::InternalWriteSparseData(int64 offset, IOBuffer* buf,
// continuous we may want to discard this write.
int ret = child->WriteData(kSparseData, child_offset, io_buf.get(),
write_len, CompletionCallback(), true);
- if (net_log_.IsLogging()) {
+ if (net_log_.GetCaptureMode().enabled()) {
net_log_.EndEventWithNetErrorCode(
net::NetLog::TYPE_SPARSE_WRITE_CHILD_DATA, ret);
}
« no previous file with comments | « net/disk_cache/blockfile/sparse_control_v3.cc ('k') | net/disk_cache/net_log_parameters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698