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

Side by Side Diff: src/byte_counter.h

Issue 6250171: cashew: reset local counter on plan transition (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cashew.git@master
Patch Set: Created 9 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/data_plan.h » ('j') | src/data_plan.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS 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 SRC_BYTE_COUNTER_H_ 5 #ifndef SRC_BYTE_COUNTER_H_
6 #define SRC_BYTE_COUNTER_H_ 6 #define SRC_BYTE_COUNTER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include <base/basictypes.h> // NOLINT 10 #include <base/basictypes.h> // NOLINT
11 11
12 namespace cashew { 12 namespace cashew {
13 13
14 class ByteCounterDelegate; 14 class ByteCounterDelegate;
15 15
16 // interface for byte counter 16 // interface for byte counter
17 class ByteCounter { 17 class ByteCounter {
18 public: 18 public:
19 virtual ~ByteCounter() {} 19 virtual ~ByteCounter() {}
20 20
21 // to what interface is this counter attached? 21 // to what interface is this counter attached?
22 virtual const std::string& GetInterface() const = 0; 22 virtual const std::string& GetInterface() const = 0;
23 23
24 // received bytes 24 // received bytes
25 virtual uint64 GetRxBytes() const = 0; 25 virtual uint64 GetRxBytes() const = 0;
26 virtual void SetRxBytes(uint64 rx_bytes) = 0;
26 27
27 // transmitted bytes 28 // transmitted bytes
28 virtual uint64 GetTxBytes() const = 0; 29 virtual uint64 GetTxBytes() const = 0;
30 virtual void SetTxBytes(uint64 tx_bytes) = 0;
29 31
30 // set delegate interface that will receive counter updates 32 // set delegate interface that will receive counter updates
31 // it's ok to clear this by setting it to NULL 33 // it's ok to clear this by setting it to NULL
32 virtual void SetDelegate(ByteCounterDelegate *delegate) = 0; 34 virtual void SetDelegate(ByteCounterDelegate *delegate) = 0;
33 35
34 // factory 36 // factory
35 // return appropriate concrete impl 37 // return appropriate concrete impl
36 // caller owns returned ByteCounter and is responsible for deleting it 38 // caller owns returned ByteCounter and is responsible for deleting it
37 static ByteCounter* NewByteCounter(const std::string& interface); 39 static ByteCounter* NewByteCounter(const std::string& interface);
38 }; 40 };
39 41
40 // interface for delegates 42 // interface to be implemented by delegates
41 class ByteCounterDelegate { 43 class ByteCounterDelegate {
42 public: 44 public:
43 virtual ~ByteCounterDelegate() {} 45 virtual ~ByteCounterDelegate() {}
44 46
45 // called when byte counter is updated 47 // called when byte counter is updated
46 virtual void OnByteCounterUpdate(const ByteCounter *counter, 48 virtual void OnByteCounterUpdate(const ByteCounter *counter,
47 uint64 rx_bytes, uint64 tx_bytes) = 0; 49 uint64 rx_bytes, uint64 tx_bytes) = 0;
48 }; 50 };
49 51
50 } // namespace cashew 52 } // namespace cashew
51 53
52 #endif // SRC_BYTE_COUNTER_H_ 54 #endif // SRC_BYTE_COUNTER_H_
OLDNEW
« no previous file with comments | « no previous file | src/data_plan.h » ('j') | src/data_plan.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698