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

Side by Side Diff: net/disk_cache/blockfile/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 unified diff | Download patch
« no previous file with comments | « net/cert/x509_certificate_net_log_param.cc ('k') | net/disk_cache/blockfile/entry_impl_v3.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/disk_cache/blockfile/entry_impl.h" 5 #include "net/disk_cache/blockfile/entry_impl.h"
6 6
7 #include "base/hash.h" 7 #include "base/hash.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 scoped_refptr<net::IOBuffer> buf_; 55 scoped_refptr<net::IOBuffer> buf_;
56 TimeTicks start_; 56 TimeTicks start_;
57 const net::NetLog::EventType end_event_type_; 57 const net::NetLog::EventType end_event_type_;
58 58
59 DISALLOW_COPY_AND_ASSIGN(SyncCallback); 59 DISALLOW_COPY_AND_ASSIGN(SyncCallback);
60 }; 60 };
61 61
62 void SyncCallback::OnFileIOComplete(int bytes_copied) { 62 void SyncCallback::OnFileIOComplete(int bytes_copied) {
63 entry_->DecrementIoCount(); 63 entry_->DecrementIoCount();
64 if (!callback_.is_null()) { 64 if (!callback_.is_null()) {
65 if (entry_->net_log().IsLogging()) { 65 if (entry_->net_log().GetCaptureMode().enabled()) {
66 entry_->net_log().EndEvent( 66 entry_->net_log().EndEvent(
67 end_event_type_, 67 end_event_type_,
68 disk_cache::CreateNetLogReadWriteCompleteCallback(bytes_copied)); 68 disk_cache::CreateNetLogReadWriteCompleteCallback(bytes_copied));
69 } 69 }
70 entry_->ReportIOTime(disk_cache::EntryImpl::kAsyncIO, start_); 70 entry_->ReportIOTime(disk_cache::EntryImpl::kAsyncIO, start_);
71 buf_ = NULL; // Release the buffer before invoking the callback. 71 buf_ = NULL; // Release the buffer before invoking the callback.
72 callback_.Run(bytes_copied); 72 callback_.Run(bytes_copied);
73 } 73 }
74 entry_->Release(); 74 entry_->Release();
75 delete this; 75 delete this;
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 void EntryImpl::DoomImpl() { 308 void EntryImpl::DoomImpl() {
309 if (doomed_ || !backend_.get()) 309 if (doomed_ || !backend_.get())
310 return; 310 return;
311 311
312 SetPointerForInvalidEntry(backend_->GetCurrentEntryId()); 312 SetPointerForInvalidEntry(backend_->GetCurrentEntryId());
313 backend_->InternalDoomEntry(this); 313 backend_->InternalDoomEntry(this);
314 } 314 }
315 315
316 int EntryImpl::ReadDataImpl(int index, int offset, IOBuffer* buf, int buf_len, 316 int EntryImpl::ReadDataImpl(int index, int offset, IOBuffer* buf, int buf_len,
317 const CompletionCallback& callback) { 317 const CompletionCallback& callback) {
318 if (net_log_.IsLogging()) { 318 if (net_log_.GetCaptureMode().enabled()) {
319 net_log_.BeginEvent( 319 net_log_.BeginEvent(
320 net::NetLog::TYPE_ENTRY_READ_DATA, 320 net::NetLog::TYPE_ENTRY_READ_DATA,
321 CreateNetLogReadWriteDataCallback(index, offset, buf_len, false)); 321 CreateNetLogReadWriteDataCallback(index, offset, buf_len, false));
322 } 322 }
323 323
324 int result = InternalReadData(index, offset, buf, buf_len, callback); 324 int result = InternalReadData(index, offset, buf, buf_len, callback);
325 325
326 if (result != net::ERR_IO_PENDING && net_log_.IsLogging()) { 326 if (result != net::ERR_IO_PENDING && net_log_.GetCaptureMode().enabled()) {
327 net_log_.EndEvent( 327 net_log_.EndEvent(
328 net::NetLog::TYPE_ENTRY_READ_DATA, 328 net::NetLog::TYPE_ENTRY_READ_DATA,
329 CreateNetLogReadWriteCompleteCallback(result)); 329 CreateNetLogReadWriteCompleteCallback(result));
330 } 330 }
331 return result; 331 return result;
332 } 332 }
333 333
334 int EntryImpl::WriteDataImpl(int index, int offset, IOBuffer* buf, int buf_len, 334 int EntryImpl::WriteDataImpl(int index, int offset, IOBuffer* buf, int buf_len,
335 const CompletionCallback& callback, 335 const CompletionCallback& callback,
336 bool truncate) { 336 bool truncate) {
337 if (net_log_.IsLogging()) { 337 if (net_log_.GetCaptureMode().enabled()) {
338 net_log_.BeginEvent( 338 net_log_.BeginEvent(
339 net::NetLog::TYPE_ENTRY_WRITE_DATA, 339 net::NetLog::TYPE_ENTRY_WRITE_DATA,
340 CreateNetLogReadWriteDataCallback(index, offset, buf_len, truncate)); 340 CreateNetLogReadWriteDataCallback(index, offset, buf_len, truncate));
341 } 341 }
342 342
343 int result = InternalWriteData(index, offset, buf, buf_len, callback, 343 int result = InternalWriteData(index, offset, buf, buf_len, callback,
344 truncate); 344 truncate);
345 345
346 if (result != net::ERR_IO_PENDING && net_log_.IsLogging()) { 346 if (result != net::ERR_IO_PENDING && net_log_.GetCaptureMode().enabled()) {
347 net_log_.EndEvent( 347 net_log_.EndEvent(
348 net::NetLog::TYPE_ENTRY_WRITE_DATA, 348 net::NetLog::TYPE_ENTRY_WRITE_DATA,
349 CreateNetLogReadWriteCompleteCallback(result)); 349 CreateNetLogReadWriteCompleteCallback(result));
350 } 350 }
351 return result; 351 return result;
352 } 352 }
353 353
354 int EntryImpl::ReadSparseDataImpl(int64 offset, IOBuffer* buf, int buf_len, 354 int EntryImpl::ReadSparseDataImpl(int64 offset, IOBuffer* buf, int buf_len,
355 const CompletionCallback& callback) { 355 const CompletionCallback& callback) {
356 DCHECK(node_.Data()->dirty || read_only_); 356 DCHECK(node_.Data()->dirty || read_only_);
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), 1545 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this),
1546 entry_.address().value(), node_.address().value()); 1546 entry_.address().value(), node_.address().value());
1547 1547
1548 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], 1548 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0],
1549 entry_.Data()->data_addr[1], entry_.Data()->long_key); 1549 entry_.Data()->data_addr[1], entry_.Data()->long_key);
1550 1550
1551 Trace(" doomed: %d 0x%x", doomed_, dirty); 1551 Trace(" doomed: %d 0x%x", doomed_, dirty);
1552 } 1552 }
1553 1553
1554 } // namespace disk_cache 1554 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/cert/x509_certificate_net_log_param.cc ('k') | net/disk_cache/blockfile/entry_impl_v3.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698