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/blockfile/entry_impl.h" | 5 #include "net/disk_cache/blockfile/entry_impl.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/hash.h" | 9 #include "base/hash.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 return net::ERR_UNEXPECTED; | 895 return net::ERR_UNEXPECTED; |
896 | 896 |
897 background_queue_->GetAvailableRange(this, offset, len, start, callback); | 897 background_queue_->GetAvailableRange(this, offset, len, start, callback); |
898 return net::ERR_IO_PENDING; | 898 return net::ERR_IO_PENDING; |
899 } | 899 } |
900 | 900 |
901 bool EntryImpl::CouldBeSparse() const { | 901 bool EntryImpl::CouldBeSparse() const { |
902 if (sparse_.get()) | 902 if (sparse_.get()) |
903 return true; | 903 return true; |
904 | 904 |
905 scoped_ptr<SparseControl> sparse; | 905 std::unique_ptr<SparseControl> sparse; |
906 sparse.reset(new SparseControl(const_cast<EntryImpl*>(this))); | 906 sparse.reset(new SparseControl(const_cast<EntryImpl*>(this))); |
907 return sparse->CouldBeSparse(); | 907 return sparse->CouldBeSparse(); |
908 } | 908 } |
909 | 909 |
910 void EntryImpl::CancelSparseIO() { | 910 void EntryImpl::CancelSparseIO() { |
911 if (background_queue_.get()) | 911 if (background_queue_.get()) |
912 background_queue_->CancelSparseIO(this); | 912 background_queue_->CancelSparseIO(this); |
913 } | 913 } |
914 | 914 |
915 int EntryImpl::ReadyForSparseIO(const CompletionCallback& callback) { | 915 int EntryImpl::ReadyForSparseIO(const CompletionCallback& callback) { |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1498 unreported_size_[index] += new_size - old_size; | 1498 unreported_size_[index] += new_size - old_size; |
1499 entry_.Data()->data_size[index] = new_size; | 1499 entry_.Data()->data_size[index] = new_size; |
1500 entry_.set_modified(); | 1500 entry_.set_modified(); |
1501 } | 1501 } |
1502 | 1502 |
1503 int EntryImpl::InitSparseData() { | 1503 int EntryImpl::InitSparseData() { |
1504 if (sparse_.get()) | 1504 if (sparse_.get()) |
1505 return net::OK; | 1505 return net::OK; |
1506 | 1506 |
1507 // Use a local variable so that sparse_ never goes from 'valid' to NULL. | 1507 // Use a local variable so that sparse_ never goes from 'valid' to NULL. |
1508 scoped_ptr<SparseControl> sparse(new SparseControl(this)); | 1508 std::unique_ptr<SparseControl> sparse(new SparseControl(this)); |
1509 int result = sparse->Init(); | 1509 int result = sparse->Init(); |
1510 if (net::OK == result) | 1510 if (net::OK == result) |
1511 sparse_.swap(sparse); | 1511 sparse_.swap(sparse); |
1512 | 1512 |
1513 return result; | 1513 return result; |
1514 } | 1514 } |
1515 | 1515 |
1516 void EntryImpl::SetEntryFlags(uint32_t flags) { | 1516 void EntryImpl::SetEntryFlags(uint32_t flags) { |
1517 entry_.Data()->flags |= flags; | 1517 entry_.Data()->flags |= flags; |
1518 entry_.set_modified(); | 1518 entry_.set_modified(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1558 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), | 1558 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), |
1559 entry_.address().value(), node_.address().value()); | 1559 entry_.address().value(), node_.address().value()); |
1560 | 1560 |
1561 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], | 1561 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], |
1562 entry_.Data()->data_addr[1], entry_.Data()->long_key); | 1562 entry_.Data()->data_addr[1], entry_.Data()->long_key); |
1563 | 1563 |
1564 Trace(" doomed: %d 0x%x", doomed_, dirty); | 1564 Trace(" doomed: %d 0x%x", doomed_, dirty); |
1565 } | 1565 } |
1566 | 1566 |
1567 } // namespace disk_cache | 1567 } // namespace disk_cache |
OLD | NEW |