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

Side by Side Diff: components/offline_pages/archive_manager.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 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/files/file_enumerator.h" 7 #include "base/files/file_enumerator.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 const StorageStatsCallback& callback) { 62 const StorageStatsCallback& callback) {
63 ArchiveManager::StorageStats storage_stats; 63 ArchiveManager::StorageStats storage_stats;
64 storage_stats.free_disk_space = 64 storage_stats.free_disk_space =
65 base::SysInfo::AmountOfFreeDiskSpace(archive_dir); 65 base::SysInfo::AmountOfFreeDiskSpace(archive_dir);
66 storage_stats.total_archives_size = base::ComputeDirectorySize(archive_dir); 66 storage_stats.total_archives_size = base::ComputeDirectorySize(archive_dir);
67 task_runner->PostTask(FROM_HERE, base::Bind(callback, storage_stats)); 67 task_runner->PostTask(FROM_HERE, base::Bind(callback, storage_stats));
68 } 68 }
69 69
70 } // namespace 70 } // namespace
71 71
72 // protected and used for testing.
73 ArchiveManager::ArchiveManager() {}
74
72 ArchiveManager::ArchiveManager( 75 ArchiveManager::ArchiveManager(
73 const base::FilePath& archives_dir, 76 const base::FilePath& archives_dir,
74 const scoped_refptr<base::SequencedTaskRunner>& task_runner) 77 const scoped_refptr<base::SequencedTaskRunner>& task_runner)
75 : archives_dir_(archives_dir), task_runner_(task_runner) {} 78 : archives_dir_(archives_dir), task_runner_(task_runner) {}
76 79
77 ArchiveManager::~ArchiveManager() {} 80 ArchiveManager::~ArchiveManager() {}
78 81
79 void ArchiveManager::EnsureArchivesDirCreated(const base::Closure& callback) { 82 void ArchiveManager::EnsureArchivesDirCreated(const base::Closure& callback) {
80 task_runner_->PostTaskAndReply( 83 task_runner_->PostTaskAndReply(
81 FROM_HERE, base::Bind(EnsureArchivesDirCreatedImpl, archives_dir_), 84 FROM_HERE, base::Bind(EnsureArchivesDirCreatedImpl, archives_dir_),
(...skipping 30 matching lines...) Expand all
112 } 115 }
113 116
114 void ArchiveManager::GetStorageStats( 117 void ArchiveManager::GetStorageStats(
115 const StorageStatsCallback& callback) const { 118 const StorageStatsCallback& callback) const {
116 task_runner_->PostTask( 119 task_runner_->PostTask(
117 FROM_HERE, base::Bind(GetStorageStatsImpl, archives_dir_, 120 FROM_HERE, base::Bind(GetStorageStatsImpl, archives_dir_,
118 base::ThreadTaskRunnerHandle::Get(), callback)); 121 base::ThreadTaskRunnerHandle::Get(), callback));
119 } 122 }
120 123
121 } // namespace offline_pages 124 } // namespace offline_pages
OLDNEW
« no previous file with comments | « components/offline_pages/archive_manager.h ('k') | components/offline_pages/offline_page_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698