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

Side by Side Diff: src/device_impl.cc

Issue 6250171: cashew: reset local counter on plan transition (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cashew.git@master
Patch Set: ers review comments 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 | « src/device_impl.h ('k') | src/device_mock.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010, 2011 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010, 2011 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 #include "src/device_impl.h" 5 #include "src/device_impl.h"
6 6
7 #include <glog/logging.h> 7 #include <glog/logging.h>
8 8
9 #include "src/byte_counter.h" 9 #include "src/byte_counter.h"
10 #include "src/service.h" 10 #include "src/service.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 DeleteByteCounter(); 137 DeleteByteCounter();
138 byte_counter_running_ = false; 138 byte_counter_running_ = false;
139 } 139 }
140 DCHECK(byte_counter_ == NULL); 140 DCHECK(byte_counter_ == NULL);
141 } 141 }
142 142
143 bool DeviceImpl::ByteCounterRunning() const { 143 bool DeviceImpl::ByteCounterRunning() const {
144 return byte_counter_running_; 144 return byte_counter_running_;
145 } 145 }
146 146
147 void DeviceImpl::ResetByteCounter(uint64 rx_bytes, uint64 tx_bytes) {
148 DLOG(INFO) << path_ << ": ResetByteCounter: rx_bytes = " << rx_bytes
149 << ", tx_bytes = " << tx_bytes;
150 DCHECK(byte_counter_running_);
151 DCHECK(byte_counter_ != NULL);
152 byte_counter_->SetRxBytes(rx_bytes);
153 byte_counter_->SetTxBytes(tx_bytes);
154 }
155
147 // ByteCounterDelegate methods 156 // ByteCounterDelegate methods
148 157
149 void DeviceImpl::OnByteCounterUpdate(const ByteCounter *counter, 158 void DeviceImpl::OnByteCounterUpdate(const ByteCounter *counter,
150 uint64 rx_bytes, uint64 tx_bytes) { 159 uint64 rx_bytes, uint64 tx_bytes) {
151 DCHECK(byte_counter_running_); 160 DCHECK(byte_counter_running_);
152 DCHECK(byte_counter_ != NULL); 161 DCHECK(byte_counter_ != NULL);
153 DCHECK(counter == byte_counter_); 162 DCHECK(counter == byte_counter_);
154 DLOG(INFO) << path_ << ": OnByteCounterUpdate: rx_bytes = " << rx_bytes 163 DLOG(INFO) << path_ << ": OnByteCounterUpdate: rx_bytes = " << rx_bytes
155 << ", tx_bytes = " << tx_bytes; 164 << ", tx_bytes = " << tx_bytes;
156 parent_->OnByteCounterUpdate(rx_bytes, tx_bytes); 165 parent_->OnByteCounterUpdate(rx_bytes, tx_bytes);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 356
348 void DeviceImpl::DeleteByteCounter() { 357 void DeviceImpl::DeleteByteCounter() {
349 DLOG(INFO) << path_ << ": DeleteByteCounter"; 358 DLOG(INFO) << path_ << ": DeleteByteCounter";
350 if (byte_counter_ != NULL) { 359 if (byte_counter_ != NULL) {
351 delete byte_counter_; 360 delete byte_counter_;
352 byte_counter_ = NULL; 361 byte_counter_ = NULL;
353 } 362 }
354 } 363 }
355 364
356 } // namespace cashew 365 } // namespace cashew
OLDNEW
« no previous file with comments | « src/device_impl.h ('k') | src/device_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698