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

Side by Side Diff: components/copresence/timed_map.h

Issue 1355063004: Template methods on Timer classes instead of the classes themselves. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: timer: fixcaller Created 5 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_COPRESENCE_TIMED_MAP_H_ 5 #ifndef COMPONENTS_COPRESENCE_TIMED_MAP_H_
6 #define COMPONENTS_COPRESENCE_TIMED_MAP_H_ 6 #define COMPONENTS_COPRESENCE_TIMED_MAP_H_
7 7
8 #include <map> 8 #include <map>
9 #include <queue> 9 #include <queue>
10 #include <utility> 10 #include <utility>
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 return left.second > right.second; 89 return left.second > right.second;
90 } 90 }
91 }; 91 };
92 92
93 using ExpiryQueue = std::priority_queue< 93 using ExpiryQueue = std::priority_queue<
94 KeyTimeTuple, std::vector<KeyTimeTuple>, EarliestFirstComparator>; 94 KeyTimeTuple, std::vector<KeyTimeTuple>, EarliestFirstComparator>;
95 95
96 const ValueType kEmptyValue; 96 const ValueType kEmptyValue;
97 97
98 scoped_ptr<base::TickClock> clock_; 98 scoped_ptr<base::TickClock> clock_;
99 base::RepeatingTimer<TimedMap> timer_; 99 base::RepeatingTimer timer_;
100 const base::TimeDelta lifetime_; 100 const base::TimeDelta lifetime_;
101 const size_t max_elements_; 101 const size_t max_elements_;
102 std::map<KeyType, ValueType> map_; 102 std::map<KeyType, ValueType> map_;
103 // Priority queue with our element keys ordered by the earliest expiring keys 103 // Priority queue with our element keys ordered by the earliest expiring keys
104 // first. 104 // first.
105 ExpiryQueue expiry_queue_; 105 ExpiryQueue expiry_queue_;
106 106
107 DISALLOW_COPY_AND_ASSIGN(TimedMap); 107 DISALLOW_COPY_AND_ASSIGN(TimedMap);
108 }; 108 };
109 109
110 } // namespace copresence 110 } // namespace copresence
111 111
112 #endif // COMPONENTS_COPRESENCE_TIMED_MAP_H_ 112 #endif // COMPONENTS_COPRESENCE_TIMED_MAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698