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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_quota_helper_impl.h

Issue 1117583003: [chrome/browser/browsing_data] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nit Created 5 years, 7 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_BROWSING_DATA_QUOTA_HELPER_IMPL_H_ 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_QUOTA_HELPER_IMPL_H_
6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_QUOTA_HELPER_IMPL_H_ 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_QUOTA_HELPER_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 13 matching lines...) Expand all
24 24
25 // Implementation of BrowsingDataQuotaHelper. Since a client of 25 // Implementation of BrowsingDataQuotaHelper. Since a client of
26 // BrowsingDataQuotaHelper should live in UI thread and QuotaManager lives in 26 // BrowsingDataQuotaHelper should live in UI thread and QuotaManager lives in
27 // IO thread, we have to communicate over thread using PostTask. 27 // IO thread, we have to communicate over thread using PostTask.
28 class BrowsingDataQuotaHelperImpl : public BrowsingDataQuotaHelper { 28 class BrowsingDataQuotaHelperImpl : public BrowsingDataQuotaHelper {
29 public: 29 public:
30 void StartFetching(const FetchResultCallback& callback) override; 30 void StartFetching(const FetchResultCallback& callback) override;
31 void RevokeHostQuota(const std::string& host) override; 31 void RevokeHostQuota(const std::string& host) override;
32 32
33 private: 33 private:
34 BrowsingDataQuotaHelperImpl(base::MessageLoopProxy* ui_thread, 34 BrowsingDataQuotaHelperImpl(base::SingleThreadTaskRunner* ui_thread,
35 base::MessageLoopProxy* io_thread, 35 base::SingleThreadTaskRunner* io_thread,
36 storage::QuotaManager* quota_manager); 36 storage::QuotaManager* quota_manager);
37 ~BrowsingDataQuotaHelperImpl() override; 37 ~BrowsingDataQuotaHelperImpl() override;
38 38
39 void FetchQuotaInfo(); 39 void FetchQuotaInfo();
40 40
41 // Callback function for GetOriginModifiedSince. 41 // Callback function for GetOriginModifiedSince.
42 void GotOrigins(const std::set<GURL>& origins, storage::StorageType type); 42 void GotOrigins(const std::set<GURL>& origins, storage::StorageType type);
43 43
44 void ProcessPendingHosts(); 44 void ProcessPendingHosts();
45 void GetHostUsage(const std::string& host, storage::StorageType type); 45 void GetHostUsage(const std::string& host, storage::StorageType type);
46 46
47 // Callback function for GetHostUsage. 47 // Callback function for GetHostUsage.
48 void GotHostUsage(const std::string& host, 48 void GotHostUsage(const std::string& host,
49 storage::StorageType type, 49 storage::StorageType type,
50 int64 usage); 50 int64 usage);
51 51
52 void OnComplete(); 52 void OnComplete();
53 void DidRevokeHostQuota(storage::QuotaStatusCode status, int64 quota); 53 void DidRevokeHostQuota(storage::QuotaStatusCode status, int64 quota);
54 54
55 scoped_refptr<storage::QuotaManager> quota_manager_; 55 scoped_refptr<storage::QuotaManager> quota_manager_;
56 FetchResultCallback callback_; 56 FetchResultCallback callback_;
57 57
58 typedef std::set<std::pair<std::string, storage::StorageType> > PendingHosts; 58 typedef std::set<std::pair<std::string, storage::StorageType> > PendingHosts;
59 PendingHosts pending_hosts_; 59 PendingHosts pending_hosts_;
60 std::map<std::string, QuotaInfo> quota_info_; 60 std::map<std::string, QuotaInfo> quota_info_;
61 61
62 bool is_fetching_; 62 bool is_fetching_;
63 63
64 scoped_refptr<base::MessageLoopProxy> ui_thread_; 64 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_;
65 scoped_refptr<base::MessageLoopProxy> io_thread_; 65 scoped_refptr<base::SingleThreadTaskRunner> io_thread_;
66 base::WeakPtrFactory<BrowsingDataQuotaHelperImpl> weak_factory_; 66 base::WeakPtrFactory<BrowsingDataQuotaHelperImpl> weak_factory_;
67 67
68 friend class BrowsingDataQuotaHelper; 68 friend class BrowsingDataQuotaHelper;
69 friend class BrowsingDataQuotaHelperTest; 69 friend class BrowsingDataQuotaHelperTest;
70 70
71 DISALLOW_COPY_AND_ASSIGN(BrowsingDataQuotaHelperImpl); 71 DISALLOW_COPY_AND_ASSIGN(BrowsingDataQuotaHelperImpl);
72 }; 72 };
73 73
74 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_QUOTA_HELPER_IMPL_H_ 74 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_QUOTA_HELPER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698