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

Side by Side Diff: chrome/browser/budget_service/budget_database.cc

Issue 2487073004: Change the default budget expiration window to 4 days from 10 days. (Closed)
Patch Set: typo 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 | « no previous file | chrome/browser/budget_service/budget_database_unittest.cc » ('j') | 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 "chrome/browser/budget_service/budget_database.h" 5 #include "chrome/browser/budget_service/budget_database.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/time/clock.h" 8 #include "base/time/clock.h"
9 #include "base/time/default_clock.h" 9 #include "base/time/default_clock.h"
10 #include "chrome/browser/budget_service/budget.pb.h" 10 #include "chrome/browser/budget_service/budget.pb.h"
11 #include "chrome/browser/engagement/site_engagement_score.h" 11 #include "chrome/browser/engagement/site_engagement_score.h"
12 #include "chrome/browser/engagement/site_engagement_service.h" 12 #include "chrome/browser/engagement/site_engagement_service.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "components/leveldb_proto/proto_database_impl.h" 14 #include "components/leveldb_proto/proto_database_impl.h"
15 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
16 #include "url/gurl.h" 16 #include "url/gurl.h"
17 #include "url/origin.h" 17 #include "url/origin.h"
18 18
19 using content::BrowserThread; 19 using content::BrowserThread;
20 20
21 namespace { 21 namespace {
22 22
23 // UMA are logged for the database with this string as part of the name. 23 // UMA are logged for the database with this string as part of the name.
24 // They will be LevelDB.*.BudgetManager. Changes here should be synchronized 24 // They will be LevelDB.*.BudgetManager. Changes here should be synchronized
25 // with histograms.xml. 25 // with histograms.xml.
26 const char kDatabaseUMAName[] = "BudgetManager"; 26 const char kDatabaseUMAName[] = "BudgetManager";
27 27
28 // The default amount of time during which a budget will be valid. 28 // The default amount of time during which a budget will be valid.
29 // This is 10 days = 240 hours. 29 // This is 4 days = 96 hours.
30 constexpr double kBudgetDurationInHours = 240; 30 constexpr double kBudgetDurationInHours = 96;
31 31
32 } // namespace 32 } // namespace
33 33
34 BudgetDatabase::BudgetInfo::BudgetInfo() {} 34 BudgetDatabase::BudgetInfo::BudgetInfo() {}
35 35
36 BudgetDatabase::BudgetInfo::BudgetInfo(const BudgetInfo&& other) 36 BudgetDatabase::BudgetInfo::BudgetInfo(const BudgetInfo&& other)
37 : last_engagement_award(other.last_engagement_award) { 37 : last_engagement_award(other.last_engagement_award) {
38 chunks = std::move(other.chunks); 38 chunks = std::move(other.chunks);
39 } 39 }
40 40
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 clock_->Now() - base::TimeDelta::FromHours(kBudgetDurationInHours)) { 360 clock_->Now() - base::TimeDelta::FromHours(kBudgetDurationInHours)) {
361 budget_map_.erase(origin); 361 budget_map_.erase(origin);
362 return true; 362 return true;
363 } 363 }
364 364
365 // Although some things may have expired, there are some chunks still valid. 365 // Although some things may have expired, there are some chunks still valid.
366 // Don't write to the DB now, write either when all chunks expire or when the 366 // Don't write to the DB now, write either when all chunks expire or when the
367 // origin spends some budget. 367 // origin spends some budget.
368 return false; 368 return false;
369 } 369 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/budget_service/budget_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698