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

Unified Diff: src/data_plan.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, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/byte_counter.h ('k') | src/data_plan.cc » ('j') | src/device.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/data_plan.h
diff --git a/src/data_plan.h b/src/data_plan.h
index 4a1fe50a6bf376068ceabf4d0d0bd5ce66441895..af242bb759935294cd2672086630661e6a844248 100644
--- a/src/data_plan.h
+++ b/src/data_plan.h
@@ -20,7 +20,10 @@
namespace cashew {
class DataPlan;
+class Device;
class Policy;
+class Service;
+class ServiceManager;
// byte count
// TODO(vlaviano): this should be a uint64, but libcros/Chrome expects this
@@ -105,6 +108,17 @@ class DataPlan {
// returns NULL if list is empty or contains no active plans
static DataPlan* GetActivePlan(const DataPlanList& data_plans);
+ // event handler for |service's| local byte counter on |device|
+ // updates active plans in |data_plans| based on the |rx_bytes| and
+ // |tx_bytes| values gathered during the most recent sample interval
+ // notifies |service_manager| if an active plan is completely consumed
+ // returns true if any plans were updated and false otherwise
+ // |data_plans|, |service|, |service_manager| and |device| must not be NULL
+ static bool OnByteCounterUpdate(DataPlanList *data_plans, Service *service,
+ ServiceManager *service_manager,
+ Device *device, uint64 rx_bytes,
+ uint64 tx_bytes);
+
private:
// human-readable plan name
const std::string name_;
« no previous file with comments | « src/byte_counter.h ('k') | src/data_plan.cc » ('j') | src/device.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698