| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_RENDERER_SCHEDULER_RESOURCE_DISPATCH_THROTTLER_H_ | 5 #ifndef CONTENT_RENDERER_SCHEDULER_RESOURCE_DISPATCH_THROTTLER_H_ |
| 6 #define CONTENT_RENDERER_SCHEDULER_RESOURCE_DISPATCH_THROTTLER_H_ | 6 #define CONTENT_RENDERER_SCHEDULER_RESOURCE_DISPATCH_THROTTLER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <deque> | 10 #include <deque> |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 friend class ResourceDispatchThrottlerForTest; | 48 friend class ResourceDispatchThrottlerForTest; |
| 49 | 49 |
| 50 // Virtual for testing. | 50 // Virtual for testing. |
| 51 virtual base::TimeTicks Now() const; | 51 virtual base::TimeTicks Now() const; |
| 52 virtual void ScheduleFlush(); | 52 virtual void ScheduleFlush(); |
| 53 | 53 |
| 54 void Flush(); | 54 void Flush(); |
| 55 void FlushAll(); | 55 void FlushAll(); |
| 56 void LogFlush(); |
| 56 bool ForwardMessage(IPC::Message* msg); | 57 bool ForwardMessage(IPC::Message* msg); |
| 57 | 58 |
| 58 base::ThreadChecker thread_checker_; | 59 base::ThreadChecker thread_checker_; |
| 59 | 60 |
| 60 IPC::Sender* const proxied_sender_; | 61 IPC::Sender* const proxied_sender_; |
| 61 scheduler::RendererScheduler* const scheduler_; | 62 scheduler::RendererScheduler* const scheduler_; |
| 62 const base::TimeDelta flush_period_; | 63 const base::TimeDelta flush_period_; |
| 63 const uint32_t max_requests_per_flush_; | 64 const uint32_t max_requests_per_flush_; |
| 64 | 65 |
| 65 base::Timer flush_timer_; | 66 base::Timer flush_timer_; |
| 66 base::TimeTicks last_sent_request_time_; | 67 base::TimeTicks last_flush_time_; |
| 67 uint32_t sent_requests_since_last_flush_; | 68 uint32_t sent_requests_since_last_flush_; |
| 68 std::deque<IPC::Message*> throttled_messages_; | 69 std::deque<IPC::Message*> throttled_messages_; |
| 69 | 70 |
| 70 DISALLOW_COPY_AND_ASSIGN(ResourceDispatchThrottler); | 71 DISALLOW_COPY_AND_ASSIGN(ResourceDispatchThrottler); |
| 71 }; | 72 }; |
| 72 | 73 |
| 73 } // namespace content | 74 } // namespace content |
| 74 | 75 |
| 75 #endif // CONTENT_RENDERER_SCHEDULER_RESOURCE_DISPATCH_THROTTLER_H_ | 76 #endif // CONTENT_RENDERER_SCHEDULER_RESOURCE_DISPATCH_THROTTLER_H_ |
| OLD | NEW |