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

Side by Side Diff: net/disk_cache/entry_impl.cc

Issue 8794003: base::Bind: Convert disk_cache_based_ssl_host_info. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test fix. Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 17 matching lines...) Expand all
28 28
29 // This class implements FileIOCallback to buffer the callback from a file IO 29 // This class implements FileIOCallback to buffer the callback from a file IO
30 // operation from the actual net class. 30 // operation from the actual net class.
31 class SyncCallback: public disk_cache::FileIOCallback { 31 class SyncCallback: public disk_cache::FileIOCallback {
32 public: 32 public:
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 net::OldCompletionCallback* callback, 36 net::OldCompletionCallback* callback,
37 net::NetLog::EventType end_event_type) 37 net::NetLog::EventType end_event_type)
38 : entry_(entry), old_callback_(callback), buf_(buffer),
39 start_(TimeTicks::Now()), end_event_type_(end_event_type) {
40 entry->AddRef();
41 entry->IncrementIoCount();
42 }
43 SyncCallback(disk_cache::EntryImpl* entry, net::IOBuffer* buffer,
44 const net::CompletionCallback& callback,
45 net::NetLog::EventType end_event_type)
38 : entry_(entry), callback_(callback), buf_(buffer), 46 : entry_(entry), callback_(callback), buf_(buffer),
39 start_(TimeTicks::Now()), end_event_type_(end_event_type) { 47 start_(TimeTicks::Now()), end_event_type_(end_event_type) {
40 entry->AddRef(); 48 entry->AddRef();
41 entry->IncrementIoCount(); 49 entry->IncrementIoCount();
42 } 50 }
43 ~SyncCallback() {} 51 ~SyncCallback() {}
44 52
45 virtual void OnFileIOComplete(int bytes_copied); 53 virtual void OnFileIOComplete(int bytes_copied);
46 void Discard(); 54 void Discard();
47 55
48 private: 56 private:
49 disk_cache::EntryImpl* entry_; 57 disk_cache::EntryImpl* entry_;
50 net::OldCompletionCallback* callback_; 58 net::OldCompletionCallback* old_callback_;
59 net::CompletionCallback callback_;
51 scoped_refptr<net::IOBuffer> buf_; 60 scoped_refptr<net::IOBuffer> buf_;
52 TimeTicks start_; 61 TimeTicks start_;
53 const net::NetLog::EventType end_event_type_; 62 const net::NetLog::EventType end_event_type_;
54 63
55 DISALLOW_COPY_AND_ASSIGN(SyncCallback); 64 DISALLOW_COPY_AND_ASSIGN(SyncCallback);
56 }; 65 };
57 66
58 void SyncCallback::OnFileIOComplete(int bytes_copied) { 67 void SyncCallback::OnFileIOComplete(int bytes_copied) {
59 entry_->DecrementIoCount(); 68 entry_->DecrementIoCount();
60 if (callback_) { 69 if (old_callback_ || !callback_.is_null()) {
61 if (entry_->net_log().IsLoggingAllEvents()) { 70 if (entry_->net_log().IsLoggingAllEvents()) {
62 entry_->net_log().EndEvent( 71 entry_->net_log().EndEvent(
63 end_event_type_, 72 end_event_type_,
64 make_scoped_refptr( 73 make_scoped_refptr(
65 new disk_cache::ReadWriteCompleteParameters(bytes_copied))); 74 new disk_cache::ReadWriteCompleteParameters(bytes_copied)));
66 } 75 }
67 entry_->ReportIOTime(disk_cache::EntryImpl::kAsyncIO, start_); 76 entry_->ReportIOTime(disk_cache::EntryImpl::kAsyncIO, start_);
68 callback_->Run(bytes_copied); 77
78 if (old_callback_)
79 old_callback_->Run(bytes_copied);
80 else
81 callback_.Run(bytes_copied);
69 } 82 }
70 entry_->Release(); 83 entry_->Release();
71 delete this; 84 delete this;
72 } 85 }
73 86
74 void SyncCallback::Discard() { 87 void SyncCallback::Discard() {
75 callback_ = NULL; 88 old_callback_ = NULL;
89 callback_.Reset();
76 buf_ = NULL; 90 buf_ = NULL;
77 OnFileIOComplete(0); 91 OnFileIOComplete(0);
78 } 92 }
79 93
80 const int kMaxBufferSize = 1024 * 1024; // 1 MB. 94 const int kMaxBufferSize = 1024 * 1024; // 1 MB.
81 95
82 } // namespace 96 } // namespace
83 97
84 namespace disk_cache { 98 namespace disk_cache {
85 99
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 int result = InternalReadData(index, offset, buf, buf_len, callback); 334 int result = InternalReadData(index, offset, buf, buf_len, callback);
321 335
322 if (result != net::ERR_IO_PENDING && net_log_.IsLoggingAllEvents()) { 336 if (result != net::ERR_IO_PENDING && net_log_.IsLoggingAllEvents()) {
323 net_log_.EndEvent( 337 net_log_.EndEvent(
324 net::NetLog::TYPE_ENTRY_READ_DATA, 338 net::NetLog::TYPE_ENTRY_READ_DATA,
325 make_scoped_refptr(new ReadWriteCompleteParameters(result))); 339 make_scoped_refptr(new ReadWriteCompleteParameters(result)));
326 } 340 }
327 return result; 341 return result;
328 } 342 }
329 343
344 int EntryImpl::ReadDataImpl(
345 int index, int offset, net::IOBuffer* buf, int buf_len,
346 const net::CompletionCallback& callback) {
347 if (net_log_.IsLoggingAllEvents()) {
348 net_log_.BeginEvent(
349 net::NetLog::TYPE_ENTRY_READ_DATA,
350 make_scoped_refptr(
351 new ReadWriteDataParameters(index, offset, buf_len, false)));
352 }
353
354 int result = InternalReadData(index, offset, buf, buf_len, callback);
355
356 if (result != net::ERR_IO_PENDING && net_log_.IsLoggingAllEvents()) {
357 net_log_.EndEvent(
358 net::NetLog::TYPE_ENTRY_READ_DATA,
359 make_scoped_refptr(new ReadWriteCompleteParameters(result)));
360 }
361 return result;
362 }
363
330 int EntryImpl::WriteDataImpl(int index, int offset, net::IOBuffer* buf, 364 int EntryImpl::WriteDataImpl(int index, int offset, net::IOBuffer* buf,
331 int buf_len, OldCompletionCallback* callback, 365 int buf_len, OldCompletionCallback* callback,
332 bool truncate) { 366 bool truncate) {
333 if (net_log_.IsLoggingAllEvents()) { 367 if (net_log_.IsLoggingAllEvents()) {
334 net_log_.BeginEvent( 368 net_log_.BeginEvent(
335 net::NetLog::TYPE_ENTRY_WRITE_DATA, 369 net::NetLog::TYPE_ENTRY_WRITE_DATA,
336 make_scoped_refptr( 370 make_scoped_refptr(
337 new ReadWriteDataParameters(index, offset, buf_len, truncate))); 371 new ReadWriteDataParameters(index, offset, buf_len, truncate)));
338 } 372 }
339 373
340 int result = InternalWriteData(index, offset, buf, buf_len, callback, 374 int result = InternalWriteData(index, offset, buf, buf_len, callback,
341 truncate); 375 truncate);
342 376
343 if (result != net::ERR_IO_PENDING && net_log_.IsLoggingAllEvents()) { 377 if (result != net::ERR_IO_PENDING && net_log_.IsLoggingAllEvents()) {
344 net_log_.EndEvent( 378 net_log_.EndEvent(
345 net::NetLog::TYPE_ENTRY_WRITE_DATA, 379 net::NetLog::TYPE_ENTRY_WRITE_DATA,
346 make_scoped_refptr(new ReadWriteCompleteParameters(result))); 380 make_scoped_refptr(new ReadWriteCompleteParameters(result)));
347 } 381 }
348 return result; 382 return result;
349 } 383 }
350 384
385 int EntryImpl::WriteDataImpl(
386 int index, int offset, net::IOBuffer* buf, int buf_len,
387 const net::CompletionCallback& callback, bool truncate) {
388 if (net_log_.IsLoggingAllEvents()) {
389 net_log_.BeginEvent(
390 net::NetLog::TYPE_ENTRY_WRITE_DATA,
391 make_scoped_refptr(
392 new ReadWriteDataParameters(index, offset, buf_len, truncate)));
393 }
394
395 int result = InternalWriteData(index, offset, buf, buf_len, callback,
396 truncate);
397
398 if (result != net::ERR_IO_PENDING && net_log_.IsLoggingAllEvents()) {
399 net_log_.EndEvent(
400 net::NetLog::TYPE_ENTRY_WRITE_DATA,
401 make_scoped_refptr(new ReadWriteCompleteParameters(result)));
402 }
403 return result;
404 }
405
351 int EntryImpl::ReadSparseDataImpl(int64 offset, net::IOBuffer* buf, int buf_len, 406 int EntryImpl::ReadSparseDataImpl(int64 offset, net::IOBuffer* buf, int buf_len,
352 OldCompletionCallback* callback) { 407 OldCompletionCallback* callback) {
353 DCHECK(node_.Data()->dirty || read_only_); 408 DCHECK(node_.Data()->dirty || read_only_);
354 int result = InitSparseData(); 409 int result = InitSparseData();
355 if (net::OK != result) 410 if (net::OK != result)
356 return result; 411 return result;
357 412
358 TimeTicks start = TimeTicks::Now(); 413 TimeTicks start = TimeTicks::Now();
359 result = sparse_->StartIO(SparseControl::kReadOperation, offset, buf, buf_len, 414 result = sparse_->StartIO(SparseControl::kReadOperation, offset, buf, buf_len,
360 callback); 415 callback);
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 return 0; 866 return 0;
812 867
813 if (buf_len < 0) 868 if (buf_len < 0)
814 return net::ERR_INVALID_ARGUMENT; 869 return net::ERR_INVALID_ARGUMENT;
815 870
816 backend_->background_queue()->ReadData(this, index, offset, buf, buf_len, 871 backend_->background_queue()->ReadData(this, index, offset, buf, buf_len,
817 callback); 872 callback);
818 return net::ERR_IO_PENDING; 873 return net::ERR_IO_PENDING;
819 } 874 }
820 875
876 int EntryImpl::ReadData(int index, int offset, net::IOBuffer* buf, int buf_len,
877 const net::CompletionCallback& callback) {
878 if (callback.is_null())
879 return ReadDataImpl(index, offset, buf, buf_len, callback);
880
881 DCHECK(node_.Data()->dirty || read_only_);
882 if (index < 0 || index >= kNumStreams)
883 return net::ERR_INVALID_ARGUMENT;
884
885 int entry_size = entry_.Data()->data_size[index];
886 if (offset >= entry_size || offset < 0 || !buf_len)
887 return 0;
888
889 if (buf_len < 0)
890 return net::ERR_INVALID_ARGUMENT;
891
892 backend_->background_queue()->ReadData(this, index, offset, buf, buf_len,
893 callback);
894 return net::ERR_IO_PENDING;
895 }
896
821 int EntryImpl::WriteData(int index, int offset, net::IOBuffer* buf, int buf_len, 897 int EntryImpl::WriteData(int index, int offset, net::IOBuffer* buf, int buf_len,
822 OldCompletionCallback* callback, bool truncate) { 898 OldCompletionCallback* callback, bool truncate) {
823 if (!callback) 899 if (!callback)
824 return WriteDataImpl(index, offset, buf, buf_len, callback, truncate); 900 return WriteDataImpl(index, offset, buf, buf_len, callback, truncate);
825 901
826 DCHECK(node_.Data()->dirty || read_only_); 902 DCHECK(node_.Data()->dirty || read_only_);
827 if (index < 0 || index >= kNumStreams) 903 if (index < 0 || index >= kNumStreams)
828 return net::ERR_INVALID_ARGUMENT; 904 return net::ERR_INVALID_ARGUMENT;
829 905
830 if (offset < 0 || buf_len < 0) 906 if (offset < 0 || buf_len < 0)
831 return net::ERR_INVALID_ARGUMENT; 907 return net::ERR_INVALID_ARGUMENT;
832 908
833 backend_->background_queue()->WriteData(this, index, offset, buf, buf_len, 909 backend_->background_queue()->WriteData(this, index, offset, buf, buf_len,
834 truncate, callback); 910 truncate, callback);
835 return net::ERR_IO_PENDING; 911 return net::ERR_IO_PENDING;
836 } 912 }
837 913
914 int EntryImpl::WriteData(
915 int index, int offset, net::IOBuffer* buf, int buf_len,
916 const net::CompletionCallback& callback, bool truncate) {
917 if (callback.is_null())
918 return WriteDataImpl(index, offset, buf, buf_len, callback, truncate);
919
920 DCHECK(node_.Data()->dirty || read_only_);
921 if (index < 0 || index >= kNumStreams)
922 return net::ERR_INVALID_ARGUMENT;
923
924 if (offset < 0 || buf_len < 0)
925 return net::ERR_INVALID_ARGUMENT;
926
927 backend_->background_queue()->WriteData(this, index, offset, buf, buf_len,
928 truncate, callback);
929 return net::ERR_IO_PENDING;
930 }
931
838 int EntryImpl::ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len, 932 int EntryImpl::ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len,
839 net::OldCompletionCallback* callback) { 933 net::OldCompletionCallback* callback) {
840 if (!callback) 934 if (!callback)
841 return ReadSparseDataImpl(offset, buf, buf_len, callback); 935 return ReadSparseDataImpl(offset, buf, buf_len, callback);
842 936
843 backend_->background_queue()->ReadSparseData(this, offset, buf, buf_len, 937 backend_->background_queue()->ReadSparseData(this, offset, buf, buf_len,
844 callback); 938 callback);
845 return net::ERR_IO_PENDING; 939 return net::ERR_IO_PENDING;
846 } 940 }
847 941
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 if (io_callback && completed) 1100 if (io_callback && completed)
1007 io_callback->Discard(); 1101 io_callback->Discard();
1008 1102
1009 if (io_callback) 1103 if (io_callback)
1010 ReportIOTime(kReadAsync1, start_async); 1104 ReportIOTime(kReadAsync1, start_async);
1011 1105
1012 ReportIOTime(kRead, start); 1106 ReportIOTime(kRead, start);
1013 return (completed || !callback) ? buf_len : net::ERR_IO_PENDING; 1107 return (completed || !callback) ? buf_len : net::ERR_IO_PENDING;
1014 } 1108 }
1015 1109
1110 int EntryImpl::InternalReadData(
1111 int index, int offset, net::IOBuffer* buf, int buf_len,
1112 const net::CompletionCallback& callback) {
1113 DCHECK(node_.Data()->dirty || read_only_);
1114 DVLOG(2) << "Read from " << index << " at " << offset << " : " << buf_len;
1115 if (index < 0 || index >= kNumStreams)
1116 return net::ERR_INVALID_ARGUMENT;
1117
1118 int entry_size = entry_.Data()->data_size[index];
1119 if (offset >= entry_size || offset < 0 || !buf_len)
1120 return 0;
1121
1122 if (buf_len < 0)
1123 return net::ERR_INVALID_ARGUMENT;
1124
1125 TimeTicks start = TimeTicks::Now();
1126
1127 if (offset + buf_len > entry_size)
1128 buf_len = entry_size - offset;
1129
1130 UpdateRank(false);
1131
1132 backend_->OnEvent(Stats::READ_DATA);
1133 backend_->OnRead(buf_len);
1134
1135 Addr address(entry_.Data()->data_addr[index]);
1136 int eof = address.is_initialized() ? entry_size : 0;
1137 if (user_buffers_[index].get() &&
1138 user_buffers_[index]->PreRead(eof, offset, &buf_len)) {
1139 // Complete the operation locally.
1140 buf_len = user_buffers_[index]->Read(offset, buf, buf_len);
1141 ReportIOTime(kRead, start);
1142 return buf_len;
1143 }
1144
1145 address.set_value(entry_.Data()->data_addr[index]);
1146 DCHECK(address.is_initialized());
1147 if (!address.is_initialized())
1148 return net::ERR_FAILED;
1149
1150 File* file = GetBackingFile(address, index);
1151 if (!file)
1152 return net::ERR_FAILED;
1153
1154 size_t file_offset = offset;
1155 if (address.is_block_file()) {
1156 DCHECK_LE(offset + buf_len, kMaxBlockSize);
1157 file_offset += address.start_block() * address.BlockSize() +
1158 kBlockHeaderSize;
1159 }
1160
1161 SyncCallback* io_callback = NULL;
1162 if (!callback.is_null()) {
1163 io_callback = new SyncCallback(this, buf, callback,
1164 net::NetLog::TYPE_ENTRY_READ_DATA);
1165 }
1166
1167 TimeTicks start_async = TimeTicks::Now();
1168
1169 bool completed;
1170 if (!file->Read(buf->data(), buf_len, file_offset, io_callback, &completed)) {
1171 if (io_callback)
1172 io_callback->Discard();
1173 return net::ERR_FAILED;
1174 }
1175
1176 if (io_callback && completed)
1177 io_callback->Discard();
1178
1179 if (io_callback)
1180 ReportIOTime(kReadAsync1, start_async);
1181
1182 ReportIOTime(kRead, start);
1183 return (completed || callback.is_null()) ? buf_len : net::ERR_IO_PENDING;
1184 }
1185
1016 int EntryImpl::InternalWriteData(int index, int offset, net::IOBuffer* buf, 1186 int EntryImpl::InternalWriteData(int index, int offset, net::IOBuffer* buf,
1017 int buf_len, OldCompletionCallback* callback, 1187 int buf_len, OldCompletionCallback* callback,
1018 bool truncate) { 1188 bool truncate) {
1019 DCHECK(node_.Data()->dirty || read_only_); 1189 DCHECK(node_.Data()->dirty || read_only_);
1020 DVLOG(2) << "Write to " << index << " at " << offset << " : " << buf_len; 1190 DVLOG(2) << "Write to " << index << " at " << offset << " : " << buf_len;
1021 if (index < 0 || index >= kNumStreams) 1191 if (index < 0 || index >= kNumStreams)
1022 return net::ERR_INVALID_ARGUMENT; 1192 return net::ERR_INVALID_ARGUMENT;
1023 1193
1024 if (offset < 0 || buf_len < 0) 1194 if (offset < 0 || buf_len < 0)
1025 return net::ERR_INVALID_ARGUMENT; 1195 return net::ERR_INVALID_ARGUMENT;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 if (io_callback && completed) 1276 if (io_callback && completed)
1107 io_callback->Discard(); 1277 io_callback->Discard();
1108 1278
1109 if (io_callback) 1279 if (io_callback)
1110 ReportIOTime(kWriteAsync1, start_async); 1280 ReportIOTime(kWriteAsync1, start_async);
1111 1281
1112 ReportIOTime(kWrite, start); 1282 ReportIOTime(kWrite, start);
1113 return (completed || !callback) ? buf_len : net::ERR_IO_PENDING; 1283 return (completed || !callback) ? buf_len : net::ERR_IO_PENDING;
1114 } 1284 }
1115 1285
1286 int EntryImpl::InternalWriteData(
1287 int index, int offset, net::IOBuffer* buf, int buf_len,
1288 const net::CompletionCallback& callback, bool truncate) {
1289 DCHECK(node_.Data()->dirty || read_only_);
1290 DVLOG(2) << "Write to " << index << " at " << offset << " : " << buf_len;
1291 if (index < 0 || index >= kNumStreams)
1292 return net::ERR_INVALID_ARGUMENT;
1293
1294 if (offset < 0 || buf_len < 0)
1295 return net::ERR_INVALID_ARGUMENT;
1296
1297 int max_file_size = backend_->MaxFileSize();
1298
1299 // offset or buf_len could be negative numbers.
1300 if (offset > max_file_size || buf_len > max_file_size ||
1301 offset + buf_len > max_file_size) {
1302 int size = offset + buf_len;
1303 if (size <= max_file_size)
1304 size = kint32max;
1305 backend_->TooMuchStorageRequested(size);
1306 return net::ERR_FAILED;
1307 }
1308
1309 TimeTicks start = TimeTicks::Now();
1310
1311 // Read the size at this point (it may change inside prepare).
1312 int entry_size = entry_.Data()->data_size[index];
1313 bool extending = entry_size < offset + buf_len;
1314 truncate = truncate && entry_size > offset + buf_len;
1315 Trace("To PrepareTarget 0x%x", entry_.address().value());
1316 if (!PrepareTarget(index, offset, buf_len, truncate))
1317 return net::ERR_FAILED;
1318
1319 Trace("From PrepareTarget 0x%x", entry_.address().value());
1320 if (extending || truncate)
1321 UpdateSize(index, entry_size, offset + buf_len);
1322
1323 UpdateRank(true);
1324
1325 backend_->OnEvent(Stats::WRITE_DATA);
1326 backend_->OnWrite(buf_len);
1327
1328 if (user_buffers_[index].get()) {
1329 // Complete the operation locally.
1330 user_buffers_[index]->Write(offset, buf, buf_len);
1331 ReportIOTime(kWrite, start);
1332 return buf_len;
1333 }
1334
1335 Addr address(entry_.Data()->data_addr[index]);
1336 if (offset + buf_len == 0) {
1337 if (truncate) {
1338 DCHECK(!address.is_initialized());
1339 }
1340 return 0;
1341 }
1342
1343 File* file = GetBackingFile(address, index);
1344 if (!file)
1345 return net::ERR_FAILED;
1346
1347 size_t file_offset = offset;
1348 if (address.is_block_file()) {
1349 DCHECK_LE(offset + buf_len, kMaxBlockSize);
1350 file_offset += address.start_block() * address.BlockSize() +
1351 kBlockHeaderSize;
1352 } else if (truncate || (extending && !buf_len)) {
1353 if (!file->SetLength(offset + buf_len))
1354 return net::ERR_FAILED;
1355 }
1356
1357 if (!buf_len)
1358 return 0;
1359
1360 SyncCallback* io_callback = NULL;
1361 if (!callback.is_null()) {
1362 io_callback = new SyncCallback(this, buf, callback,
1363 net::NetLog::TYPE_ENTRY_WRITE_DATA);
1364 }
1365
1366 TimeTicks start_async = TimeTicks::Now();
1367
1368 bool completed;
1369 if (!file->Write(buf->data(), buf_len, file_offset, io_callback,
1370 &completed)) {
1371 if (io_callback)
1372 io_callback->Discard();
1373 return net::ERR_FAILED;
1374 }
1375
1376 if (io_callback && completed)
1377 io_callback->Discard();
1378
1379 if (io_callback)
1380 ReportIOTime(kWriteAsync1, start_async);
1381
1382 ReportIOTime(kWrite, start);
1383 return (completed || callback.is_null()) ? buf_len : net::ERR_IO_PENDING;
1384 }
1385
1116 // ------------------------------------------------------------------------ 1386 // ------------------------------------------------------------------------
1117 1387
1118 bool EntryImpl::CreateDataBlock(int index, int size) { 1388 bool EntryImpl::CreateDataBlock(int index, int size) {
1119 DCHECK(index >= 0 && index < kNumStreams); 1389 DCHECK(index >= 0 && index < kNumStreams);
1120 1390
1121 Addr address(entry_.Data()->data_addr[index]); 1391 Addr address(entry_.Data()->data_addr[index]);
1122 if (!CreateBlock(size, &address)) 1392 if (!CreateBlock(size, &address))
1123 return false; 1393 return false;
1124 1394
1125 entry_.Data()->data_addr[index] = address.value(); 1395 entry_.Data()->data_addr[index] = address.value();
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), 1759 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this),
1490 entry_.address().value(), node_.address().value()); 1760 entry_.address().value(), node_.address().value());
1491 1761
1492 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], 1762 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0],
1493 entry_.Data()->data_addr[1], entry_.Data()->long_key); 1763 entry_.Data()->data_addr[1], entry_.Data()->long_key);
1494 1764
1495 Trace(" doomed: %d 0x%x", doomed_, dirty); 1765 Trace(" doomed: %d 0x%x", doomed_, dirty);
1496 } 1766 }
1497 1767
1498 } // namespace disk_cache 1768 } // namespace disk_cache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698