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

Side by Side Diff: ios/chrome/browser/browsing_data/cache_counter.h

Issue 2354643002: Add a cache counter for iOS. (Closed)
Patch Set: Fix another hangup. Created 4 years, 2 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 (c) 2015 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 #ifndef CHROME_BROWSER_BROWSING_DATA_CACHE_COUNTER_H_ 5 #ifndef IOS_CHROME_BROWSER_BROWSING_DATA_CACHE_COUNTER_H_
6 #define CHROME_BROWSER_BROWSING_DATA_CACHE_COUNTER_H_ 6 #define IOS_CHROME_BROWSER_BROWSING_DATA_CACHE_COUNTER_H_
7
8 #include <stdint.h>
9 7
10 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
11 #include "components/browsing_data/core/counters/browsing_data_counter.h" 9 #include "components/browsing_data/core/counters/browsing_data_counter.h"
12 10
13 class Profile; 11 namespace web {
12 class BrowserState;
13 }
14 14
15 class CacheCounter : public browsing_data::BrowsingDataCounter { 15 class CacheCounter : public browsing_data::BrowsingDataCounter {
16 public: 16 public:
17 explicit CacheCounter(Profile* profile); 17 explicit CacheCounter(web::BrowserState* browser_state);
18 ~CacheCounter() override; 18 ~CacheCounter() override;
19 19
20 // Whether this counter awaits the calculation result callback. 20 // Whether this counter awaits the calculation result callback.
21 // Used only for testing. 21 // Used only for testing.
22 bool Pending(); 22 bool pending() { return pending_; }
23 23
24 // BrowsingDataCounter implementation:
24 const char* GetPrefName() const override; 25 const char* GetPrefName() const override;
25 26
26 private: 27 private:
27 Profile* profile_; 28 // BrowsingDataCounter implementation:
ioanap 2016/09/22 13:39:52 nit: s/:/.
msramek 2016/09/22 17:02:40 Done, here and above. This was actually intentiona
29 void Count() override;
30
31 void OnCacheSizeCalculated(int result_bytes);
32
28 bool pending_; 33 bool pending_;
29 34
35 web::BrowserState* browser_state_;
36
30 base::WeakPtrFactory<CacheCounter> weak_ptr_factory_; 37 base::WeakPtrFactory<CacheCounter> weak_ptr_factory_;
31
32 void Count() override;
33 void OnCacheSizeCalculated(int64_t bytes);
34 }; 38 };
35 39
36 #endif // CHROME_BROWSER_BROWSING_DATA_CACHE_COUNTER_H_ 40 #endif // IOS_CHROME_BROWSER_BROWSING_DATA_CACHE_COUNTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698