Index: chrome/browser/browsing_data/cookies_tree_model.h |
diff --git a/chrome/browser/browsing_data/cookies_tree_model.h b/chrome/browser/browsing_data/cookies_tree_model.h |
index 929044fc7e153d81a3587a5808dead76d32d1959..b5f8e5b50d973ef9dad1768455d3d3d66f9ab684 100644 |
--- a/chrome/browser/browsing_data/cookies_tree_model.h |
+++ b/chrome/browser/browsing_data/cookies_tree_model.h |
@@ -719,6 +719,12 @@ class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { |
return data_container_.get(); |
} |
+ // Set the number of |batches_expected| this class should expect to receive. |
+ // If |reset| is true, then this is a new set of batches, but if false, then |
+ // this is a revised number (batches originally counted should no longer be |
+ // expected). |
+ void SetBatchExpectation(int batches_expected, bool reset); |
+ |
private: |
enum CookieIconIndex { |
ORIGIN = 0, |
@@ -726,9 +732,24 @@ class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { |
DATABASE = 2 |
}; |
+ // Reset the counters for batches. |
+ void ResetBatches(); |
+ |
+ // Record that one batch has been delivered. |
+ void RecordBatchSeen(); |
+ |
+ // Record that one batch has begun processing. If this is the first batch then |
+ // observers will be notified that batch processing has started. |
void NotifyObserverBeginBatch(); |
+ |
+ // Record that one batch has finished processing. If this is the last batch |
+ // then observers will be notified that batch processing has ended. |
void NotifyObserverEndBatch(); |
+ // Notifies observers if expected batch count has been delievered and all |
+ // batches have finished processing. |
+ void MaybeNotifyBatchesEnded(); |
+ |
void PopulateAppCacheInfoWithFilter(LocalDataContainer* container, |
ScopedBatchUpdateNotifier* notifier, |
const base::string16& filter); |
@@ -782,10 +803,19 @@ class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { |
// Otherwise, use the CanonicalCookie::Domain attribute. |
bool group_by_cookie_source_; |
- // If this is non-zero, then this model is batching updates (there's a lot of |
- // notifications coming down the pipe). This is an integer is used to balance |
- // calls to Begin/EndBatch() if they're called in a nested manner. |
- int batch_update_; |
+ // Keeps track of how many batches the consumer of this class says it is going |
+ // to send. |
+ int batches_expected_; |
+ |
+ // Keeps track of how many batches we've seen. |
+ int batches_seen_; |
+ |
+ // Counts how many batches have started already. If this is non-zero and lower |
+ // than batches_ended_, then this model is still batching updates. |
+ int batches_started_; |
+ |
+ // Counts how many batches have finished. |
+ int batches_ended_; |
}; |
#endif // CHROME_BROWSER_BROWSING_DATA_COOKIES_TREE_MODEL_H_ |