| 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_v3.h" | 5 #include "net/disk_cache/blockfile/entry_impl_v3.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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 if (net::OK != result) | 682 if (net::OK != result) |
| 683 return result; | 683 return result; |
| 684 | 684 |
| 685 return sparse_->GetAvailableRange(offset, len, start); | 685 return sparse_->GetAvailableRange(offset, len, start); |
| 686 } | 686 } |
| 687 | 687 |
| 688 bool EntryImplV3::CouldBeSparse() const { | 688 bool EntryImplV3::CouldBeSparse() const { |
| 689 if (sparse_.get()) | 689 if (sparse_.get()) |
| 690 return true; | 690 return true; |
| 691 | 691 |
| 692 scoped_ptr<SparseControl> sparse; | 692 std::unique_ptr<SparseControl> sparse; |
| 693 sparse.reset(new SparseControl(const_cast<EntryImpl*>(this))); | 693 sparse.reset(new SparseControl(const_cast<EntryImpl*>(this))); |
| 694 return sparse->CouldBeSparse(); | 694 return sparse->CouldBeSparse(); |
| 695 } | 695 } |
| 696 | 696 |
| 697 void EntryImplV3::CancelSparseIO() { | 697 void EntryImplV3::CancelSparseIO() { |
| 698 if (background_queue_) | 698 if (background_queue_) |
| 699 background_queue_->CancelSparseIO(this); | 699 background_queue_->CancelSparseIO(this); |
| 700 } | 700 } |
| 701 | 701 |
| 702 void EntryImplV3::CancelSparseIOImpl() { | 702 void EntryImplV3::CancelSparseIOImpl() { |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1319 unreported_size_[index] += new_size - old_size; | 1319 unreported_size_[index] += new_size - old_size; |
| 1320 entry_.Data()->data_size[index] = new_size; | 1320 entry_.Data()->data_size[index] = new_size; |
| 1321 entry_.set_modified(); | 1321 entry_.set_modified(); |
| 1322 } | 1322 } |
| 1323 | 1323 |
| 1324 int EntryImpl::InitSparseData() { | 1324 int EntryImpl::InitSparseData() { |
| 1325 if (sparse_.get()) | 1325 if (sparse_.get()) |
| 1326 return net::OK; | 1326 return net::OK; |
| 1327 | 1327 |
| 1328 // Use a local variable so that sparse_ never goes from 'valid' to NULL. | 1328 // Use a local variable so that sparse_ never goes from 'valid' to NULL. |
| 1329 scoped_ptr<SparseControl> sparse(new SparseControl(this)); | 1329 std::unique_ptr<SparseControl> sparse(new SparseControl(this)); |
| 1330 int result = sparse->Init(); | 1330 int result = sparse->Init(); |
| 1331 if (net::OK == result) | 1331 if (net::OK == result) |
| 1332 sparse_.swap(sparse); | 1332 sparse_.swap(sparse); |
| 1333 | 1333 |
| 1334 return result; | 1334 return result; |
| 1335 } | 1335 } |
| 1336 | 1336 |
| 1337 void EntryImpl::SetEntryFlags(uint32_t flags) { | 1337 void EntryImpl::SetEntryFlags(uint32_t flags) { |
| 1338 entry_.Data()->flags |= flags; | 1338 entry_.Data()->flags |= flags; |
| 1339 entry_.set_modified(); | 1339 entry_.set_modified(); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1474 | 1474 |
| 1475 int EntryImplV3::ReadyForSparseIO(const CompletionCallback& callback) { | 1475 int EntryImplV3::ReadyForSparseIO(const CompletionCallback& callback) { |
| 1476 return net::ERR_FAILED; | 1476 return net::ERR_FAILED; |
| 1477 } | 1477 } |
| 1478 | 1478 |
| 1479 EntryImplV3::~EntryImplV3() { | 1479 EntryImplV3::~EntryImplV3() { |
| 1480 NOTIMPLEMENTED(); | 1480 NOTIMPLEMENTED(); |
| 1481 } | 1481 } |
| 1482 | 1482 |
| 1483 } // namespace disk_cache | 1483 } // namespace disk_cache |
| OLD | NEW |