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

Unified Diff: blimp/net/stream_packet_writer.cc

Issue 1962393004: Added a debug info UI for Blimp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added empty implementation for linux client Created 4 years, 7 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 | « blimp/net/stream_packet_writer.h ('k') | blimp/net/stream_packet_writer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/net/stream_packet_writer.cc
diff --git a/blimp/net/stream_packet_writer.cc b/blimp/net/stream_packet_writer.cc
index 7fe00d2a1f7333b94a4cba5cac0e8427c91199bb..55cd29e911f3227114cc10b5cec678748df37f30 100644
--- a/blimp/net/stream_packet_writer.cc
+++ b/blimp/net/stream_packet_writer.cc
@@ -12,6 +12,7 @@
#include "base/message_loop/message_loop.h"
#include "base/sys_byteorder.h"
#include "blimp/common/proto/blimp_message.pb.h"
+#include "blimp/net/blimp_connection_statistics.h"
#include "blimp/net/common.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
@@ -35,14 +36,17 @@ std::ostream& operator<<(std::ostream& out,
return out;
}
-StreamPacketWriter::StreamPacketWriter(net::StreamSocket* socket)
+StreamPacketWriter::StreamPacketWriter(net::StreamSocket* socket,
+ BlimpConnectionStatistics* statistics)
: write_state_(WriteState::IDLE),
socket_(socket),
header_buffer_(
new net::DrainableIOBuffer(new net::IOBuffer(kPacketHeaderSizeBytes),
kPacketHeaderSizeBytes)),
+ statistics_(statistics),
weak_factory_(this) {
DCHECK(socket_);
+ DCHECK(statistics_);
}
StreamPacketWriter::~StreamPacketWriter() {}
@@ -60,6 +64,8 @@ void StreamPacketWriter::WritePacket(
base::HostToNet32(data->BytesRemaining());
payload_buffer_ = data;
+ statistics_->Add(BlimpConnectionStatistics::BYTES_SENT,
+ payload_buffer_->BytesRemaining());
int result = DoWriteLoop(net::OK);
if (result != net::ERR_IO_PENDING) {
// Release the payload buffer, since the write operation has completed
« no previous file with comments | « blimp/net/stream_packet_writer.h ('k') | blimp/net/stream_packet_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698