1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_THROTTLER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_THROTTLER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "content/common/content_export.h"
18 // A very simple message throtller. User of this class must drop the packet if
19 // DropNextPacket returns false for that packet. This method verifies the
20 // current sendrate against the required sendrate.
22 class CONTENT_EXPORT P2PMessageThrottler
{
24 P2PMessageThrottler();
25 virtual ~P2PMessageThrottler();
27 void SetTiming(scoped_ptr
<rtc::Timing
> timing
);
28 bool DropNextPacket(size_t packet_len
);
29 void SetSendIceBandwidth(int bandwith_kbps
);
32 scoped_ptr
<rtc::Timing
> timing_
;
33 scoped_ptr
<rtc::RateLimiter
> rate_limiter_
;
35 DISALLOW_COPY_AND_ASSIGN(P2PMessageThrottler
);
38 } // namespace content
40 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_THROTTLER_H_