OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef CHROME_BROWSER_BROWSING_DATA_CACHE_COUNTER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_CACHE_COUNTER_H_ |
6 #define CHROME_BROWSER_BROWSING_DATA_CACHE_COUNTER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_CACHE_COUNTER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 explicit CacheCounter(Profile* profile); | 38 explicit CacheCounter(Profile* profile); |
39 ~CacheCounter() override; | 39 ~CacheCounter() override; |
40 | 40 |
41 const char* GetPrefName() const override; | 41 const char* GetPrefName() const override; |
42 | 42 |
43 // Whether this counter awaits the calculation result callback. | 43 // Whether this counter awaits the calculation result callback. |
44 // Used only for testing. | 44 // Used only for testing. |
45 bool Pending(); | 45 bool Pending(); |
46 | 46 |
| 47 // Used only for testing. |
| 48 void SetTimeout(base::TimeDelta timeout); |
| 49 |
47 private: | 50 private: |
48 void Count() override; | 51 void Count() override; |
49 void OnCacheSizeCalculated(bool is_upper_limit, int64_t bytes); | 52 void OnCacheSizeCalculated(bool is_upper_limit, int64_t bytes); |
50 void FetchEstimate( | 53 void FetchEstimate( |
51 base::WeakPtr<browsing_data::ConditionalCacheCountingHelper>); | 54 base::WeakPtr<browsing_data::ConditionalCacheCountingHelper>); |
52 | 55 |
53 Profile* profile_; | 56 Profile* profile_; |
54 bool pending_; | 57 bool pending_; |
| 58 base::TimeDelta timeout_; |
55 | 59 |
56 base::WeakPtrFactory<CacheCounter> weak_ptr_factory_; | 60 base::WeakPtrFactory<CacheCounter> weak_ptr_factory_; |
57 | 61 |
58 }; | 62 }; |
59 | 63 |
60 #endif // CHROME_BROWSER_BROWSING_DATA_CACHE_COUNTER_H_ | 64 #endif // CHROME_BROWSER_BROWSING_DATA_CACHE_COUNTER_H_ |
OLD | NEW |