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

Unified Diff: chrome/browser/chromeos/gdata/gdata_operation_registry.h

Issue 10834027: Control the frequency of fileBrowserPrivate.onFileTransfersUpdated events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move the tap to operation registry. Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/gdata/gdata_operation_registry.h
diff --git a/chrome/browser/chromeos/gdata/gdata_operation_registry.h b/chrome/browser/chromeos/gdata/gdata_operation_registry.h
index 9749adaccd4ffe5498b2882de5e9fafd23490905..7e3424563ebffc85ea833eee2f00004f09d5d82a 100644
--- a/chrome/browser/chromeos/gdata/gdata_operation_registry.h
+++ b/chrome/browser/chromeos/gdata/gdata_operation_registry.h
@@ -143,6 +143,9 @@ class GDataOperationRegistry {
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
+ // Disables the notification suppression for testing purpose.
+ void DisableNotificationFrequencyControlForTest();
+
private:
// Handlers for notifications from Operations.
friend class Operation;
@@ -157,9 +160,18 @@ class GDataOperationRegistry {
bool IsFileTransferOperation(const Operation* operation) const;
+ // Controls the frequency of notifications, not to flood the listeners with
+ // too many events.
+ bool ShouldNotifyStatusNow(const ProgressStatusList& list);
+ // Sends notifications to the observers after checking that the frequency is
+ // not too high by ShouldNotifyStatusNow.
+ void NotifyStatusToObservers();
+
typedef IDMap<Operation, IDMapOwnPointer> OperationIDMap;
OperationIDMap in_flight_operations_;
ObserverList<Observer> observer_list_;
+ base::Time last_notification_;
+ bool do_notification_frequency_control_;
DISALLOW_COPY_AND_ASSIGN(GDataOperationRegistry);
};

Powered by Google App Engine
This is Rietveld 408576698