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

Unified Diff: sync/engine/throttled_data_type_tracker.h

Issue 10454105: sync: Refactor per-datatype throttling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up and rebased Created 8 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 side-by-side diff with in-line comments
Download patch
Index: sync/engine/throttled_data_type_tracker.h
diff --git a/sync/engine/throttled_data_type_tracker.h b/sync/engine/throttled_data_type_tracker.h
new file mode 100644
index 0000000000000000000000000000000000000000..8f96d026993a39a64fc11aadb6f15fee73c54bf0
--- /dev/null
+++ b/sync/engine/throttled_data_type_tracker.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SYNC_ENGINE_THROTTLED_DATA_TYPE_TRACKER_H_
+#define SYNC_ENGINE_THROTTLED_DATA_TYPE_TRACKER_H_
+#pragma once
+
+#include <map>
+
+#include "base/gtest_prod_util.h"
+#include "sync/syncable/model_type.h"
+
+namespace browser_sync {
+
+class AllStatus;
+
+class ThrottledDataTypeTracker {
+ public:
+ ThrottledDataTypeTracker(AllStatus* allstatus);
tim (not reviewing) 2012/06/11 18:53:46 Single param ctor should be 'explicit'. Also ov
rlarocque 2012/06/11 23:28:51 It's just for the NULL case. By the way, I reme
tim (not reviewing) 2012/06/12 00:12:20 I don't honestly feel like two classes are justifi
+ ThrottledDataTypeTracker();
+ ~ThrottledDataTypeTracker();
+
+ void SetUnthrottleTime(syncable::ModelTypeSet types,
tim (not reviewing) 2012/06/11 18:53:46 Comments on these functions would be nice.
rlarocque 2012/06/11 23:28:51 Done.
+ const base::TimeTicks& time);
+ void PruneUnthrottledTypes(const base::TimeTicks& time);
+ syncable::ModelTypeSet GetThrottledTypes() const;
+
+ private:
+ FRIEND_TEST_ALL_PREFIXES(ThrottledDataTypeTrackerTest,
+ AddUnthrottleTimeTest);
+ FRIEND_TEST_ALL_PREFIXES(ThrottledDataTypeTrackerTest,
+ GetCurrentlyThrottledTypesTest);
+
+ typedef std::map<syncable::ModelType, base::TimeTicks> UnthrottleTimes;
+
+ // This is a map from throttled data types to the time at which they can be
+ // unthrottled.
+ UnthrottleTimes unthrottle_times_;
+
+ AllStatus* allstatus_;
tim (not reviewing) 2012/06/11 18:53:46 DISALLOW_COPY_AND_ASSIGN
rlarocque 2012/06/11 23:28:51 Done.
+};
+
+} // namespace browser_sync
+
+#endif // SYNC_ENGINE_THROTTLED_DATA_TYPE_TRACKER_H_

Powered by Google App Engine
This is Rietveld 408576698