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

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

Issue 1452823011: Make PacketReader/PacketWriter interfaces async-only. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resync 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_WRITER_H_ 5 #ifndef BLIMP_NET_PACKET_WRITER_H_
6 #define BLIMP_NET_PACKET_WRITER_H_ 6 #define BLIMP_NET_PACKET_WRITER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "blimp/net/blimp_net_export.h" 11 #include "blimp/net/blimp_net_export.h"
12 #include "net/base/completion_callback.h" 12 #include "net/base/completion_callback.h"
13 #include "net/base/io_buffer.h" 13 #include "net/base/io_buffer.h"
14 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
15 15
16 namespace blimp { 16 namespace blimp {
17 17
18 // Interface to describe a writer which can write variable-length data packets 18 // Interface to describe a writer which can write variable-length data packets
19 // to a connection. 19 // to a connection.
20 class BLIMP_NET_EXPORT PacketWriter { 20 class BLIMP_NET_EXPORT PacketWriter {
21 public: 21 public:
22 virtual ~PacketWriter() {} 22 virtual ~PacketWriter() {}
23 23
24 // Writes a packet of at least one byte in size to a connection. 24 // Invokes |cb| with net::OK if the write operation executed successfully.
25 // 25 // All other values indicate unrecoverable errors.
26 // Returns net::OK or an error code if the operation executed successfully. 26 virtual void WritePacket(scoped_refptr<net::DrainableIOBuffer> data,
27 // Returns ERR_IO_PENDING if the operation will be executed asynchronously. 27 const net::CompletionCallback& callback) = 0;
28 // |cb| is later invoked with net::OK or an error code.
29 // An error code indicates that caller should stop using this writer.
30 virtual int WritePacket(scoped_refptr<net::DrainableIOBuffer> data,
31 const net::CompletionCallback& callback) = 0;
32 }; 28 };
33 29
34 } // namespace blimp 30 } // namespace blimp
35 31
36 #endif // BLIMP_NET_PACKET_WRITER_H_ 32 #endif // BLIMP_NET_PACKET_WRITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698