Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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/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 "base/values.h" | |
| 10 #include "net/base/io_buffer.h" | 11 #include "net/base/io_buffer.h" |
| 11 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 12 #include "net/disk_cache/backend_impl.h" | 13 #include "net/disk_cache/backend_impl.h" |
| 13 #include "net/disk_cache/bitmap.h" | 14 #include "net/disk_cache/bitmap.h" |
| 14 #include "net/disk_cache/cache_util.h" | 15 #include "net/disk_cache/cache_util.h" |
| 15 #include "net/disk_cache/histogram_macros.h" | 16 #include "net/disk_cache/histogram_macros.h" |
| 16 #include "net/disk_cache/sparse_control.h" | 17 #include "net/disk_cache/sparse_control.h" |
| 17 | 18 |
| 18 using base::Time; | 19 using base::Time; |
| 19 using base::TimeDelta; | 20 using base::TimeDelta; |
| 20 using base::TimeTicks; | 21 using base::TimeTicks; |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 // Index for the file used to store the key, if any (files_[kKeyFileIndex]). | 25 // Index for the file used to store the key, if any (files_[kKeyFileIndex]). |
| 25 const int kKeyFileIndex = 3; | 26 const int kKeyFileIndex = 3; |
| 26 | 27 |
| 28 class EntryCreationParameters : public net::NetLog::EventParameters { | |
|
rvargas (doing something else)
2010/12/13 23:34:39
nit: Add a short description.
mmenke
2010/12/14 17:53:43
Done
| |
| 29 public: | |
| 30 EntryCreationParameters(const std::string& key, bool created) | |
| 31 : key_(key), created_(created) { | |
| 32 } | |
| 33 | |
| 34 Value* ToValue() const { | |
| 35 DictionaryValue *dict = new DictionaryValue(); | |
| 36 dict->SetString("key", key_); | |
| 37 dict->SetBoolean("created", created_); | |
| 38 return dict; | |
| 39 } | |
| 40 | |
| 41 private: | |
| 42 const std::string key_; | |
| 43 const bool created_; | |
| 44 }; | |
| 45 | |
| 46 class ReadWriteDataParams : public net::NetLog::EventParameters { | |
|
rvargas (doing something else)
2010/12/13 23:34:39
nit: same here.
mmenke
2010/12/14 17:53:43
Done
| |
| 47 public: | |
| 48 ReadWriteDataParams(int index, int offset, int buf_len, bool truncate) | |
| 49 : index_(index), offset_(offset), buf_len_(buf_len), truncate_(truncate) { | |
| 50 } | |
| 51 | |
| 52 Value* ToValue() const { | |
| 53 DictionaryValue* dict = new DictionaryValue(); | |
| 54 dict->SetInteger("index", index_); | |
| 55 dict->SetInteger("offset", offset_); | |
| 56 dict->SetInteger("buf_len", buf_len_); | |
| 57 if (truncate_) | |
| 58 dict->SetBoolean("truncate", truncate_); | |
| 59 return dict; | |
| 60 } | |
| 61 | |
| 62 private: | |
| 63 int index_; | |
| 64 int offset_; | |
| 65 int buf_len_; | |
| 66 bool truncate_; | |
| 67 }; | |
| 68 | |
| 27 // This class implements FileIOCallback to buffer the callback from a file IO | 69 // This class implements FileIOCallback to buffer the callback from a file IO |
| 28 // operation from the actual net class. | 70 // operation from the actual net class. |
| 29 class SyncCallback: public disk_cache::FileIOCallback { | 71 class SyncCallback: public disk_cache::FileIOCallback { |
| 30 public: | 72 public: |
| 73 // |end_event_type| is the event type to log on completion. Logs nothing on | |
| 74 // discard, or when the NetLog is not set to log all events. | |
| 31 SyncCallback(disk_cache::EntryImpl* entry, net::IOBuffer* buffer, | 75 SyncCallback(disk_cache::EntryImpl* entry, net::IOBuffer* buffer, |
| 32 net::CompletionCallback* callback ) | 76 net::CompletionCallback* callback, |
| 77 net::NetLog::EventType end_event_type) | |
| 33 : entry_(entry), callback_(callback), buf_(buffer), | 78 : entry_(entry), callback_(callback), buf_(buffer), |
| 34 start_(TimeTicks::Now()) { | 79 start_(TimeTicks::Now()), end_event_type_(end_event_type) { |
| 35 entry->AddRef(); | 80 entry->AddRef(); |
| 36 entry->IncrementIoCount(); | 81 entry->IncrementIoCount(); |
| 37 } | 82 } |
| 38 ~SyncCallback() {} | 83 ~SyncCallback() {} |
| 39 | 84 |
| 40 virtual void OnFileIOComplete(int bytes_copied); | 85 virtual void OnFileIOComplete(int bytes_copied); |
| 41 void Discard(); | 86 void Discard(); |
| 87 | |
| 42 private: | 88 private: |
| 43 disk_cache::EntryImpl* entry_; | 89 disk_cache::EntryImpl* entry_; |
| 44 net::CompletionCallback* callback_; | 90 net::CompletionCallback* callback_; |
| 45 scoped_refptr<net::IOBuffer> buf_; | 91 scoped_refptr<net::IOBuffer> buf_; |
| 46 TimeTicks start_; | 92 TimeTicks start_; |
| 93 net::NetLog::EventType end_event_type_; | |
| 47 | 94 |
| 48 DISALLOW_COPY_AND_ASSIGN(SyncCallback); | 95 DISALLOW_COPY_AND_ASSIGN(SyncCallback); |
| 49 }; | 96 }; |
| 50 | 97 |
| 51 void SyncCallback::OnFileIOComplete(int bytes_copied) { | 98 void SyncCallback::OnFileIOComplete(int bytes_copied) { |
| 99 if (entry_->net_log().IsLoggingAllEvents()) | |
|
rvargas (doing something else)
2010/12/13 23:34:39
This should be moved down, under the "if (callback
mmenke
2010/12/14 17:53:43
You're right. Done. Not sure there's any reason
| |
| 100 entry_->net_log().EndEventWithErrorCode(end_event_type_, bytes_copied); | |
| 101 | |
| 52 entry_->DecrementIoCount(); | 102 entry_->DecrementIoCount(); |
| 53 if (callback_) { | 103 if (callback_) { |
| 54 entry_->ReportIOTime(disk_cache::EntryImpl::kAsyncIO, start_); | 104 entry_->ReportIOTime(disk_cache::EntryImpl::kAsyncIO, start_); |
| 55 callback_->Run(bytes_copied); | 105 callback_->Run(bytes_copied); |
| 56 } | 106 } |
| 57 entry_->Release(); | 107 entry_->Release(); |
| 58 delete this; | 108 delete this; |
| 59 } | 109 } |
| 60 | 110 |
| 61 void SyncCallback::Discard() { | 111 void SyncCallback::Discard() { |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 // maybe for a child entry, so it is important to do it before deleting this | 351 // maybe for a child entry, so it is important to do it before deleting this |
| 302 // entry. | 352 // entry. |
| 303 sparse_.reset(); | 353 sparse_.reset(); |
| 304 | 354 |
| 305 // Remove this entry from the list of open entries. | 355 // Remove this entry from the list of open entries. |
| 306 backend_->OnEntryDestroyBegin(entry_.address()); | 356 backend_->OnEntryDestroyBegin(entry_.address()); |
| 307 | 357 |
| 308 if (doomed_) { | 358 if (doomed_) { |
| 309 DeleteEntryData(true); | 359 DeleteEntryData(true); |
| 310 } else { | 360 } else { |
| 361 net_log_.AddEvent(net::NetLog::TYPE_DISK_CACHE_CLOSE, NULL); | |
| 311 bool ret = true; | 362 bool ret = true; |
| 312 for (int index = 0; index < kNumStreams; index++) { | 363 for (int index = 0; index < kNumStreams; index++) { |
| 313 if (user_buffers_[index].get()) { | 364 if (user_buffers_[index].get()) { |
| 314 if (!(ret = Flush(index, 0))) | 365 if (!(ret = Flush(index, 0))) |
| 315 LOG(ERROR) << "Failed to save user data"; | 366 LOG(ERROR) << "Failed to save user data"; |
| 316 } | 367 } |
| 317 if (unreported_size_[index]) { | 368 if (unreported_size_[index]) { |
| 318 backend_->ModifyStorageSize( | 369 backend_->ModifyStorageSize( |
| 319 entry_.Data()->data_size[index] - unreported_size_[index], | 370 entry_.Data()->data_size[index] - unreported_size_[index], |
| 320 entry_.Data()->data_size[index]); | 371 entry_.Data()->data_size[index]); |
| 321 } | 372 } |
| 322 } | 373 } |
| 323 | 374 |
| 324 if (!ret) { | 375 if (!ret) { |
| 325 // There was a failure writing the actual data. Mark the entry as dirty. | 376 // There was a failure writing the actual data. Mark the entry as dirty. |
| 326 int current_id = backend_->GetCurrentEntryId(); | 377 int current_id = backend_->GetCurrentEntryId(); |
| 327 node_.Data()->dirty = current_id == 1 ? -1 : current_id - 1; | 378 node_.Data()->dirty = current_id == 1 ? -1 : current_id - 1; |
| 328 node_.Store(); | 379 node_.Store(); |
| 329 } else if (node_.HasData() && node_.Data()->dirty) { | 380 } else if (node_.HasData() && node_.Data()->dirty) { |
| 330 node_.Data()->dirty = 0; | 381 node_.Data()->dirty = 0; |
| 331 node_.Store(); | 382 node_.Store(); |
| 332 } | 383 } |
| 333 } | 384 } |
| 334 | 385 |
| 335 Trace("~EntryImpl out 0x%p", reinterpret_cast<void*>(this)); | 386 Trace("~EntryImpl out 0x%p", reinterpret_cast<void*>(this)); |
| 336 backend_->OnEntryDestroyEnd(); | 387 backend_->OnEntryDestroyEnd(); |
| 388 | |
| 389 net_log_.EndEvent(net::NetLog::TYPE_DISK_CACHE_ENTRY, NULL); | |
|
rvargas (doing something else)
2010/12/13 23:34:39
Please move this line before the call to OnEntryDe
mmenke
2010/12/14 17:53:43
Done
| |
| 337 } | 390 } |
| 338 | 391 |
| 339 void EntryImpl::Doom() { | 392 void EntryImpl::Doom() { |
| 340 backend_->background_queue()->DoomEntryImpl(this); | 393 backend_->background_queue()->DoomEntryImpl(this); |
| 341 } | 394 } |
| 342 | 395 |
| 343 void EntryImpl::Close() { | 396 void EntryImpl::Close() { |
| 344 backend_->background_queue()->CloseEntryImpl(this); | 397 backend_->background_queue()->CloseEntryImpl(this); |
| 345 } | 398 } |
| 346 | 399 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 474 backend_->background_queue()->ReadyForSparseIO(this, callback); | 527 backend_->background_queue()->ReadyForSparseIO(this, callback); |
| 475 return net::ERR_IO_PENDING; | 528 return net::ERR_IO_PENDING; |
| 476 } | 529 } |
| 477 | 530 |
| 478 // ------------------------------------------------------------------------ | 531 // ------------------------------------------------------------------------ |
| 479 | 532 |
| 480 void EntryImpl::DoomImpl() { | 533 void EntryImpl::DoomImpl() { |
| 481 if (doomed_) | 534 if (doomed_) |
| 482 return; | 535 return; |
| 483 | 536 |
| 537 net_log_.AddEvent(net::NetLog::TYPE_DISK_CACHE_DOOM, NULL); | |
|
rvargas (doing something else)
2010/12/13 23:34:39
Given the log at InternalDoom(), this one is not n
mmenke
2010/12/14 17:53:43
Done (Well, deleted this one. Accidentally was lo
| |
| 484 SetPointerForInvalidEntry(backend_->GetCurrentEntryId()); | 538 SetPointerForInvalidEntry(backend_->GetCurrentEntryId()); |
| 485 backend_->InternalDoomEntry(this); | 539 backend_->InternalDoomEntry(this); |
| 486 } | 540 } |
| 487 | 541 |
| 488 int EntryImpl::ReadDataImpl(int index, int offset, net::IOBuffer* buf, | 542 int EntryImpl::ReadDataImpl(int index, int offset, net::IOBuffer* buf, |
| 489 int buf_len, CompletionCallback* callback) { | 543 int buf_len, CompletionCallback* callback) { |
| 544 if (net_log_.IsLoggingAllEvents()) { | |
| 545 net_log_.BeginEvent( | |
| 546 net::NetLog::TYPE_DISK_CACHE_READ_DATA, | |
| 547 make_scoped_refptr( | |
| 548 new ReadWriteDataParams(index, offset, buf_len, false))); | |
| 549 } | |
| 550 | |
| 551 int result = InternalReadData(index, offset, buf, buf_len, callback); | |
| 552 | |
| 553 if (result != net::ERR_IO_PENDING && net_log_.IsLoggingAllEvents()) { | |
| 554 net_log_.EndEventWithErrorCode(net::NetLog::TYPE_DISK_CACHE_READ_DATA, | |
| 555 result); | |
| 556 } | |
| 557 return result; | |
| 558 } | |
| 559 | |
| 560 int EntryImpl::WriteDataImpl(int index, int offset, net::IOBuffer* buf, | |
| 561 int buf_len, CompletionCallback* callback, | |
| 562 bool truncate) { | |
| 563 if (net_log_.IsLoggingAllEvents()) { | |
| 564 net_log_.BeginEvent( | |
| 565 net::NetLog::TYPE_DISK_CACHE_WRITE_DATA, | |
| 566 make_scoped_refptr( | |
| 567 new ReadWriteDataParams(index, offset, buf_len, truncate))); | |
| 568 } | |
| 569 | |
| 570 int result = InternalWriteData(index, offset, buf, buf_len, callback, | |
| 571 truncate); | |
| 572 | |
| 573 if (result != net::ERR_IO_PENDING && net_log_.IsLoggingAllEvents()) { | |
| 574 net_log_.EndEventWithErrorCode(net::NetLog::TYPE_DISK_CACHE_WRITE_DATA, | |
| 575 result); | |
| 576 } | |
| 577 return result; | |
| 578 } | |
| 579 | |
| 580 int EntryImpl::InternalReadData(int index, int offset, net::IOBuffer* buf, | |
| 581 int buf_len, CompletionCallback* callback) { | |
| 490 DCHECK(node_.Data()->dirty || read_only_); | 582 DCHECK(node_.Data()->dirty || read_only_); |
| 491 DVLOG(2) << "Read from " << index << " at " << offset << " : " << buf_len; | 583 DVLOG(2) << "Read from " << index << " at " << offset << " : " << buf_len; |
| 492 if (index < 0 || index >= kNumStreams) | 584 if (index < 0 || index >= kNumStreams) |
| 493 return net::ERR_INVALID_ARGUMENT; | 585 return net::ERR_INVALID_ARGUMENT; |
| 494 | 586 |
| 495 int entry_size = entry_.Data()->data_size[index]; | 587 int entry_size = entry_.Data()->data_size[index]; |
| 496 if (offset >= entry_size || offset < 0 || !buf_len) | 588 if (offset >= entry_size || offset < 0 || !buf_len) |
| 497 return 0; | 589 return 0; |
| 498 | 590 |
| 499 if (buf_len < 0) | 591 if (buf_len < 0) |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 529 return net::ERR_FAILED; | 621 return net::ERR_FAILED; |
| 530 | 622 |
| 531 size_t file_offset = offset; | 623 size_t file_offset = offset; |
| 532 if (address.is_block_file()) { | 624 if (address.is_block_file()) { |
| 533 DCHECK_LE(offset + buf_len, kMaxBlockSize); | 625 DCHECK_LE(offset + buf_len, kMaxBlockSize); |
| 534 file_offset += address.start_block() * address.BlockSize() + | 626 file_offset += address.start_block() * address.BlockSize() + |
| 535 kBlockHeaderSize; | 627 kBlockHeaderSize; |
| 536 } | 628 } |
| 537 | 629 |
| 538 SyncCallback* io_callback = NULL; | 630 SyncCallback* io_callback = NULL; |
| 539 if (callback) | 631 if (callback) { |
| 540 io_callback = new SyncCallback(this, buf, callback); | 632 io_callback = new SyncCallback(this, buf, callback, |
| 633 net::NetLog::TYPE_DISK_CACHE_READ_DATA); | |
| 634 } | |
| 541 | 635 |
| 542 bool completed; | 636 bool completed; |
| 543 if (!file->Read(buf->data(), buf_len, file_offset, io_callback, &completed)) { | 637 if (!file->Read(buf->data(), buf_len, file_offset, io_callback, &completed)) { |
| 544 if (io_callback) | 638 if (io_callback) |
| 545 io_callback->Discard(); | 639 io_callback->Discard(); |
| 546 return net::ERR_FAILED; | 640 return net::ERR_FAILED; |
| 547 } | 641 } |
| 548 | 642 |
| 549 if (io_callback && completed) | 643 if (io_callback && completed) |
| 550 io_callback->Discard(); | 644 io_callback->Discard(); |
| 551 | 645 |
| 552 ReportIOTime(kRead, start); | 646 ReportIOTime(kRead, start); |
| 553 return (completed || !callback) ? buf_len : net::ERR_IO_PENDING; | 647 return (completed || !callback) ? buf_len : net::ERR_IO_PENDING; |
| 554 } | 648 } |
| 555 | 649 |
| 556 int EntryImpl::WriteDataImpl(int index, int offset, net::IOBuffer* buf, | 650 int EntryImpl::InternalWriteData(int index, int offset, net::IOBuffer* buf, |
| 557 int buf_len, CompletionCallback* callback, | 651 int buf_len, CompletionCallback* callback, |
| 558 bool truncate) { | 652 bool truncate) { |
| 559 DCHECK(node_.Data()->dirty || read_only_); | 653 DCHECK(node_.Data()->dirty || read_only_); |
| 560 DVLOG(2) << "Write to " << index << " at " << offset << " : " << buf_len; | 654 DVLOG(2) << "Write to " << index << " at " << offset << " : " << buf_len; |
| 561 if (index < 0 || index >= kNumStreams) | 655 if (index < 0 || index >= kNumStreams) |
| 562 return net::ERR_INVALID_ARGUMENT; | 656 return net::ERR_INVALID_ARGUMENT; |
| 563 | 657 |
| 564 if (offset < 0 || buf_len < 0) | 658 if (offset < 0 || buf_len < 0) |
| 565 return net::ERR_INVALID_ARGUMENT; | 659 return net::ERR_INVALID_ARGUMENT; |
| 566 | 660 |
| 567 int max_file_size = backend_->MaxFileSize(); | 661 int max_file_size = backend_->MaxFileSize(); |
| 568 | 662 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 621 kBlockHeaderSize; | 715 kBlockHeaderSize; |
| 622 } else if (truncate || (extending && !buf_len)) { | 716 } else if (truncate || (extending && !buf_len)) { |
| 623 if (!file->SetLength(offset + buf_len)) | 717 if (!file->SetLength(offset + buf_len)) |
| 624 return net::ERR_FAILED; | 718 return net::ERR_FAILED; |
| 625 } | 719 } |
| 626 | 720 |
| 627 if (!buf_len) | 721 if (!buf_len) |
| 628 return 0; | 722 return 0; |
| 629 | 723 |
| 630 SyncCallback* io_callback = NULL; | 724 SyncCallback* io_callback = NULL; |
| 631 if (callback) | 725 if (callback) { |
| 632 io_callback = new SyncCallback(this, buf, callback); | 726 io_callback = new SyncCallback(this, buf, callback, |
| 727 net::NetLog::TYPE_DISK_CACHE_WRITE_DATA); | |
| 728 } | |
| 633 | 729 |
| 634 bool completed; | 730 bool completed; |
| 635 if (!file->Write(buf->data(), buf_len, file_offset, io_callback, | 731 if (!file->Write(buf->data(), buf_len, file_offset, io_callback, |
| 636 &completed)) { | 732 &completed)) { |
| 637 if (io_callback) | 733 if (io_callback) |
| 638 io_callback->Discard(); | 734 io_callback->Discard(); |
| 639 return net::ERR_FAILED; | 735 return net::ERR_FAILED; |
| 640 } | 736 } |
| 641 | 737 |
| 642 if (io_callback && completed) | 738 if (io_callback && completed) |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 750 bool EntryImpl::IsSameEntry(const std::string& key, uint32 hash) { | 846 bool EntryImpl::IsSameEntry(const std::string& key, uint32 hash) { |
| 751 if (entry_.Data()->hash != hash || | 847 if (entry_.Data()->hash != hash || |
| 752 static_cast<size_t>(entry_.Data()->key_len) != key.size()) | 848 static_cast<size_t>(entry_.Data()->key_len) != key.size()) |
| 753 return false; | 849 return false; |
| 754 | 850 |
| 755 std::string my_key = GetKey(); | 851 std::string my_key = GetKey(); |
| 756 return key.compare(my_key) ? false : true; | 852 return key.compare(my_key) ? false : true; |
| 757 } | 853 } |
| 758 | 854 |
| 759 void EntryImpl::InternalDoom() { | 855 void EntryImpl::InternalDoom() { |
| 856 net_log_.AddEvent(net::NetLog::TYPE_DISK_CACHE_DOOM, NULL); | |
| 760 DCHECK(node_.HasData()); | 857 DCHECK(node_.HasData()); |
| 761 if (!node_.Data()->dirty) { | 858 if (!node_.Data()->dirty) { |
| 762 node_.Data()->dirty = backend_->GetCurrentEntryId(); | 859 node_.Data()->dirty = backend_->GetCurrentEntryId(); |
| 763 node_.Store(); | 860 node_.Store(); |
| 764 } | 861 } |
| 765 doomed_ = true; | 862 doomed_ = true; |
| 766 } | 863 } |
| 767 | 864 |
| 768 void EntryImpl::DeleteEntryData(bool everything) { | 865 void EntryImpl::DeleteEntryData(bool everything) { |
| 769 DCHECK(doomed_ || !everything); | 866 DCHECK(doomed_ || !everything); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 907 CACHE_UMA(AGE_MS, "SparseWriteTime", 0, start); | 1004 CACHE_UMA(AGE_MS, "SparseWriteTime", 0, start); |
| 908 break; | 1005 break; |
| 909 case kAsyncIO: | 1006 case kAsyncIO: |
| 910 CACHE_UMA(AGE_MS, "AsyncIOTime", group, start); | 1007 CACHE_UMA(AGE_MS, "AsyncIOTime", group, start); |
| 911 break; | 1008 break; |
| 912 default: | 1009 default: |
| 913 NOTREACHED(); | 1010 NOTREACHED(); |
| 914 } | 1011 } |
| 915 } | 1012 } |
| 916 | 1013 |
| 1014 void EntryImpl::BeginLogging(net::NetLog* net_log, bool created) { | |
| 1015 DCHECK(!net_log_.net_log()); | |
| 1016 net_log_ = net::BoundNetLog::Make( | |
| 1017 net_log, net::NetLog::SOURCE_DISK_CACHE_ENTRY); | |
| 1018 net_log_.BeginEvent( | |
| 1019 net::NetLog::TYPE_DISK_CACHE_ENTRY, | |
| 1020 make_scoped_refptr(new EntryCreationParameters(GetKey(), created))); | |
| 1021 } | |
| 1022 | |
| 1023 const net::BoundNetLog& EntryImpl::net_log() const { | |
| 1024 return net_log_; | |
| 1025 } | |
| 1026 | |
| 917 // ------------------------------------------------------------------------ | 1027 // ------------------------------------------------------------------------ |
| 918 | 1028 |
| 919 bool EntryImpl::CreateDataBlock(int index, int size) { | 1029 bool EntryImpl::CreateDataBlock(int index, int size) { |
| 920 DCHECK(index >= 0 && index < kNumStreams); | 1030 DCHECK(index >= 0 && index < kNumStreams); |
| 921 | 1031 |
| 922 Addr address(entry_.Data()->data_addr[index]); | 1032 Addr address(entry_.Data()->data_addr[index]); |
| 923 if (!CreateBlock(size, &address)) | 1033 if (!CreateBlock(size, &address)) |
| 924 return false; | 1034 return false; |
| 925 | 1035 |
| 926 entry_.Data()->data_addr[index] = address.value(); | 1036 entry_.Data()->data_addr[index] = address.value(); |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1290 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), | 1400 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), |
| 1291 entry_.address().value(), node_.address().value()); | 1401 entry_.address().value(), node_.address().value()); |
| 1292 | 1402 |
| 1293 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], | 1403 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], |
| 1294 entry_.Data()->data_addr[1], entry_.Data()->long_key); | 1404 entry_.Data()->data_addr[1], entry_.Data()->long_key); |
| 1295 | 1405 |
| 1296 Trace(" doomed: %d 0x%x", doomed_, dirty); | 1406 Trace(" doomed: %d 0x%x", doomed_, dirty); |
| 1297 } | 1407 } |
| 1298 | 1408 |
| 1299 } // namespace disk_cache | 1409 } // namespace disk_cache |
| OLD | NEW |