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

Side by Side Diff: components/browsing_data/core/counters/browsing_data_counter.h

Issue 2867033002: Fix BrowsingDataCounter race condition (Closed)
Patch Set: Created 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 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 COMPONENTS_BROWSING_DATA_CORE_COUNTERS_BROWSING_DATA_COUNTER_H_ 5 #ifndef COMPONENTS_BROWSING_DATA_CORE_COUNTERS_BROWSING_DATA_COUNTER_H_
6 #define COMPONENTS_BROWSING_DATA_CORE_COUNTERS_BROWSING_DATA_COUNTER_H_ 6 #define COMPONENTS_BROWSING_DATA_CORE_COUNTERS_BROWSING_DATA_COUNTER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 base::Time GetPeriodStart(); 121 base::Time GetPeriodStart();
122 122
123 // Returns if this counter belongs to a preference on the default, basic or 123 // Returns if this counter belongs to a preference on the default, basic or
124 // advanced CBD tab. 124 // advanced CBD tab.
125 ClearBrowsingDataTab GetTab() const; 125 ClearBrowsingDataTab GetTab() const;
126 126
127 private: 127 private:
128 // Called after the class is initialized by calling |Init|. 128 // Called after the class is initialized by calling |Init|.
129 virtual void OnInitialized(); 129 virtual void OnInitialized();
130 130
131 // Count the data. 131 // Count the data. Call ReportResult() when finished. Tasks that are still
132 // running should be cancelled to avoid reporting old results.
132 virtual void Count() = 0; 133 virtual void Count() = 0;
133 134
134 // State transition methods. 135 // State transition methods.
135 void TransitionToShowCalculating(); 136 void TransitionToShowCalculating();
136 void TransitionToReadyToReportResult(); 137 void TransitionToReadyToReportResult();
137 138
138 // Indicates if this counter belongs to a preference on the basic CBD tab. 139 // Indicates if this counter belongs to a preference on the basic CBD tab.
139 ClearBrowsingDataTab clear_browsing_data_tab_; 140 ClearBrowsingDataTab clear_browsing_data_tab_;
140 141
141 // The callback that will be called when the UI should be updated with a new 142 // The callback that will be called when the UI should be updated with a new
(...skipping 21 matching lines...) Expand all
163 std::unique_ptr<Result> staged_result_; 164 std::unique_ptr<Result> staged_result_;
164 165
165 // A timer to time the RESTARTED->SHOW_CALCULATION and 166 // A timer to time the RESTARTED->SHOW_CALCULATION and
166 // SHOW_CALCULATION->READY_TO_REPORT_RESULT state transitions. 167 // SHOW_CALCULATION->READY_TO_REPORT_RESULT state transitions.
167 base::OneShotTimer timer_; 168 base::OneShotTimer timer_;
168 }; 169 };
169 170
170 } // namespace browsing_data 171 } // namespace browsing_data
171 172
172 #endif // COMPONENTS_BROWSING_DATA_CORE_COUNTERS_BROWSING_DATA_COUNTER_H_ 173 #endif // COMPONENTS_BROWSING_DATA_CORE_COUNTERS_BROWSING_DATA_COUNTER_H_
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data/site_data_counter.cc ('k') | components/browsing_data/core/counters/history_counter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698