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

Side by Side Diff: blimp/net/stream_packet_reader.h

Issue 2008283004: Revert of Added a debug info UI for Blimp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « blimp/net/ssl_client_transport_unittest.cc ('k') | blimp/net/stream_packet_reader.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium 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 #ifndef BLIMP_NET_STREAM_PACKET_READER_H_ 5 #ifndef BLIMP_NET_STREAM_PACKET_READER_H_
6 #define BLIMP_NET_STREAM_PACKET_READER_H_ 6 #define BLIMP_NET_STREAM_PACKET_READER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "blimp/net/blimp_net_export.h" 13 #include "blimp/net/blimp_net_export.h"
14 #include "blimp/net/packet_reader.h" 14 #include "blimp/net/packet_reader.h"
15 #include "net/base/completion_callback.h" 15 #include "net/base/completion_callback.h"
16 #include "net/base/net_errors.h" 16 #include "net/base/net_errors.h"
17 17
18 namespace net { 18 namespace net {
19 class GrowableIOBuffer; 19 class GrowableIOBuffer;
20 class StreamSocket; 20 class StreamSocket;
21 } // namespace net 21 } // namespace net
22 22
23 namespace blimp { 23 namespace blimp {
24 class BlimpConnectionStatistics;
25 24
26 // Reads opaque length-prefixed packets of bytes from a StreamSocket. 25 // Reads opaque length-prefixed packets of bytes from a StreamSocket.
27 // The header segment is 32-bit, encoded in network byte order. 26 // The header segment is 32-bit, encoded in network byte order.
28 // The body segment length is specified in the header (capped at 27 // The body segment length is specified in the header (capped at
29 // kMaxPacketPayloadSizeBytes). 28 // kMaxPacketPayloadSizeBytes).
30 class BLIMP_NET_EXPORT StreamPacketReader : public PacketReader { 29 class BLIMP_NET_EXPORT StreamPacketReader : public PacketReader {
31 public: 30 public:
32 // |socket|: The socket to read packets from. The caller must ensure |socket| 31 // |socket|: The socket to read packets from. The caller must ensure |socket|
33 // is valid while the reader is in-use (see ReadPacket below). 32 // is valid while the reader is in-use (see ReadPacket below).
34 // |statistics|: Statistics collector to keep track of number of bytes read. 33 explicit StreamPacketReader(net::StreamSocket* socket);
35 // |statistics| is expected to outlive |this|.
36 StreamPacketReader(net::StreamSocket* socket,
37 BlimpConnectionStatistics* statistics);
38 34
39 ~StreamPacketReader() override; 35 ~StreamPacketReader() override;
40 36
41 // PacketReader implementation. 37 // PacketReader implementation.
42 void ReadPacket(const scoped_refptr<net::GrowableIOBuffer>& buf, 38 void ReadPacket(const scoped_refptr<net::GrowableIOBuffer>& buf,
43 const net::CompletionCallback& cb) override; 39 const net::CompletionCallback& cb) override;
44 40
45 private: 41 private:
46 enum class ReadState { 42 enum class ReadState {
47 IDLE, 43 IDLE,
(...skipping 21 matching lines...) Expand all
69 ReadState read_state_; 65 ReadState read_state_;
70 66
71 net::StreamSocket* socket_; 67 net::StreamSocket* socket_;
72 68
73 // The size of the payload, in bytes. 69 // The size of the payload, in bytes.
74 size_t payload_size_; 70 size_t payload_size_;
75 71
76 scoped_refptr<net::GrowableIOBuffer> header_buffer_; 72 scoped_refptr<net::GrowableIOBuffer> header_buffer_;
77 scoped_refptr<net::GrowableIOBuffer> payload_buffer_; 73 scoped_refptr<net::GrowableIOBuffer> payload_buffer_;
78 net::CompletionCallback callback_; 74 net::CompletionCallback callback_;
79 BlimpConnectionStatistics* statistics_;
80 75
81 base::WeakPtrFactory<StreamPacketReader> weak_factory_; 76 base::WeakPtrFactory<StreamPacketReader> weak_factory_;
82 77
83 DISALLOW_COPY_AND_ASSIGN(StreamPacketReader); 78 DISALLOW_COPY_AND_ASSIGN(StreamPacketReader);
84 }; 79 };
85 80
86 } // namespace blimp 81 } // namespace blimp
87 82
88 #endif // BLIMP_NET_STREAM_PACKET_READER_H_ 83 #endif // BLIMP_NET_STREAM_PACKET_READER_H_
OLDNEW
« no previous file with comments | « blimp/net/ssl_client_transport_unittest.cc ('k') | blimp/net/stream_packet_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698