OLD | NEW |
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/entry_impl.h" | 5 #include "net/disk_cache/entry_impl.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.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" |
(...skipping 22 matching lines...) Expand all Loading... |
33 // |end_event_type| is the event type to log on completion. Logs nothing on | 33 // |end_event_type| is the event type to log on completion. Logs nothing on |
34 // discard, or when the NetLog is not set to log all events. | 34 // discard, or when the NetLog is not set to log all events. |
35 SyncCallback(disk_cache::EntryImpl* entry, net::IOBuffer* buffer, | 35 SyncCallback(disk_cache::EntryImpl* entry, net::IOBuffer* buffer, |
36 const net::CompletionCallback& callback, | 36 const net::CompletionCallback& callback, |
37 net::NetLog::EventType end_event_type) | 37 net::NetLog::EventType end_event_type) |
38 : entry_(entry), callback_(callback), buf_(buffer), | 38 : entry_(entry), callback_(callback), buf_(buffer), |
39 start_(TimeTicks::Now()), end_event_type_(end_event_type) { | 39 start_(TimeTicks::Now()), end_event_type_(end_event_type) { |
40 entry->AddRef(); | 40 entry->AddRef(); |
41 entry->IncrementIoCount(); | 41 entry->IncrementIoCount(); |
42 } | 42 } |
43 ~SyncCallback() {} | 43 virtual ~SyncCallback() {} |
44 | 44 |
45 virtual void OnFileIOComplete(int bytes_copied); | 45 virtual void OnFileIOComplete(int bytes_copied) OVERRIDE; |
46 void Discard(); | 46 void Discard(); |
47 | 47 |
48 private: | 48 private: |
49 disk_cache::EntryImpl* entry_; | 49 disk_cache::EntryImpl* entry_; |
50 net::CompletionCallback callback_; | 50 net::CompletionCallback callback_; |
51 scoped_refptr<net::IOBuffer> buf_; | 51 scoped_refptr<net::IOBuffer> buf_; |
52 TimeTicks start_; | 52 TimeTicks start_; |
53 const net::NetLog::EventType end_event_type_; | 53 const net::NetLog::EventType end_event_type_; |
54 | 54 |
55 DISALLOW_COPY_AND_ASSIGN(SyncCallback); | 55 DISALLOW_COPY_AND_ASSIGN(SyncCallback); |
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), | 1538 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), |
1539 entry_.address().value(), node_.address().value()); | 1539 entry_.address().value(), node_.address().value()); |
1540 | 1540 |
1541 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], | 1541 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], |
1542 entry_.Data()->data_addr[1], entry_.Data()->long_key); | 1542 entry_.Data()->data_addr[1], entry_.Data()->long_key); |
1543 | 1543 |
1544 Trace(" doomed: %d 0x%x", doomed_, dirty); | 1544 Trace(" doomed: %d 0x%x", doomed_, dirty); |
1545 } | 1545 } |
1546 | 1546 |
1547 } // namespace disk_cache | 1547 } // namespace disk_cache |
OLD | NEW |