| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 SYNC_NOTIFIER_ACK_TRACKER_H_ | 5 #ifndef SYNC_NOTIFIER_ACK_TRACKER_H_ |
| 6 #define SYNC_NOTIFIER_ACK_TRACKER_H_ | 6 #define SYNC_NOTIFIER_ACK_TRACKER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "base/timer.h" | 15 #include "base/timer.h" |
| 16 #include "net/base/backoff_entry.h" | 16 #include "net/base/backoff_entry.h" |
| 17 #include "sync/base/sync_export.h" |
| 17 #include "sync/notifier/invalidation_util.h" | 18 #include "sync/notifier/invalidation_util.h" |
| 18 | 19 |
| 19 namespace syncer { | 20 namespace syncer { |
| 20 | 21 |
| 21 // A simple class that tracks sets of object IDs that have not yet been | 22 // A simple class that tracks sets of object IDs that have not yet been |
| 22 // acknowledged. Internally, it manages timeouts for the tracked object IDs and | 23 // acknowledged. Internally, it manages timeouts for the tracked object IDs and |
| 23 // periodically triggers a callback for each timeout period. The timeout is a | 24 // periodically triggers a callback for each timeout period. The timeout is a |
| 24 // simple exponentially increasing time that starts at 60 seconds and is capped | 25 // simple exponentially increasing time that starts at 60 seconds and is capped |
| 25 // at 600 seconds. | 26 // at 600 seconds. |
| 26 class AckTracker { | 27 class SYNC_EXPORT_PRIVATE AckTracker { |
| 27 public: | 28 public: |
| 28 class Delegate { | 29 class SYNC_EXPORT_PRIVATE Delegate { |
| 29 public: | 30 public: |
| 30 virtual ~Delegate(); | 31 virtual ~Delegate(); |
| 31 | 32 |
| 32 // |ids| contains all object IDs that have timed out in this time interval. | 33 // |ids| contains all object IDs that have timed out in this time interval. |
| 33 virtual void OnTimeout(const ObjectIdSet& ids) = 0; | 34 virtual void OnTimeout(const ObjectIdSet& ids) = 0; |
| 34 }; | 35 }; |
| 35 | 36 |
| 36 typedef base::Callback<base::TimeTicks()> NowCallback; | 37 typedef base::Callback<base::TimeTicks()> NowCallback; |
| 37 typedef base::Callback<scoped_ptr<net::BackoffEntry>( | 38 typedef base::Callback<scoped_ptr<net::BackoffEntry>( |
| 38 const net::BackoffEntry::Policy* const)> CreateBackoffEntryCallback; | 39 const net::BackoffEntry::Policy* const)> CreateBackoffEntryCallback; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 std::multimap<base::TimeTicks, Entry*> queue_; | 99 std::multimap<base::TimeTicks, Entry*> queue_; |
| 99 | 100 |
| 100 base::ThreadChecker thread_checker_; | 101 base::ThreadChecker thread_checker_; |
| 101 | 102 |
| 102 DISALLOW_COPY_AND_ASSIGN(AckTracker); | 103 DISALLOW_COPY_AND_ASSIGN(AckTracker); |
| 103 }; | 104 }; |
| 104 | 105 |
| 105 } // namespace syncer | 106 } // namespace syncer |
| 106 | 107 |
| 107 #endif // SYNC_NOTIFIER_ACK_TRACKER_H_ | 108 #endif // SYNC_NOTIFIER_ACK_TRACKER_H_ |
| OLD | NEW |