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

Side by Side Diff: remoting/base/buffered_socket_writer.h

Issue 1250403003: Fix BufferedSocketWriter not to return any results from Write(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 | « no previous file | remoting/base/buffered_socket_writer.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 REMOTING_BASE_BUFFERED_SOCKET_WRITER_H_ 5 #ifndef REMOTING_BASE_BUFFERED_SOCKET_WRITER_H_
6 #define REMOTING_BASE_BUFFERED_SOCKET_WRITER_H_ 6 #define REMOTING_BASE_BUFFERED_SOCKET_WRITER_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 24 matching lines...) Expand all
35 35
36 BufferedSocketWriter(); 36 BufferedSocketWriter();
37 virtual ~BufferedSocketWriter(); 37 virtual ~BufferedSocketWriter();
38 38
39 // Initializes the writer. |write_callback| is called to write data to the 39 // Initializes the writer. |write_callback| is called to write data to the
40 // socket. |write_failed_callback| is called when write operation fails. 40 // socket. |write_failed_callback| is called when write operation fails.
41 // Writing stops after the first failed write. 41 // Writing stops after the first failed write.
42 void Init(const WriteCallback& write_callback, 42 void Init(const WriteCallback& write_callback,
43 const WriteFailedCallback& write_failed_callback); 43 const WriteFailedCallback& write_failed_callback);
44 44
45 // Puts a new data chunk in the buffer. Returns false if writing has stopped 45 // Puts a new data chunk in the buffer.
46 // because of an error. 46 void Write(const scoped_refptr<net::IOBufferWithSize>& buffer,
47 bool Write(const scoped_refptr<net::IOBufferWithSize>& buffer,
48 const base::Closure& done_task); 47 const base::Closure& done_task);
49 48
50 // Returns true when there is data waiting to be written. 49 // Returns true when there is data waiting to be written.
51 bool has_data_pending() { return !queue_.empty(); } 50 bool has_data_pending() { return !queue_.empty(); }
52 51
53 private: 52 private:
54 struct PendingPacket; 53 struct PendingPacket;
55 typedef std::list<PendingPacket*> DataQueue; 54 typedef std::list<PendingPacket*> DataQueue;
56 55
57 // Returns true if the writer is closed due to an error. 56 // Returns true if the writer is closed due to an error.
(...skipping 11 matching lines...) Expand all
69 DataQueue queue_; 68 DataQueue queue_;
70 69
71 bool write_pending_ = false; 70 bool write_pending_ = false;
72 71
73 base::WeakPtrFactory<BufferedSocketWriter> weak_factory_; 72 base::WeakPtrFactory<BufferedSocketWriter> weak_factory_;
74 }; 73 };
75 74
76 } // namespace remoting 75 } // namespace remoting
77 76
78 #endif // REMOTING_BASE_BUFFERED_SOCKET_WRITER_H_ 77 #endif // REMOTING_BASE_BUFFERED_SOCKET_WRITER_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/base/buffered_socket_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698