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

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 statistics object to BlimpEngineSession 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
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..213dbe8cbb667da7ee89ebd2602ff7327db57002 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,12 +36,14 @@ 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_);
Kevin M 2016/05/24 22:56:40 DCHECK(statistics_)
}
@@ -60,6 +63,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

Powered by Google App Engine
This is Rietveld 408576698