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 "chrome/browser/budget_service/budget_database.h" | 5 #include "chrome/browser/budget_service/budget_database.h" |
6 | 6 |
| 7 #include "base/memory/ptr_util.h" |
7 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
8 #include "base/time/clock.h" | 9 #include "base/time/clock.h" |
9 #include "base/time/default_clock.h" | 10 #include "base/time/default_clock.h" |
10 #include "chrome/browser/budget_service/budget.pb.h" | 11 #include "chrome/browser/budget_service/budget.pb.h" |
11 #include "chrome/browser/engagement/site_engagement_score.h" | 12 #include "chrome/browser/engagement/site_engagement_score.h" |
12 #include "chrome/browser/engagement/site_engagement_service.h" | 13 #include "chrome/browser/engagement/site_engagement_service.h" |
13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
14 #include "components/leveldb_proto/proto_database_impl.h" | 15 #include "components/leveldb_proto/proto_database_impl.h" |
15 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
16 #include "url/gurl.h" | 17 #include "url/gurl.h" |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 clock_->Now() - base::TimeDelta::FromHours(kBudgetDurationInHours)) { | 361 clock_->Now() - base::TimeDelta::FromHours(kBudgetDurationInHours)) { |
361 budget_map_.erase(origin); | 362 budget_map_.erase(origin); |
362 return true; | 363 return true; |
363 } | 364 } |
364 | 365 |
365 // Although some things may have expired, there are some chunks still valid. | 366 // 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 | 367 // Don't write to the DB now, write either when all chunks expire or when the |
367 // origin spends some budget. | 368 // origin spends some budget. |
368 return false; | 369 return false; |
369 } | 370 } |
OLD | NEW |