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

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

Issue 1452823011: Make PacketReader/PacketWriter interfaces async-only. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rehabbed tests, addressed feedback, made changes to BlimpMessagePump Created 5 years 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
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_WRITER_H_ 5 #ifndef BLIMP_NET_STREAM_PACKET_WRITER_H_
6 #define BLIMP_NET_STREAM_PACKET_WRITER_H_ 6 #define BLIMP_NET_STREAM_PACKET_WRITER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 17 matching lines...) Expand all
28 // kMaxPacketPayloadSizeBytes). 28 // kMaxPacketPayloadSizeBytes).
29 class BLIMP_NET_EXPORT StreamPacketWriter : public PacketWriter { 29 class BLIMP_NET_EXPORT StreamPacketWriter : public PacketWriter {
30 public: 30 public:
31 // |socket|: The socket to write packets to. The caller must ensure |socket| 31 // |socket|: The socket to write packets to. The caller must ensure |socket|
32 // is valid while the reader is in-use (see ReadPacket below). 32 // is valid while the reader is in-use (see ReadPacket below).
33 explicit StreamPacketWriter(net::StreamSocket* socket); 33 explicit StreamPacketWriter(net::StreamSocket* socket);
34 34
35 ~StreamPacketWriter() override; 35 ~StreamPacketWriter() override;
36 36
37 // PacketWriter implementation. 37 // PacketWriter implementation.
38 int WritePacket(scoped_refptr<net::DrainableIOBuffer> data, 38 void WritePacket(scoped_refptr<net::DrainableIOBuffer> data,
39 const net::CompletionCallback& callback) override; 39 const net::CompletionCallback& callback) override;
40 40
41 private: 41 private:
42 enum class WriteState { 42 enum class WriteState {
43 IDLE, 43 IDLE,
44 HEADER, 44 HEADER,
45 PAYLOAD, 45 PAYLOAD,
46 }; 46 };
47 47
48 friend std::ostream& operator<<(std::ostream& out, const WriteState state); 48 friend std::ostream& operator<<(std::ostream& out, const WriteState state);
49 49
(...skipping 19 matching lines...) Expand all
69 net::CompletionCallback callback_; 69 net::CompletionCallback callback_;
70 70
71 base::WeakPtrFactory<StreamPacketWriter> weak_factory_; 71 base::WeakPtrFactory<StreamPacketWriter> weak_factory_;
72 72
73 DISALLOW_COPY_AND_ASSIGN(StreamPacketWriter); 73 DISALLOW_COPY_AND_ASSIGN(StreamPacketWriter);
74 }; 74 };
75 75
76 } // namespace blimp 76 } // namespace blimp
77 77
78 #endif // BLIMP_NET_STREAM_PACKET_WRITER_H_ 78 #endif // BLIMP_NET_STREAM_PACKET_WRITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698