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

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

Issue 2505163004: Move const double data out of header file (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « components/offline_pages/offline_page_storage_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "components/offline_pages/offline_page_storage_manager.h" 5 #include "components/offline_pages/offline_page_storage_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/time/clock.h" 10 #include "base/time/clock.h"
11 #include "base/time/default_clock.h" 11 #include "base/time/default_clock.h"
12 #include "components/offline_pages/client_policy_controller.h" 12 #include "components/offline_pages/client_policy_controller.h"
13 #include "components/offline_pages/offline_page_client_policy.h" 13 #include "components/offline_pages/offline_page_client_policy.h"
14 #include "components/offline_pages/offline_page_item.h" 14 #include "components/offline_pages/offline_page_item.h"
15 #include "components/offline_pages/offline_page_model.h" 15 #include "components/offline_pages/offline_page_model.h"
16 16
17 using LifetimeType = offline_pages::LifetimePolicy::LifetimeType; 17 using LifetimeType = offline_pages::LifetimePolicy::LifetimeType;
18 18
19 namespace offline_pages { 19 namespace offline_pages {
20 20
21 // Maximum % of total available storage that will be occupied by offline pages
fgorski 2016/11/17 17:10:49 drop docs from cc. They will be hard to keep in sy
brucedawson 2016/11/17 17:28:56 Done.
22 // before a storage clearup.
23 extern const double kOfflinePageStorageLimit = 0.3;
fgorski 2016/11/17 17:10:49 drop the externs from cc. I don't think these are
brucedawson 2016/11/17 17:28:56 They are actually required. 'const' implies 'stati
24 // The target % of storage usage we try to reach below when expiring pages.
25 extern const double kOfflinePageStorageClearThreshold = 0.1;
26 // The time that the storage cleanup will be triggered again since the last one.
27 extern const base::TimeDelta kClearStorageInterval =
28 base::TimeDelta::FromMinutes(10);
29 // The time that the page record will be removed from the store since the page
30 // has been expired.
31 extern const base::TimeDelta kRemovePageItemInterval =
32 base::TimeDelta::FromDays(21);
33
21 OfflinePageStorageManager::OfflinePageStorageManager( 34 OfflinePageStorageManager::OfflinePageStorageManager(
22 OfflinePageModel* model, 35 OfflinePageModel* model,
23 ClientPolicyController* policy_controller, 36 ClientPolicyController* policy_controller,
24 ArchiveManager* archive_manager) 37 ArchiveManager* archive_manager)
25 : model_(model), 38 : model_(model),
26 policy_controller_(policy_controller), 39 policy_controller_(policy_controller),
27 archive_manager_(archive_manager), 40 archive_manager_(archive_manager),
28 clock_(new base::DefaultClock()), 41 clock_(new base::DefaultClock()),
29 weak_ptr_factory_(this) {} 42 weak_ptr_factory_(this) {}
30 43
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 policy_controller_->GetPolicy(page.client_id.name_space).lifetime_policy; 218 policy_controller_->GetPolicy(page.client_id.name_space).lifetime_policy;
206 return policy.lifetime_type == LifetimeType::TEMPORARY && 219 return policy.lifetime_type == LifetimeType::TEMPORARY &&
207 clear_time_ - page.last_access_time >= policy.expiration_period; 220 clear_time_ - page.last_access_time >= policy.expiration_period;
208 } 221 }
209 222
210 bool OfflinePageStorageManager::IsInProgress() const { 223 bool OfflinePageStorageManager::IsInProgress() const {
211 return clear_time_ > last_clear_time_; 224 return clear_time_ > last_clear_time_;
212 } 225 }
213 226
214 } // namespace offline_pages 227 } // namespace offline_pages
OLDNEW
« no previous file with comments | « components/offline_pages/offline_page_storage_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698