OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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. |
| 4 |
| 5 #include "blimp/net/blimp_connection_details.h" |
| 6 |
| 7 namespace blimp { |
| 8 |
| 9 BlimpConnectionDetails::BlimpConnectionDetails( |
| 10 NetworkActivityObserver* observer) |
| 11 : bytes_received_(0), bytes_sent_(0), observer_(observer) {} |
| 12 |
| 13 BlimpConnectionDetails::~BlimpConnectionDetails() {} |
| 14 |
| 15 void BlimpConnectionDetails::OnPacketReceived(int bytes) { |
| 16 bytes_received_ += bytes; |
| 17 if (observer_) { |
| 18 observer_->OnPacketReceived(bytes_received_); |
| 19 } |
| 20 } |
| 21 |
| 22 void BlimpConnectionDetails::OnPacketSent(int bytes) { |
| 23 bytes_sent_ += bytes; |
| 24 if (observer_) { |
| 25 observer_->OnPacketSent(bytes_sent_); |
| 26 } |
| 27 } |
| 28 |
| 29 void BlimpConnectionDetails::ResetStats() { |
| 30 bytes_sent_ = 0; |
| 31 bytes_received_ = 0; |
| 32 } |
| 33 } // namespace blimp |
OLD | NEW |