OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "net/tools/quic/quic_time_wait_list_manager.h" | 5 #include "net/tools/quic/quic_time_wait_list_manager.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 | 8 |
9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 // A very simple alarm that just informs the QuicTimeWaitListManager to clean | 31 // A very simple alarm that just informs the QuicTimeWaitListManager to clean |
32 // up old guids. This alarm should be unregistered and deleted before the | 32 // up old guids. This alarm should be unregistered and deleted before the |
33 // QuicTimeWaitListManager is deleted. | 33 // QuicTimeWaitListManager is deleted. |
34 class GuidCleanUpAlarm : public EpollAlarm { | 34 class GuidCleanUpAlarm : public EpollAlarm { |
35 public: | 35 public: |
36 explicit GuidCleanUpAlarm(QuicTimeWaitListManager* time_wait_list_manager) | 36 explicit GuidCleanUpAlarm(QuicTimeWaitListManager* time_wait_list_manager) |
37 : time_wait_list_manager_(time_wait_list_manager) { | 37 : time_wait_list_manager_(time_wait_list_manager) { |
38 } | 38 } |
39 | 39 |
40 virtual int64 OnAlarm() { | 40 virtual int64 OnAlarm() OVERRIDE { |
41 EpollAlarm::OnAlarm(); | 41 EpollAlarm::OnAlarm(); |
42 time_wait_list_manager_->CleanUpOldGuids(); | 42 time_wait_list_manager_->CleanUpOldGuids(); |
43 // Let the time wait manager register the alarm at appropriate time. | 43 // Let the time wait manager register the alarm at appropriate time. |
44 return 0; | 44 return 0; |
45 } | 45 } |
46 | 46 |
47 private: | 47 private: |
48 // Not owned. | 48 // Not owned. |
49 QuicTimeWaitListManager* time_wait_list_manager_; | 49 QuicTimeWaitListManager* time_wait_list_manager_; |
50 }; | 50 }; |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 // This guid has lived its age, retire it now. | 301 // This guid has lived its age, retire it now. |
302 guid_map_.erase(oldest_guid->guid); | 302 guid_map_.erase(oldest_guid->guid); |
303 time_ordered_guid_list_.pop_front(); | 303 time_ordered_guid_list_.pop_front(); |
304 delete oldest_guid; | 304 delete oldest_guid; |
305 } | 305 } |
306 SetGuidCleanUpAlarm(); | 306 SetGuidCleanUpAlarm(); |
307 } | 307 } |
308 | 308 |
309 } // namespace tools | 309 } // namespace tools |
310 } // namespace net | 310 } // namespace net |
OLD | NEW |