OLD | NEW |
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 CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 virtual void OnWriteComplete(int result); | 90 virtual void OnWriteComplete(int result); |
91 | 91 |
92 const std::string address_; | 92 const std::string address_; |
93 int port_; | 93 int port_; |
94 bool is_connected_; | 94 bool is_connected_; |
95 | 95 |
96 private: | 96 private: |
97 struct WriteRequest { | 97 struct WriteRequest { |
98 WriteRequest(scoped_refptr<net::IOBuffer> io_buffer, | 98 WriteRequest(scoped_refptr<net::IOBuffer> io_buffer, |
99 int byte_count, | 99 int byte_count, |
100 const CompletionCallback& callback) | 100 const CompletionCallback& callback); |
101 : io_buffer(io_buffer), | 101 ~WriteRequest(); |
102 byte_count(byte_count), | |
103 callback(callback), | |
104 bytes_written(0) { } | |
105 ~WriteRequest() { } | |
106 scoped_refptr<net::IOBuffer> io_buffer; | 102 scoped_refptr<net::IOBuffer> io_buffer; |
107 int byte_count; | 103 int byte_count; |
108 CompletionCallback callback; | 104 CompletionCallback callback; |
109 int bytes_written; | 105 int bytes_written; |
110 }; | 106 }; |
111 std::queue<WriteRequest> write_queue_; | 107 std::queue<WriteRequest> write_queue_; |
112 scoped_refptr<net::IOBuffer> io_buffer_write_; | 108 scoped_refptr<net::IOBuffer> io_buffer_write_; |
113 }; | 109 }; |
114 | 110 |
115 } // namespace extensions | 111 } // namespace extensions |
116 | 112 |
117 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_H_ | 113 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_H_ |
OLD | NEW |