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

Side by Side Diff: blimp/net/packet_reader.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_PACKET_READER_H_ 5 #ifndef BLIMP_NET_PACKET_READER_H_
6 #define BLIMP_NET_PACKET_READER_H_ 6 #define BLIMP_NET_PACKET_READER_H_
7 7
8 #include "blimp/net/blimp_net_export.h" 8 #include "blimp/net/blimp_net_export.h"
9 #include "net/base/completion_callback.h" 9 #include "net/base/completion_callback.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
11 11
12 namespace blimp { 12 namespace blimp {
13 13
14 // Interface to describe a reader which can read variable-length data packets 14 // Interface to describe a reader which can read variable-length data packets
15 // from a connection. 15 // from a connection.
16 class BLIMP_NET_EXPORT PacketReader { 16 class BLIMP_NET_EXPORT PacketReader {
17 public: 17 public:
18 virtual ~PacketReader() {} 18 virtual ~PacketReader() {}
19 19
20 // Reads a packet from the connection. 20 // Reads a packet from the connection.
21 // Returns the size of the packet, in bytes, if the read operation executed 21 // Passes net::OK to |cb| if the read operation executed successfully.
22 // successfully. 22 // Sets |buf.offset()| to the received message's size, and invokes |cb| with
23 // Returns ERR_IO_PENDING if the operation will be executed asynchronously. 23 // net::OK result on success.
24 // |cb| is later invoked with the packet size or an error code. 24 // All other values indicate errors.
25 // All other return values indicate errors and caller should stop using this 25 // |callback| must not be invoked if |this| is deleted.
Wez 2015/12/01 22:34:45 nit: must -> will That way the comment describes
Kevin M 2015/12/02 02:02:37 Done.
26 // reader. 26 virtual void ReadPacket(const scoped_refptr<net::GrowableIOBuffer>& buf,
27 virtual int ReadPacket(const scoped_refptr<net::GrowableIOBuffer>& buf, 27 const net::CompletionCallback& cb) = 0;
28 const net::CompletionCallback& cb) = 0;
29 }; 28 };
30 29
31 } // namespace blimp 30 } // namespace blimp
32 31
33 #endif // BLIMP_NET_PACKET_READER_H_ 32 #endif // BLIMP_NET_PACKET_READER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698