Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Side by Side Diff: components/offline_pages/offline_page_model.cc

Issue 1986673002: [Offline Pages] Updated clearing logic in storage manager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more comments. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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.h" 5 #include "components/offline_pages/offline_page_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 613
614 // TODO(jianli): rebuild the store upon failure. 614 // TODO(jianli): rebuild the store upon failure.
615 615
616 if (load_status == OfflinePageMetadataStore::LOAD_SUCCEEDED) 616 if (load_status == OfflinePageMetadataStore::LOAD_SUCCEEDED)
617 CacheLoadedData(offline_pages); 617 CacheLoadedData(offline_pages);
618 618
619 UMA_HISTOGRAM_TIMES("OfflinePages.Model.ConstructionToLoadedEventTime", 619 UMA_HISTOGRAM_TIMES("OfflinePages.Model.ConstructionToLoadedEventTime",
620 base::TimeTicks::Now() - start_time); 620 base::TimeTicks::Now() - start_time);
621 621
622 // Create Storage Manager. 622 // Create Storage Manager.
623 storage_manager_.reset( 623 storage_manager_.reset(new OfflinePageStorageManager(
624 new OfflinePageStorageManager(this, GetPolicyController())); 624 this, GetPolicyController(), archive_manager_.get()));
625 625
626 // Run all the delayed tasks. 626 // Run all the delayed tasks.
627 for (const auto& delayed_task : delayed_tasks_) 627 for (const auto& delayed_task : delayed_tasks_)
628 delayed_task.Run(); 628 delayed_task.Run();
629 delayed_tasks_.clear(); 629 delayed_tasks_.clear();
630 630
631 FOR_EACH_OBSERVER(Observer, observers_, OfflinePageModelLoaded(this)); 631 FOR_EACH_OBSERVER(Observer, observers_, OfflinePageModelLoaded(this));
632 632
633 CheckForExternalFileDeletion(); 633 CheckForExternalFileDeletion();
634 } 634 }
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 void OfflinePageModel::RunWhenLoaded(const base::Closure& task) { 826 void OfflinePageModel::RunWhenLoaded(const base::Closure& task) {
827 if (!is_loaded_) { 827 if (!is_loaded_) {
828 delayed_tasks_.push_back(task); 828 delayed_tasks_.push_back(task);
829 return; 829 return;
830 } 830 }
831 831
832 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task); 832 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, task);
833 } 833 }
834 834
835 } // namespace offline_pages 835 } // namespace offline_pages
OLDNEW
« no previous file with comments | « components/offline_pages/archive_manager.cc ('k') | components/offline_pages/offline_page_storage_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698