OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/simple/simple_backend_impl.h" | 5 #include "net/disk_cache/simple/simple_backend_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstdlib> | 8 #include <cstdlib> |
9 #include <functional> | 9 #include <functional> |
10 | 10 |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
463 base::Bind(&SimpleBackendImpl::IndexReadyForDoom, AsWeakPtr(), | 463 base::Bind(&SimpleBackendImpl::IndexReadyForDoom, AsWeakPtr(), |
464 initial_time, end_time, callback)); | 464 initial_time, end_time, callback)); |
465 } | 465 } |
466 | 466 |
467 int SimpleBackendImpl::DoomEntriesSince( | 467 int SimpleBackendImpl::DoomEntriesSince( |
468 const Time initial_time, | 468 const Time initial_time, |
469 const CompletionCallback& callback) { | 469 const CompletionCallback& callback) { |
470 return DoomEntriesBetween(initial_time, Time(), callback); | 470 return DoomEntriesBetween(initial_time, Time(), callback); |
471 } | 471 } |
472 | 472 |
473 void SimpleBackendImpl::IndexReadyForCalculation( | |
gavinp
2015/10/13 15:50:12
Isn't this an ordering violation? See https://goog
msramek
2015/10/13 17:25:50
Yep. I tried to follow IndexReadyForDoom, but that
| |
474 const CompletionCallback& callback, | |
475 int result) { | |
476 if (result == net::OK) | |
477 result = static_cast<int>(index_->GetCacheSize()); | |
478 callback.Run(result); | |
479 } | |
480 | |
473 int SimpleBackendImpl::CalculateSizeOfAllEntries( | 481 int SimpleBackendImpl::CalculateSizeOfAllEntries( |
474 const CompletionCallback& callback) { | 482 const CompletionCallback& callback) { |
475 // TODO(msramek): Implement. | 483 return index_->ExecuteWhenReady( |
476 return net::ERR_NOT_IMPLEMENTED; | 484 base::Bind(&SimpleBackendImpl::IndexReadyForCalculation, |
485 AsWeakPtr(), | |
486 callback)); | |
gavinp
2015/10/13 15:50:12
Did git cl format not join these lines? Weird...
msramek
2015/10/13 17:25:50
Ehm, I didn't run it.
gavinp
2015/10/14 15:08:06
We're very diligent about that in net/. Generally
msramek
2015/10/14 16:11:58
Acknowledged.
| |
477 } | 487 } |
478 | 488 |
479 class SimpleBackendImpl::SimpleIterator final : public Iterator { | 489 class SimpleBackendImpl::SimpleIterator final : public Iterator { |
480 public: | 490 public: |
481 explicit SimpleIterator(base::WeakPtr<SimpleBackendImpl> backend) | 491 explicit SimpleIterator(base::WeakPtr<SimpleBackendImpl> backend) |
482 : backend_(backend), | 492 : backend_(backend), |
483 weak_factory_(this) { | 493 weak_factory_(this) { |
484 } | 494 } |
485 | 495 |
486 // From Backend::Iterator: | 496 // From Backend::Iterator: |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
739 } | 749 } |
740 | 750 |
741 // static | 751 // static |
742 void SimpleBackendImpl::FlushWorkerPoolForTesting() { | 752 void SimpleBackendImpl::FlushWorkerPoolForTesting() { |
743 // We only need to do this if we there is an active task runner. | 753 // We only need to do this if we there is an active task runner. |
744 if (base::ThreadTaskRunnerHandle::IsSet()) | 754 if (base::ThreadTaskRunnerHandle::IsSet()) |
745 g_sequenced_worker_pool.Get().FlushForTesting(); | 755 g_sequenced_worker_pool.Get().FlushForTesting(); |
746 } | 756 } |
747 | 757 |
748 } // namespace disk_cache | 758 } // namespace disk_cache |
OLD | NEW |