OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/offline_pages/offline_page_model_impl.h" | 5 #include "components/offline_pages/offline_page_model_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 | 370 |
371 void OfflinePageModelImpl::MarkPageAccessed(int64_t offline_id) { | 371 void OfflinePageModelImpl::MarkPageAccessed(int64_t offline_id) { |
372 RunWhenLoaded(base::Bind(&OfflinePageModelImpl::MarkPageAccessedWhenLoadDone, | 372 RunWhenLoaded(base::Bind(&OfflinePageModelImpl::MarkPageAccessedWhenLoadDone, |
373 weak_ptr_factory_.GetWeakPtr(), offline_id)); | 373 weak_ptr_factory_.GetWeakPtr(), offline_id)); |
374 } | 374 } |
375 | 375 |
376 void OfflinePageModelImpl::MarkPageAccessedWhenLoadDone(int64_t offline_id) { | 376 void OfflinePageModelImpl::MarkPageAccessedWhenLoadDone(int64_t offline_id) { |
377 DCHECK(is_loaded_); | 377 DCHECK(is_loaded_); |
378 | 378 |
379 auto iter = offline_pages_.find(offline_id); | 379 auto iter = offline_pages_.find(offline_id); |
380 if (iter == offline_pages_.end() || iter->second.IsExpired()) | 380 if (iter == offline_pages_.end()) |
381 return; | 381 return; |
382 | 382 |
383 // Make a copy of the cached item and update it. The cached item should only | 383 // Make a copy of the cached item and update it. The cached item should only |
384 // be updated upon the successful store operation. | 384 // be updated upon the successful store operation. |
385 OfflinePageItem offline_page_item = iter->second; | 385 OfflinePageItem offline_page_item = iter->second; |
386 | 386 |
387 ReportPageHistogramsAfterAccess(offline_page_item, GetCurrentTime()); | 387 ReportPageHistogramsAfterAccess(offline_page_item, GetCurrentTime()); |
388 | 388 |
389 offline_page_item.last_access_time = GetCurrentTime(); | 389 offline_page_item.last_access_time = GetCurrentTime(); |
390 offline_page_item.access_count++; | 390 offline_page_item.access_count++; |
(...skipping 13 matching lines...) Expand all Loading... |
404 } | 404 } |
405 | 405 |
406 void OfflinePageModelImpl::DoDeletePagesByOfflineId( | 406 void OfflinePageModelImpl::DoDeletePagesByOfflineId( |
407 const std::vector<int64_t>& offline_ids, | 407 const std::vector<int64_t>& offline_ids, |
408 const DeletePageCallback& callback) { | 408 const DeletePageCallback& callback) { |
409 DCHECK(is_loaded_); | 409 DCHECK(is_loaded_); |
410 | 410 |
411 std::vector<base::FilePath> paths_to_delete; | 411 std::vector<base::FilePath> paths_to_delete; |
412 for (const auto& offline_id : offline_ids) { | 412 for (const auto& offline_id : offline_ids) { |
413 auto iter = offline_pages_.find(offline_id); | 413 auto iter = offline_pages_.find(offline_id); |
414 if (iter != offline_pages_.end() && !iter->second.IsExpired()) { | 414 if (iter != offline_pages_.end()) { |
415 paths_to_delete.push_back(iter->second.file_path); | 415 paths_to_delete.push_back(iter->second.file_path); |
416 } | 416 } |
417 } | 417 } |
418 | 418 |
419 // If there're no pages to delete, return early. | 419 // If there're no pages to delete, return early. |
420 if (paths_to_delete.empty()) { | 420 if (paths_to_delete.empty()) { |
421 InformDeletePageDone(callback, DeletePageResult::SUCCESS); | 421 InformDeletePageDone(callback, DeletePageResult::SUCCESS); |
422 return; | 422 return; |
423 } | 423 } |
424 | 424 |
425 archive_manager_->DeleteMultipleArchives( | 425 archive_manager_->DeleteMultipleArchives( |
426 paths_to_delete, | 426 paths_to_delete, |
427 base::Bind(&OfflinePageModelImpl::OnDeleteArchiveFilesDone, | 427 base::Bind(&OfflinePageModelImpl::OnDeleteArchiveFilesDone, |
428 weak_ptr_factory_.GetWeakPtr(), offline_ids, callback)); | 428 weak_ptr_factory_.GetWeakPtr(), offline_ids, callback)); |
429 } | 429 } |
430 | 430 |
431 void OfflinePageModelImpl::DeletePagesByClientIds( | 431 void OfflinePageModelImpl::DeletePagesByClientIds( |
432 const std::vector<ClientId>& client_ids, | 432 const std::vector<ClientId>& client_ids, |
433 const DeletePageCallback& callback) { | 433 const DeletePageCallback& callback) { |
434 OfflinePageModelQueryBuilder builder; | 434 OfflinePageModelQueryBuilder builder; |
435 builder | 435 builder.SetClientIds(OfflinePageModelQuery::Requirement::INCLUDE_MATCHING, |
436 .SetClientIds(OfflinePageModelQuery::Requirement::INCLUDE_MATCHING, | 436 client_ids); |
437 client_ids) | |
438 .AllowExpiredPages(true); | |
439 auto delete_pages = base::Bind(&OfflinePageModelImpl::DeletePages, | 437 auto delete_pages = base::Bind(&OfflinePageModelImpl::DeletePages, |
440 weak_ptr_factory_.GetWeakPtr(), callback); | 438 weak_ptr_factory_.GetWeakPtr(), callback); |
441 RunWhenLoaded(base::Bind(&OfflinePageModelImpl::GetPagesMatchingQuery, | 439 RunWhenLoaded(base::Bind(&OfflinePageModelImpl::GetPagesMatchingQuery, |
442 weak_ptr_factory_.GetWeakPtr(), | 440 weak_ptr_factory_.GetWeakPtr(), |
443 base::Passed(builder.Build(GetPolicyController())), | 441 base::Passed(builder.Build(GetPolicyController())), |
444 delete_pages)); | 442 delete_pages)); |
445 } | 443 } |
446 | 444 |
447 void OfflinePageModelImpl::DeletePages( | 445 void OfflinePageModelImpl::DeletePages( |
448 const DeletePageCallback& callback, | 446 const DeletePageCallback& callback, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 | 530 |
533 void OfflinePageModelImpl::GetAllPages( | 531 void OfflinePageModelImpl::GetAllPages( |
534 const MultipleOfflinePageItemCallback& callback) { | 532 const MultipleOfflinePageItemCallback& callback) { |
535 OfflinePageModelQueryBuilder builder; | 533 OfflinePageModelQueryBuilder builder; |
536 RunWhenLoaded(base::Bind(&OfflinePageModelImpl::GetPagesMatchingQuery, | 534 RunWhenLoaded(base::Bind(&OfflinePageModelImpl::GetPagesMatchingQuery, |
537 weak_ptr_factory_.GetWeakPtr(), | 535 weak_ptr_factory_.GetWeakPtr(), |
538 base::Passed(builder.Build(GetPolicyController())), | 536 base::Passed(builder.Build(GetPolicyController())), |
539 callback)); | 537 callback)); |
540 } | 538 } |
541 | 539 |
542 void OfflinePageModelImpl::GetAllPagesWithExpired( | |
543 const MultipleOfflinePageItemCallback& callback) { | |
544 OfflinePageModelQueryBuilder builder; | |
545 builder.AllowExpiredPages(true); | |
546 | |
547 RunWhenLoaded(base::Bind(&OfflinePageModelImpl::GetPagesMatchingQuery, | |
548 weak_ptr_factory_.GetWeakPtr(), | |
549 base::Passed(builder.Build(GetPolicyController())), | |
550 callback)); | |
551 } | |
552 | |
553 void OfflinePageModelImpl::GetOfflineIdsForClientId( | 540 void OfflinePageModelImpl::GetOfflineIdsForClientId( |
554 const ClientId& client_id, | 541 const ClientId& client_id, |
555 const MultipleOfflineIdCallback& callback) { | 542 const MultipleOfflineIdCallback& callback) { |
556 RunWhenLoaded( | 543 RunWhenLoaded( |
557 base::Bind(&OfflinePageModelImpl::GetOfflineIdsForClientIdWhenLoadDone, | 544 base::Bind(&OfflinePageModelImpl::GetOfflineIdsForClientIdWhenLoadDone, |
558 weak_ptr_factory_.GetWeakPtr(), client_id, callback)); | 545 weak_ptr_factory_.GetWeakPtr(), client_id, callback)); |
559 } | 546 } |
560 | 547 |
561 void OfflinePageModelImpl::GetOfflineIdsForClientIdWhenLoadDone( | 548 void OfflinePageModelImpl::GetOfflineIdsForClientIdWhenLoadDone( |
562 const ClientId& client_id, | 549 const ClientId& client_id, |
563 const MultipleOfflineIdCallback& callback) const { | 550 const MultipleOfflineIdCallback& callback) const { |
564 callback.Run(MaybeGetOfflineIdsForClientId(client_id)); | 551 callback.Run(MaybeGetOfflineIdsForClientId(client_id)); |
565 } | 552 } |
566 | 553 |
567 const std::vector<int64_t> OfflinePageModelImpl::MaybeGetOfflineIdsForClientId( | 554 const std::vector<int64_t> OfflinePageModelImpl::MaybeGetOfflineIdsForClientId( |
568 const ClientId& client_id) const { | 555 const ClientId& client_id) const { |
569 DCHECK(is_loaded_); | 556 DCHECK(is_loaded_); |
570 std::vector<int64_t> results; | 557 std::vector<int64_t> results; |
571 | 558 |
572 // We want only all pages, including those marked for deletion. | 559 // We want only all pages, including those marked for deletion. |
573 // TODO(fgorski): actually use an index rather than linear scan. | 560 // TODO(fgorski): actually use an index rather than linear scan. |
574 for (const auto& id_page_pair : offline_pages_) { | 561 for (const auto& id_page_pair : offline_pages_) { |
575 if (id_page_pair.second.client_id == client_id && | 562 if (id_page_pair.second.client_id == client_id) { |
576 !id_page_pair.second.IsExpired()) { | |
577 results.push_back(id_page_pair.second.offline_id); | 563 results.push_back(id_page_pair.second.offline_id); |
578 } | 564 } |
579 } | 565 } |
580 return results; | 566 return results; |
581 } | 567 } |
582 | 568 |
583 void OfflinePageModelImpl::GetPageByOfflineId( | 569 void OfflinePageModelImpl::GetPageByOfflineId( |
584 int64_t offline_id, | 570 int64_t offline_id, |
585 const SingleOfflinePageItemCallback& callback) { | 571 const SingleOfflinePageItemCallback& callback) { |
586 std::vector<int64_t> query_ids; | 572 std::vector<int64_t> query_ids; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 const MultipleOfflinePageItemCallback& callback) const { | 607 const MultipleOfflinePageItemCallback& callback) const { |
622 std::vector<OfflinePageItem> result; | 608 std::vector<OfflinePageItem> result; |
623 | 609 |
624 GURL::Replacements remove_params; | 610 GURL::Replacements remove_params; |
625 remove_params.ClearRef(); | 611 remove_params.ClearRef(); |
626 | 612 |
627 GURL online_url_without_fragment = | 613 GURL online_url_without_fragment = |
628 online_url.ReplaceComponents(remove_params); | 614 online_url.ReplaceComponents(remove_params); |
629 | 615 |
630 for (const auto& id_page_pair : offline_pages_) { | 616 for (const auto& id_page_pair : offline_pages_) { |
631 if (id_page_pair.second.IsExpired()) | |
632 continue; | |
633 if (online_url == id_page_pair.second.url) { | 617 if (online_url == id_page_pair.second.url) { |
634 result.push_back(id_page_pair.second); | 618 result.push_back(id_page_pair.second); |
635 continue; | 619 continue; |
636 } | 620 } |
637 // If the full URL does not match, try with the fragment identifier | 621 // If the full URL does not match, try with the fragment identifier |
638 // stripped. | 622 // stripped. |
639 if (online_url_without_fragment == | 623 if (online_url_without_fragment == |
640 id_page_pair.second.url.ReplaceComponents(remove_params)) { | 624 id_page_pair.second.url.ReplaceComponents(remove_params)) { |
641 result.push_back(id_page_pair.second); | 625 result.push_back(id_page_pair.second); |
642 } | 626 } |
643 } | 627 } |
644 | 628 |
645 callback.Run(result); | 629 callback.Run(result); |
646 } | 630 } |
647 | 631 |
648 void OfflinePageModelImpl::CheckMetadataConsistency() { | 632 void OfflinePageModelImpl::CheckMetadataConsistency() { |
649 DCHECK(is_loaded_); | 633 DCHECK(is_loaded_); |
650 archive_manager_->GetAllArchives( | 634 archive_manager_->GetAllArchives( |
651 base::Bind(&OfflinePageModelImpl::CheckMetadataConsistencyForArchivePaths, | 635 base::Bind(&OfflinePageModelImpl::CheckMetadataConsistencyForArchivePaths, |
652 weak_ptr_factory_.GetWeakPtr())); | 636 weak_ptr_factory_.GetWeakPtr())); |
653 } | 637 } |
654 | 638 |
655 void OfflinePageModelImpl::ExpirePages( | |
656 const std::vector<int64_t>& offline_ids, | |
657 const base::Time& expiration_time, | |
658 const base::Callback<void(bool)>& callback) { | |
659 std::vector<base::FilePath> paths_to_delete; | |
660 std::vector<OfflinePageItem> items_to_update; | |
661 for (int64_t offline_id : offline_ids) { | |
662 auto iter = offline_pages_.find(offline_id); | |
663 if (iter == offline_pages_.end()) | |
664 continue; | |
665 | |
666 OfflinePageItem offline_page = iter->second; | |
667 paths_to_delete.push_back(offline_page.file_path); | |
668 offline_page.expiration_time = expiration_time; | |
669 | |
670 items_to_update.push_back(offline_page); | |
671 } | |
672 | |
673 store_->UpdateOfflinePages( | |
674 items_to_update, | |
675 base::Bind(&OfflinePageModelImpl::OnExpirePageDone, | |
676 weak_ptr_factory_.GetWeakPtr(), expiration_time)); | |
677 | |
678 if (paths_to_delete.empty()) { | |
679 callback.Run(true); | |
680 return; | |
681 } | |
682 archive_manager_->DeleteMultipleArchives(paths_to_delete, callback); | |
683 } | |
684 | |
685 void OfflinePageModelImpl::OnExpirePageDone( | |
686 const base::Time& expiration_time, | |
687 std::unique_ptr<OfflinePagesUpdateResult> result) { | |
688 UMA_HISTOGRAM_BOOLEAN("OfflinePages.ExpirePage.StoreUpdateResult", | |
689 result->updated_items.size() > 0); | |
690 for (const auto& expired_page : result->updated_items) { | |
691 const auto& iter = offline_pages_.find(expired_page.offline_id); | |
692 if (iter == offline_pages_.end()) | |
693 continue; | |
694 | |
695 iter->second.expiration_time = expiration_time; | |
696 ClientId client_id = iter->second.client_id; | |
697 offline_event_logger_.RecordPageExpired( | |
698 std::to_string(expired_page.offline_id)); | |
699 base::HistogramBase* histogram = base::Histogram::FactoryGet( | |
700 AddHistogramSuffix(client_id, "OfflinePages.ExpirePage.PageLifetime"), | |
701 1, base::TimeDelta::FromDays(30).InMinutes(), 50, | |
702 base::HistogramBase::kUmaTargetedHistogramFlag); | |
703 histogram->Add((expiration_time - iter->second.creation_time).InMinutes()); | |
704 histogram = base::Histogram::FactoryGet( | |
705 AddHistogramSuffix(client_id, | |
706 "OfflinePages.ExpirePage.TimeSinceLastAccess"), | |
707 1, base::TimeDelta::FromDays(30).InMinutes(), 50, | |
708 base::HistogramBase::kUmaTargetedHistogramFlag); | |
709 histogram->Add( | |
710 (expiration_time - iter->second.last_access_time).InMinutes()); | |
711 } | |
712 } | |
713 | |
714 ClientPolicyController* OfflinePageModelImpl::GetPolicyController() { | 639 ClientPolicyController* OfflinePageModelImpl::GetPolicyController() { |
715 return policy_controller_.get(); | 640 return policy_controller_.get(); |
716 } | 641 } |
717 | 642 |
718 OfflinePageMetadataStore* OfflinePageModelImpl::GetStoreForTesting() { | 643 OfflinePageMetadataStore* OfflinePageModelImpl::GetStoreForTesting() { |
719 return store_.get(); | 644 return store_.get(); |
720 } | 645 } |
721 | 646 |
722 OfflinePageStorageManager* OfflinePageModelImpl::GetStorageManager() { | 647 OfflinePageStorageManager* OfflinePageModelImpl::GetStorageManager() { |
723 return storage_manager_.get(); | 648 return storage_manager_.get(); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 static_cast<int>(result), | 905 static_cast<int>(result), |
981 static_cast<int>(DeletePageResult::RESULT_COUNT)); | 906 static_cast<int>(DeletePageResult::RESULT_COUNT)); |
982 archive_manager_->GetStorageStats( | 907 archive_manager_->GetStorageStats( |
983 base::Bind(&ReportStorageHistogramsAfterDelete)); | 908 base::Bind(&ReportStorageHistogramsAfterDelete)); |
984 if (!callback.is_null()) | 909 if (!callback.is_null()) |
985 callback.Run(result); | 910 callback.Run(result); |
986 } | 911 } |
987 | 912 |
988 void OfflinePageModelImpl::CheckMetadataConsistencyForArchivePaths( | 913 void OfflinePageModelImpl::CheckMetadataConsistencyForArchivePaths( |
989 const std::set<base::FilePath>& archive_paths) { | 914 const std::set<base::FilePath>& archive_paths) { |
990 ExpirePagesMissingArchiveFile(archive_paths); | 915 DeletePagesMissingArchiveFile(archive_paths); |
991 DeleteOrphanedArchives(archive_paths); | 916 DeleteOrphanedArchives(archive_paths); |
992 } | 917 } |
993 | 918 |
994 void OfflinePageModelImpl::ExpirePagesMissingArchiveFile( | 919 void OfflinePageModelImpl::DeletePagesMissingArchiveFile( |
995 const std::set<base::FilePath>& archive_paths) { | 920 const std::set<base::FilePath>& archive_paths) { |
996 std::vector<int64_t> ids_of_pages_missing_archive_file; | 921 std::vector<int64_t> ids_of_pages_missing_archive_file; |
997 for (const auto& id_page_pair : offline_pages_) { | 922 for (const auto& id_page_pair : offline_pages_) { |
998 if (archive_paths.count(id_page_pair.second.file_path) == 0UL) | 923 if (archive_paths.count(id_page_pair.second.file_path) == 0UL) |
999 ids_of_pages_missing_archive_file.push_back(id_page_pair.first); | 924 ids_of_pages_missing_archive_file.push_back(id_page_pair.first); |
1000 } | 925 } |
1001 | 926 |
1002 if (ids_of_pages_missing_archive_file.empty()) | 927 if (ids_of_pages_missing_archive_file.empty()) |
1003 return; | 928 return; |
1004 | 929 |
1005 ExpirePages( | 930 DeletePagesByOfflineId( |
1006 ids_of_pages_missing_archive_file, GetCurrentTime(), | 931 ids_of_pages_missing_archive_file, |
1007 base::Bind(&OfflinePageModelImpl::OnExpirePagesMissingArchiveFileDone, | 932 base::Bind(&OfflinePageModelImpl::OnDeletePagesMissingArchiveFileDone, |
1008 weak_ptr_factory_.GetWeakPtr(), | 933 weak_ptr_factory_.GetWeakPtr(), |
1009 ids_of_pages_missing_archive_file)); | 934 ids_of_pages_missing_archive_file)); |
1010 } | 935 } |
1011 | 936 |
1012 void OfflinePageModelImpl::OnExpirePagesMissingArchiveFileDone( | 937 void OfflinePageModelImpl::OnDeletePagesMissingArchiveFileDone( |
1013 const std::vector<int64_t>& offline_ids, | 938 const std::vector<int64_t>& offline_ids, |
1014 bool success) { | 939 DeletePageResult result) { |
1015 UMA_HISTOGRAM_COUNTS("OfflinePages.Consistency.PagesMissingArchiveFileCount", | 940 UMA_HISTOGRAM_COUNTS("OfflinePages.Consistency.PagesMissingArchiveFileCount", |
1016 static_cast<int32_t>(offline_ids.size())); | 941 static_cast<int32_t>(offline_ids.size())); |
1017 UMA_HISTOGRAM_BOOLEAN( | 942 UMA_HISTOGRAM_ENUMERATION( |
1018 "OfflinePages.Consistency.ExpirePagesMissingArchiveFileResult", success); | 943 "OfflinePages.Consistency.DeletePagesMissingArchiveFileResult", |
| 944 static_cast<int>(result), |
| 945 static_cast<int>(DeletePageResult::RESULT_COUNT)); |
1019 } | 946 } |
1020 | 947 |
1021 void OfflinePageModelImpl::DeleteOrphanedArchives( | 948 void OfflinePageModelImpl::DeleteOrphanedArchives( |
1022 const std::set<base::FilePath>& archive_paths) { | 949 const std::set<base::FilePath>& archive_paths) { |
1023 // Archives are considered orphaned unless they are pointed to by some pages. | 950 // Archives are considered orphaned unless they are pointed to by some pages. |
1024 std::set<base::FilePath> orphaned_archive_set(archive_paths); | 951 std::set<base::FilePath> orphaned_archive_set(archive_paths); |
1025 for (const auto& id_page_pair : offline_pages_) | 952 for (const auto& id_page_pair : offline_pages_) |
1026 orphaned_archive_set.erase(id_page_pair.second.file_path); | 953 orphaned_archive_set.erase(id_page_pair.second.file_path); |
1027 | 954 |
1028 if (orphaned_archive_set.empty()) | 955 if (orphaned_archive_set.empty()) |
(...skipping 21 matching lines...) Expand all Loading... |
1050 offline_pages_.clear(); | 977 offline_pages_.clear(); |
1051 for (const auto& offline_page : offline_pages) | 978 for (const auto& offline_page : offline_pages) |
1052 offline_pages_[offline_page.offline_id] = offline_page; | 979 offline_pages_[offline_page.offline_id] = offline_page; |
1053 } | 980 } |
1054 | 981 |
1055 void OfflinePageModelImpl::ClearStorageIfNeeded( | 982 void OfflinePageModelImpl::ClearStorageIfNeeded( |
1056 const ClearStorageCallback& callback) { | 983 const ClearStorageCallback& callback) { |
1057 storage_manager_->ClearPagesIfNeeded(callback); | 984 storage_manager_->ClearPagesIfNeeded(callback); |
1058 } | 985 } |
1059 | 986 |
1060 void OfflinePageModelImpl::OnStorageCleared(size_t expired_page_count, | 987 void OfflinePageModelImpl::OnStorageCleared(size_t deleted_page_count, |
1061 ClearStorageResult result) { | 988 ClearStorageResult result) { |
1062 UMA_HISTOGRAM_ENUMERATION("OfflinePages.ClearStorageResult", | 989 UMA_HISTOGRAM_ENUMERATION("OfflinePages.ClearStorageResult", |
1063 static_cast<int>(result), | 990 static_cast<int>(result), |
1064 static_cast<int>(ClearStorageResult::RESULT_COUNT)); | 991 static_cast<int>(ClearStorageResult::RESULT_COUNT)); |
1065 if (expired_page_count > 0) { | 992 if (deleted_page_count > 0) { |
1066 UMA_HISTOGRAM_COUNTS("OfflinePages.ExpirePage.BatchSize", | 993 UMA_HISTOGRAM_COUNTS("OfflinePages.ClearStorageBatchSize", |
1067 static_cast<int32_t>(expired_page_count)); | 994 static_cast<int32_t>(deleted_page_count)); |
1068 } | 995 } |
1069 } | 996 } |
1070 | 997 |
1071 void OfflinePageModelImpl::PostClearStorageIfNeededTask() { | 998 void OfflinePageModelImpl::PostClearStorageIfNeededTask() { |
1072 base::ThreadTaskRunnerHandle::Get()->PostTask( | 999 base::ThreadTaskRunnerHandle::Get()->PostTask( |
1073 FROM_HERE, base::Bind(&OfflinePageModelImpl::ClearStorageIfNeeded, | 1000 FROM_HERE, base::Bind(&OfflinePageModelImpl::ClearStorageIfNeeded, |
1074 weak_ptr_factory_.GetWeakPtr(), | 1001 weak_ptr_factory_.GetWeakPtr(), |
1075 base::Bind(&OfflinePageModelImpl::OnStorageCleared, | 1002 base::Bind(&OfflinePageModelImpl::OnStorageCleared, |
1076 weak_ptr_factory_.GetWeakPtr()))); | 1003 weak_ptr_factory_.GetWeakPtr()))); |
1077 } | 1004 } |
(...skipping 11 matching lines...) Expand all Loading... |
1089 } | 1016 } |
1090 | 1017 |
1091 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); | 1018 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); |
1092 } | 1019 } |
1093 | 1020 |
1094 base::Time OfflinePageModelImpl::GetCurrentTime() const { | 1021 base::Time OfflinePageModelImpl::GetCurrentTime() const { |
1095 return testing_clock_ ? testing_clock_->Now() : base::Time::Now(); | 1022 return testing_clock_ ? testing_clock_->Now() : base::Time::Now(); |
1096 } | 1023 } |
1097 | 1024 |
1098 } // namespace offline_pages | 1025 } // namespace offline_pages |
OLD | NEW |