| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/entry_impl.h" | 5 #include "net/disk_cache/entry_impl.h" |
| 6 | 6 |
| 7 #include "base/histogram.h" | 7 #include "base/histogram.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| 11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 38 ~SyncCallback() {} | 38 ~SyncCallback() {} |
| 39 | 39 |
| 40 virtual void OnFileIOComplete(int bytes_copied); | 40 virtual void OnFileIOComplete(int bytes_copied); |
| 41 void Discard(); | 41 void Discard(); |
| 42 private: | 42 private: |
| 43 disk_cache::EntryImpl* entry_; | 43 disk_cache::EntryImpl* entry_; |
| 44 net::CompletionCallback* callback_; | 44 net::CompletionCallback* callback_; |
| 45 scoped_refptr<net::IOBuffer> buf_; | 45 scoped_refptr<net::IOBuffer> buf_; |
| 46 TimeTicks start_; | 46 TimeTicks start_; |
| 47 | 47 |
| 48 DISALLOW_EVIL_CONSTRUCTORS(SyncCallback); | 48 DISALLOW_COPY_AND_ASSIGN(SyncCallback); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 void SyncCallback::OnFileIOComplete(int bytes_copied) { | 51 void SyncCallback::OnFileIOComplete(int bytes_copied) { |
| 52 entry_->DecrementIoCount(); | 52 entry_->DecrementIoCount(); |
| 53 if (callback_) { | 53 if (callback_) { |
| 54 entry_->ReportIOTime(disk_cache::EntryImpl::kAsyncIO, start_); | 54 entry_->ReportIOTime(disk_cache::EntryImpl::kAsyncIO, start_); |
| 55 callback_->Run(bytes_copied); | 55 callback_->Run(bytes_copied); |
| 56 } | 56 } |
| 57 entry_->Release(); | 57 entry_->Release(); |
| 58 delete this; | 58 delete this; |
| (...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), | 924 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), |
| 925 entry_.address().value(), node_.address().value()); | 925 entry_.address().value(), node_.address().value()); |
| 926 | 926 |
| 927 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], | 927 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], |
| 928 entry_.Data()->data_addr[1], entry_.Data()->long_key); | 928 entry_.Data()->data_addr[1], entry_.Data()->long_key); |
| 929 | 929 |
| 930 Trace(" doomed: %d 0x%x", doomed_, dirty); | 930 Trace(" doomed: %d 0x%x", doomed_, dirty); |
| 931 } | 931 } |
| 932 | 932 |
| 933 } // namespace disk_cache | 933 } // namespace disk_cache |
| OLD | NEW |