Chromium Code Reviews| 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 archives_dir_, offline_id, | 299 archives_dir_, offline_id, |
| 300 base::Bind(&OfflinePageModelImpl::OnCreateArchiveDone, | 300 base::Bind(&OfflinePageModelImpl::OnCreateArchiveDone, |
| 301 weak_ptr_factory_.GetWeakPtr(), url, offline_id, client_id, | 301 weak_ptr_factory_.GetWeakPtr(), url, offline_id, client_id, |
| 302 base::Time::Now(), callback)); | 302 base::Time::Now(), callback)); |
| 303 pending_archivers_.push_back(std::move(archiver)); | 303 pending_archivers_.push_back(std::move(archiver)); |
| 304 } | 304 } |
| 305 | 305 |
| 306 void OfflinePageModelImpl::MarkPageAccessed(int64_t offline_id) { | 306 void OfflinePageModelImpl::MarkPageAccessed(int64_t offline_id) { |
| 307 DCHECK(is_loaded_); | 307 DCHECK(is_loaded_); |
| 308 auto iter = offline_pages_.find(offline_id); | 308 auto iter = offline_pages_.find(offline_id); |
| 309 if (iter == offline_pages_.end()) | 309 if (iter == offline_pages_.end() || iter->second.IsExpired()) |
| 310 return; | 310 return; |
| 311 | 311 |
| 312 // Make a copy of the cached item and update it. The cached item should only | 312 // Make a copy of the cached item and update it. The cached item should only |
| 313 // be updated upon the successful store operation. | 313 // be updated upon the successful store operation. |
| 314 OfflinePageItem offline_page_item = iter->second; | 314 OfflinePageItem offline_page_item = iter->second; |
| 315 | 315 |
| 316 ReportPageHistogramsAfterAccess(offline_page_item); | 316 ReportPageHistogramsAfterAccess(offline_page_item); |
| 317 | 317 |
| 318 offline_page_item.last_access_time = base::Time::Now(); | 318 offline_page_item.last_access_time = base::Time::Now(); |
| 319 offline_page_item.access_count++; | 319 offline_page_item.access_count++; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 407 } | 407 } |
| 408 | 408 |
| 409 void OfflinePageModelImpl::HasPagesAfterLoadDone( | 409 void OfflinePageModelImpl::HasPagesAfterLoadDone( |
| 410 const std::string& name_space, | 410 const std::string& name_space, |
| 411 const HasPagesCallback& callback) const { | 411 const HasPagesCallback& callback) const { |
| 412 DCHECK(is_loaded_); | 412 DCHECK(is_loaded_); |
| 413 | 413 |
| 414 bool has_pages = false; | 414 bool has_pages = false; |
| 415 | 415 |
| 416 for (const auto& id_page_pair : offline_pages_) { | 416 for (const auto& id_page_pair : offline_pages_) { |
| 417 if (id_page_pair.second.client_id.name_space == name_space) { | 417 if (id_page_pair.second.client_id.name_space == name_space && |
| 418 !id_page_pair.second.IsExpired()) { | |
| 418 has_pages = true; | 419 has_pages = true; |
| 419 break; | 420 break; |
| 420 } | 421 } |
| 421 } | 422 } |
| 422 | 423 |
| 423 callback.Run(has_pages); | 424 callback.Run(has_pages); |
| 424 } | 425 } |
| 425 | 426 |
| 426 void OfflinePageModelImpl::CheckPagesExistOffline( | 427 void OfflinePageModelImpl::CheckPagesExistOffline( |
| 427 const std::set<GURL>& urls, | 428 const std::set<GURL>& urls, |
| 428 const CheckPagesExistOfflineCallback& callback) { | 429 const CheckPagesExistOfflineCallback& callback) { |
| 429 RunWhenLoaded( | 430 RunWhenLoaded( |
| 430 base::Bind(&OfflinePageModelImpl::CheckPagesExistOfflineAfterLoadDone, | 431 base::Bind(&OfflinePageModelImpl::CheckPagesExistOfflineAfterLoadDone, |
| 431 weak_ptr_factory_.GetWeakPtr(), urls, callback)); | 432 weak_ptr_factory_.GetWeakPtr(), urls, callback)); |
| 432 } | 433 } |
| 433 | 434 |
| 434 void OfflinePageModelImpl::CheckPagesExistOfflineAfterLoadDone( | 435 void OfflinePageModelImpl::CheckPagesExistOfflineAfterLoadDone( |
| 435 const std::set<GURL>& urls, | 436 const std::set<GURL>& urls, |
| 436 const CheckPagesExistOfflineCallback& callback) { | 437 const CheckPagesExistOfflineCallback& callback) { |
| 437 DCHECK(is_loaded_); | 438 DCHECK(is_loaded_); |
| 438 CheckPagesExistOfflineResult result; | 439 CheckPagesExistOfflineResult result; |
| 439 for (const auto& id_page_pair : offline_pages_) { | 440 for (const auto& id_page_pair : offline_pages_) { |
| 441 if (id_page_pair.second.IsExpired()) | |
| 442 continue; | |
| 440 auto iter = urls.find(id_page_pair.second.url); | 443 auto iter = urls.find(id_page_pair.second.url); |
| 441 if (iter != urls.end()) | 444 if (iter != urls.end()) |
| 442 result.insert(*iter); | 445 result.insert(*iter); |
| 443 } | 446 } |
| 444 callback.Run(result); | 447 callback.Run(result); |
| 445 } | 448 } |
| 446 | 449 |
| 447 void OfflinePageModelImpl::GetAllPages( | 450 void OfflinePageModelImpl::GetAllPages( |
| 448 const MultipleOfflinePageItemCallback& callback) { | 451 const MultipleOfflinePageItemCallback& callback) { |
| 449 RunWhenLoaded(base::Bind(&OfflinePageModelImpl::GetAllPagesAfterLoadDone, | 452 RunWhenLoaded(base::Bind(&OfflinePageModelImpl::GetAllPagesAfterLoadDone, |
| 450 weak_ptr_factory_.GetWeakPtr(), callback)); | 453 weak_ptr_factory_.GetWeakPtr(), callback)); |
| 451 } | 454 } |
| 452 | 455 |
| 453 void OfflinePageModelImpl::GetAllPagesAfterLoadDone( | 456 void OfflinePageModelImpl::GetAllPagesAfterLoadDone( |
| 454 const MultipleOfflinePageItemCallback& callback) const { | 457 const MultipleOfflinePageItemCallback& callback) const { |
| 455 DCHECK(is_loaded_); | 458 DCHECK(is_loaded_); |
| 456 | 459 |
| 457 MultipleOfflinePageItemResult offline_pages; | 460 MultipleOfflinePageItemResult offline_pages; |
| 458 for (const auto& id_page_pair : offline_pages_) | 461 for (const auto& id_page_pair : offline_pages_) { |
| 459 offline_pages.push_back(id_page_pair.second); | 462 if (!id_page_pair.second.IsExpired()) |
| 463 offline_pages.push_back(id_page_pair.second); | |
| 464 } | |
| 460 | 465 |
| 461 callback.Run(offline_pages); | 466 callback.Run(offline_pages); |
| 462 } | 467 } |
| 463 | 468 |
| 464 void OfflinePageModelImpl::GetOfflineIdsForClientId( | 469 void OfflinePageModelImpl::GetOfflineIdsForClientId( |
| 465 const ClientId& client_id, | 470 const ClientId& client_id, |
| 466 const MultipleOfflineIdCallback& callback) { | 471 const MultipleOfflineIdCallback& callback) { |
| 467 RunWhenLoaded( | 472 RunWhenLoaded( |
| 468 base::Bind(&OfflinePageModelImpl::GetOfflineIdsForClientIdWhenLoadDone, | 473 base::Bind(&OfflinePageModelImpl::GetOfflineIdsForClientIdWhenLoadDone, |
| 469 weak_ptr_factory_.GetWeakPtr(), client_id, callback)); | 474 weak_ptr_factory_.GetWeakPtr(), client_id, callback)); |
| 470 } | 475 } |
| 471 | 476 |
| 472 void OfflinePageModelImpl::GetOfflineIdsForClientIdWhenLoadDone( | 477 void OfflinePageModelImpl::GetOfflineIdsForClientIdWhenLoadDone( |
| 473 const ClientId& client_id, | 478 const ClientId& client_id, |
| 474 const MultipleOfflineIdCallback& callback) const { | 479 const MultipleOfflineIdCallback& callback) const { |
| 475 callback.Run(MaybeGetOfflineIdsForClientId(client_id)); | 480 callback.Run(MaybeGetOfflineIdsForClientId(client_id)); |
| 476 } | 481 } |
| 477 | 482 |
| 478 const std::vector<int64_t> OfflinePageModelImpl::MaybeGetOfflineIdsForClientId( | 483 const std::vector<int64_t> OfflinePageModelImpl::MaybeGetOfflineIdsForClientId( |
| 479 const ClientId& client_id) const { | 484 const ClientId& client_id) const { |
| 480 DCHECK(is_loaded_); | 485 DCHECK(is_loaded_); |
| 481 std::vector<int64_t> results; | 486 std::vector<int64_t> results; |
| 482 | 487 |
| 483 // We want only all pages, including those marked for deletion. | 488 // We want only all pages, including those marked for deletion. |
| 484 // TODO(bburns): actually use an index rather than linear scan. | 489 // TODO(bburns): actually use an index rather than linear scan. |
| 485 for (const auto& id_page_pair : offline_pages_) { | 490 for (const auto& id_page_pair : offline_pages_) { |
| 486 if (id_page_pair.second.client_id == client_id) | 491 if (id_page_pair.second.client_id == client_id && |
| 492 !id_page_pair.second.IsExpired()) { | |
| 487 results.push_back(id_page_pair.second.offline_id); | 493 results.push_back(id_page_pair.second.offline_id); |
| 494 } | |
| 488 } | 495 } |
| 489 return results; | 496 return results; |
| 490 } | 497 } |
| 491 | 498 |
| 492 void OfflinePageModelImpl::GetPageByOfflineId( | 499 void OfflinePageModelImpl::GetPageByOfflineId( |
| 493 int64_t offline_id, | 500 int64_t offline_id, |
| 494 const SingleOfflinePageItemCallback& callback) { | 501 const SingleOfflinePageItemCallback& callback) { |
| 495 RunWhenLoaded( | 502 RunWhenLoaded( |
| 496 base::Bind(&OfflinePageModelImpl::GetPageByOfflineIdWhenLoadDone, | 503 base::Bind(&OfflinePageModelImpl::GetPageByOfflineIdWhenLoadDone, |
| 497 weak_ptr_factory_.GetWeakPtr(), offline_id, callback)); | 504 weak_ptr_factory_.GetWeakPtr(), offline_id, callback)); |
| 498 } | 505 } |
| 499 | 506 |
| 500 void OfflinePageModelImpl::GetPageByOfflineIdWhenLoadDone( | 507 void OfflinePageModelImpl::GetPageByOfflineIdWhenLoadDone( |
| 501 int64_t offline_id, | 508 int64_t offline_id, |
| 502 const SingleOfflinePageItemCallback& callback) const { | 509 const SingleOfflinePageItemCallback& callback) const { |
| 503 SingleOfflinePageItemResult result; | 510 SingleOfflinePageItemResult result; |
| 504 const OfflinePageItem* match = MaybeGetPageByOfflineId(offline_id); | 511 const OfflinePageItem* match = MaybeGetPageByOfflineId(offline_id); |
| 505 if (match != nullptr) | 512 if (match != nullptr) |
| 506 result = *match; | 513 result = *match; |
| 507 callback.Run(result); | 514 callback.Run(result); |
| 508 } | 515 } |
| 509 | 516 |
| 510 const OfflinePageItem* OfflinePageModelImpl::MaybeGetPageByOfflineId( | 517 const OfflinePageItem* OfflinePageModelImpl::MaybeGetPageByOfflineId( |
| 511 int64_t offline_id) const { | 518 int64_t offline_id) const { |
| 512 const auto iter = offline_pages_.find(offline_id); | 519 const auto iter = offline_pages_.find(offline_id); |
| 513 return iter != offline_pages_.end() ? &(iter->second) : nullptr; | 520 return iter != offline_pages_.end() && !iter->second.IsExpired() |
| 521 ? &(iter->second) | |
| 522 : nullptr; | |
| 514 } | 523 } |
| 515 | 524 |
| 516 void OfflinePageModelImpl::GetPageByOfflineURL( | 525 void OfflinePageModelImpl::GetPageByOfflineURL( |
| 517 const GURL& offline_url, | 526 const GURL& offline_url, |
| 518 const SingleOfflinePageItemCallback& callback) { | 527 const SingleOfflinePageItemCallback& callback) { |
| 519 RunWhenLoaded( | 528 RunWhenLoaded( |
| 520 base::Bind(&OfflinePageModelImpl::GetPageByOfflineURLWhenLoadDone, | 529 base::Bind(&OfflinePageModelImpl::GetPageByOfflineURLWhenLoadDone, |
| 521 weak_ptr_factory_.GetWeakPtr(), offline_url, callback)); | 530 weak_ptr_factory_.GetWeakPtr(), offline_url, callback)); |
| 522 } | 531 } |
| 523 | 532 |
| 524 void OfflinePageModelImpl::GetPageByOfflineURLWhenLoadDone( | 533 void OfflinePageModelImpl::GetPageByOfflineURLWhenLoadDone( |
| 525 const GURL& offline_url, | 534 const GURL& offline_url, |
| 526 const SingleOfflinePageItemCallback& callback) const { | 535 const SingleOfflinePageItemCallback& callback) const { |
| 536 // Getting pages by offline URL does not exclude expired pages, as the caller | |
| 537 // already holds the offline URL and simply needs to look up a corresponding | |
| 538 // online URL. | |
| 527 base::Optional<OfflinePageItem> result; | 539 base::Optional<OfflinePageItem> result; |
| 528 | 540 |
| 529 for (const auto& id_page_pair : offline_pages_) { | 541 for (const auto& id_page_pair : offline_pages_) { |
| 530 if (id_page_pair.second.GetOfflineURL() == offline_url) { | 542 if (id_page_pair.second.GetOfflineURL() == offline_url) { |
| 531 callback.Run(base::make_optional(id_page_pair.second)); | 543 callback.Run(base::make_optional(id_page_pair.second)); |
| 532 return; | 544 return; |
| 533 } | 545 } |
| 534 } | 546 } |
| 535 | 547 |
| 536 callback.Run(base::nullopt); | 548 callback.Run(base::nullopt); |
| 537 } | 549 } |
| 538 | 550 |
| 539 const OfflinePageItem* OfflinePageModelImpl::MaybeGetPageByOfflineURL( | 551 const OfflinePageItem* OfflinePageModelImpl::MaybeGetPageByOfflineURL( |
| 540 const GURL& offline_url) const { | 552 const GURL& offline_url) const { |
| 553 // Getting pages by offline URL does not exclude expired pages, as the caller | |
| 554 // already holds the offline URL and simply needs to look up a corresponding | |
| 555 // online URL. | |
| 541 for (const auto& id_page_pair : offline_pages_) { | 556 for (const auto& id_page_pair : offline_pages_) { |
| 542 if (id_page_pair.second.GetOfflineURL() == offline_url) | 557 if (id_page_pair.second.GetOfflineURL() == offline_url) |
| 543 return &(id_page_pair.second); | 558 return &(id_page_pair.second); |
| 544 } | 559 } |
| 545 return nullptr; | 560 return nullptr; |
| 546 } | 561 } |
| 547 | 562 |
| 548 void OfflinePageModelImpl::GetBestPageForOnlineURL( | 563 void OfflinePageModelImpl::GetBestPageForOnlineURL( |
| 549 const GURL& online_url, | 564 const GURL& online_url, |
| 550 const SingleOfflinePageItemCallback callback) { | 565 const SingleOfflinePageItemCallback callback) { |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 572 base::Bind(&OfflinePageModelImpl::GetPagesByOnlineURLWhenLoadDone, | 587 base::Bind(&OfflinePageModelImpl::GetPagesByOnlineURLWhenLoadDone, |
| 573 weak_ptr_factory_.GetWeakPtr(), online_url, callback)); | 588 weak_ptr_factory_.GetWeakPtr(), online_url, callback)); |
| 574 } | 589 } |
| 575 | 590 |
| 576 void OfflinePageModelImpl::GetPagesByOnlineURLWhenLoadDone( | 591 void OfflinePageModelImpl::GetPagesByOnlineURLWhenLoadDone( |
| 577 const GURL& online_url, | 592 const GURL& online_url, |
| 578 const MultipleOfflinePageItemCallback& callback) const { | 593 const MultipleOfflinePageItemCallback& callback) const { |
| 579 std::vector<OfflinePageItem> result; | 594 std::vector<OfflinePageItem> result; |
| 580 | 595 |
| 581 for (const auto& id_page_pair : offline_pages_) { | 596 for (const auto& id_page_pair : offline_pages_) { |
| 582 if (id_page_pair.second.url == online_url) | 597 if (id_page_pair.second.url == online_url && |
| 598 !id_page_pair.second.IsExpired()) { | |
| 583 result.push_back(id_page_pair.second); | 599 result.push_back(id_page_pair.second); |
| 600 } | |
| 584 } | 601 } |
| 585 | 602 |
| 586 callback.Run(result); | 603 callback.Run(result); |
| 587 } | 604 } |
| 588 | 605 |
| 589 const OfflinePageItem* OfflinePageModelImpl::MaybeGetBestPageForOnlineURL( | 606 const OfflinePageItem* OfflinePageModelImpl::MaybeGetBestPageForOnlineURL( |
| 590 const GURL& online_url) const { | 607 const GURL& online_url) const { |
| 591 const OfflinePageItem* result = nullptr; | 608 const OfflinePageItem* result = nullptr; |
| 592 for (const auto& id_page_pair : offline_pages_) { | 609 for (const auto& id_page_pair : offline_pages_) { |
| 593 if (id_page_pair.second.url == online_url) { | 610 if (id_page_pair.second.url == online_url && |
| 611 !id_page_pair.second.IsExpired()) { | |
| 594 if (!result || id_page_pair.second.creation_time > result->creation_time) | 612 if (!result || id_page_pair.second.creation_time > result->creation_time) |
| 595 result = &(id_page_pair.second); | 613 result = &(id_page_pair.second); |
| 596 } | 614 } |
| 597 } | 615 } |
| 598 return result; | 616 return result; |
| 599 } | 617 } |
| 600 | 618 |
| 601 void OfflinePageModelImpl::CheckForExternalFileDeletion() { | 619 void OfflinePageModelImpl::CheckForExternalFileDeletion() { |
| 602 DCHECK(is_loaded_); | 620 DCHECK(is_loaded_); |
| 603 | 621 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 846 DeletePageResult result) { | 864 DeletePageResult result) { |
| 847 UMA_HISTOGRAM_ENUMERATION("OfflinePages.DeletePageResult", | 865 UMA_HISTOGRAM_ENUMERATION("OfflinePages.DeletePageResult", |
| 848 static_cast<int>(result), | 866 static_cast<int>(result), |
| 849 static_cast<int>(DeletePageResult::RESULT_COUNT)); | 867 static_cast<int>(DeletePageResult::RESULT_COUNT)); |
| 850 archive_manager_->GetStorageStats( | 868 archive_manager_->GetStorageStats( |
| 851 base::Bind(&ReportStorageHistogramsAfterDelete)); | 869 base::Bind(&ReportStorageHistogramsAfterDelete)); |
| 852 if (!callback.is_null()) | 870 if (!callback.is_null()) |
| 853 callback.Run(result); | 871 callback.Run(result); |
| 854 } | 872 } |
| 855 | 873 |
| 856 void OfflinePageModelImpl::ScanForMissingArchiveFiles( | 874 void OfflinePageModelImpl::ScanForMissingArchiveFiles( |
|
fgorski
2016/06/07 22:46:15
I think you added functionality to this method and
romax
2016/06/08 01:31:25
Done.
| |
| 857 const std::set<base::FilePath>& archive_paths) { | 875 const std::set<base::FilePath>& archive_paths) { |
| 858 std::vector<int64_t> ids_of_pages_missing_archive_file; | 876 std::vector<int64_t> ids_of_pages_missing_archive_file; |
| 859 std::vector<std::pair<int64_t, ClientId>> offline_client_id_pairs; | 877 std::set<base::FilePath> unused_archives(archive_paths); |
|
fgorski
2016/06/07 22:46:15
I like the idea you used here.
I think a comment,
romax
2016/06/08 01:31:25
Done.
| |
| 878 | |
| 860 for (const auto& id_page_pair : offline_pages_) { | 879 for (const auto& id_page_pair : offline_pages_) { |
| 861 if (archive_paths.count(id_page_pair.second.file_path) == 0UL) { | 880 const auto& iter = unused_archives.find(id_page_pair.second.file_path); |
| 881 if (iter == unused_archives.end()) { | |
| 862 ids_of_pages_missing_archive_file.push_back(id_page_pair.first); | 882 ids_of_pages_missing_archive_file.push_back(id_page_pair.first); |
| 863 offline_client_id_pairs.push_back( | 883 } else { |
| 864 std::make_pair(id_page_pair.first, id_page_pair.second.client_id)); | 884 unused_archives.erase(iter); |
| 865 } | 885 } |
| 866 } | 886 } |
| 867 | 887 |
| 868 // No offline pages missing archive files, we can bail out. | 888 if (!ids_of_pages_missing_archive_file.empty()) { |
| 869 if (ids_of_pages_missing_archive_file.empty()) | 889 ExpirePages(ids_of_pages_missing_archive_file, base::Time::Now(), |
| 870 return; | 890 base::Bind(&OfflinePageModelImpl::OnExpireArchivelessFilesDone, |
| 891 weak_ptr_factory_.GetWeakPtr(), | |
| 892 ids_of_pages_missing_archive_file)); | |
| 893 } | |
| 871 | 894 |
| 872 DeletePageCallback remove_pages_done_callback(base::Bind( | 895 if (!unused_archives.empty()) { |
| 873 &OfflinePageModelImpl::OnRemoveOfflinePagesMissingArchiveFileDone, | 896 std::vector<base::FilePath> headless_archives(unused_archives.begin(), |
|
fgorski
2016/06/07 22:46:15
orphaned_archives?
romax
2016/06/08 01:31:25
i explained in previous comments, but I'm willing
| |
| 874 weak_ptr_factory_.GetWeakPtr(), offline_client_id_pairs)); | 897 unused_archives.end()); |
| 875 | 898 archive_manager_->DeleteMultipleArchives( |
| 876 store_->RemoveOfflinePages( | 899 headless_archives, |
| 877 ids_of_pages_missing_archive_file, | 900 base::Bind(&OfflinePageModelImpl::OnDeleteHeadlessArchivesDone, |
| 878 base::Bind(&OfflinePageModelImpl::OnRemoveOfflinePagesDone, | 901 weak_ptr_factory_.GetWeakPtr(), headless_archives)); |
| 879 weak_ptr_factory_.GetWeakPtr(), | |
| 880 ids_of_pages_missing_archive_file, | |
| 881 remove_pages_done_callback)); | |
| 882 } | |
| 883 | |
| 884 void OfflinePageModelImpl::OnRemoveOfflinePagesMissingArchiveFileDone( | |
| 885 const std::vector<std::pair<int64_t, ClientId>>& offline_client_id_pairs, | |
| 886 DeletePageResult /* result */) { | |
| 887 for (const auto& id_pair : offline_client_id_pairs) { | |
| 888 FOR_EACH_OBSERVER(Observer, observers_, | |
| 889 OfflinePageDeleted(id_pair.first, id_pair.second)); | |
| 890 } | 902 } |
| 891 } | 903 } |
| 892 | 904 |
| 905 void OfflinePageModelImpl::OnExpireArchivelessFilesDone( | |
| 906 const std::vector<int64_t>& offline_ids, | |
| 907 bool success) { | |
| 908 UMA_HISTOGRAM_COUNTS("OfflinePages.Consistency.ArchivelessPageCount", | |
|
fgorski
2016/06/07 22:46:15
how about .PagesMissingArchiveFiles for the last s
romax
2016/06/08 01:31:25
Done.
| |
| 909 static_cast<int32_t>(offline_ids.size())); | |
| 910 UMA_HISTOGRAM_BOOLEAN("OfflinePages.Consistency.ExpireArchivelessPagesResult", | |
| 911 success); | |
| 912 } | |
| 913 | |
| 914 void OfflinePageModelImpl::OnDeleteHeadlessArchivesDone( | |
|
fgorski
2016/06/07 22:46:15
Again Orphaned feel better here and below.
romax
2016/06/08 01:31:25
Acknowledged.
| |
| 915 const std::vector<base::FilePath>& archives, | |
| 916 bool success) { | |
| 917 UMA_HISTOGRAM_COUNTS("OfflinePages.Consistency.HeadlessArchivesCount", | |
| 918 static_cast<int32_t>(archives.size())); | |
| 919 UMA_HISTOGRAM_BOOLEAN("OfflinePages.Consistency.DeleteHeadlessArchivesResult", | |
| 920 success); | |
| 921 } | |
| 922 | |
| 893 void OfflinePageModelImpl::OnRemoveAllFilesDoneForClearAll( | 923 void OfflinePageModelImpl::OnRemoveAllFilesDoneForClearAll( |
| 894 const base::Closure& callback, | 924 const base::Closure& callback, |
| 895 DeletePageResult result) { | 925 DeletePageResult result) { |
| 896 store_->Reset(base::Bind(&OfflinePageModelImpl::OnResetStoreDoneForClearAll, | 926 store_->Reset(base::Bind(&OfflinePageModelImpl::OnResetStoreDoneForClearAll, |
| 897 weak_ptr_factory_.GetWeakPtr(), callback)); | 927 weak_ptr_factory_.GetWeakPtr(), callback)); |
| 898 } | 928 } |
| 899 | 929 |
| 900 void OfflinePageModelImpl::OnResetStoreDoneForClearAll( | 930 void OfflinePageModelImpl::OnResetStoreDoneForClearAll( |
| 901 const base::Closure& callback, | 931 const base::Closure& callback, |
| 902 bool success) { | 932 bool success) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 953 void OfflinePageModelImpl::RunWhenLoaded(const base::Closure& task) { | 983 void OfflinePageModelImpl::RunWhenLoaded(const base::Closure& task) { |
| 954 if (!is_loaded_) { | 984 if (!is_loaded_) { |
| 955 delayed_tasks_.push_back(task); | 985 delayed_tasks_.push_back(task); |
| 956 return; | 986 return; |
| 957 } | 987 } |
| 958 | 988 |
| 959 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); | 989 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); |
| 960 } | 990 } |
| 961 | 991 |
| 962 } // namespace offline_pages | 992 } // namespace offline_pages |
| OLD | NEW |