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

Side by Side Diff: net/http/http_stream_parser.h

Issue 8990001: base::Bind: Convert most of net/http. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clang. Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 NET_HTTP_HTTP_STREAM_PARSER_H_ 5 #ifndef NET_HTTP_HTTP_STREAM_PARSER_H_
6 #define NET_HTTP_HTTP_STREAM_PARSER_H_ 6 #define NET_HTTP_HTTP_STREAM_PARSER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 26 matching lines...) Expand all
37 const HttpRequestInfo* request, 37 const HttpRequestInfo* request,
38 GrowableIOBuffer* read_buffer, 38 GrowableIOBuffer* read_buffer,
39 const BoundNetLog& net_log); 39 const BoundNetLog& net_log);
40 virtual ~HttpStreamParser(); 40 virtual ~HttpStreamParser();
41 41
42 // These functions implement the interface described in HttpStream with 42 // These functions implement the interface described in HttpStream with
43 // some additional functionality 43 // some additional functionality
44 int SendRequest(const std::string& request_line, 44 int SendRequest(const std::string& request_line,
45 const HttpRequestHeaders& headers, 45 const HttpRequestHeaders& headers,
46 UploadDataStream* request_body, 46 UploadDataStream* request_body,
47 HttpResponseInfo* response, OldCompletionCallback* callback); 47 HttpResponseInfo* response,
48 const CompletionCallback& callback);
48 49
49 int ReadResponseHeaders(OldCompletionCallback* callback); 50 int ReadResponseHeaders(const CompletionCallback& callback);
50 51
51 int ReadResponseBody(IOBuffer* buf, int buf_len, 52 int ReadResponseBody(IOBuffer* buf, int buf_len,
52 OldCompletionCallback* callback); 53 const CompletionCallback& callback);
53 54
54 void Close(bool not_reusable); 55 void Close(bool not_reusable);
55 56
56 uint64 GetUploadProgress() const; 57 uint64 GetUploadProgress() const;
57 58
58 HttpResponseInfo* GetResponseInfo(); 59 HttpResponseInfo* GetResponseInfo();
59 60
60 bool IsResponseBodyComplete() const; 61 bool IsResponseBodyComplete() const;
61 62
62 bool CanFindEndOfResponse() const; 63 bool CanFindEndOfResponse() const;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 169
169 // Helper if the data is chunked. 170 // Helper if the data is chunked.
170 scoped_ptr<HttpChunkedDecoder> chunked_decoder_; 171 scoped_ptr<HttpChunkedDecoder> chunked_decoder_;
171 172
172 // Where the caller wants the body data. 173 // Where the caller wants the body data.
173 scoped_refptr<IOBuffer> user_read_buf_; 174 scoped_refptr<IOBuffer> user_read_buf_;
174 int user_read_buf_len_; 175 int user_read_buf_len_;
175 176
176 // The callback to notify a user that their request or response is 177 // The callback to notify a user that their request or response is
177 // complete or there was an error 178 // complete or there was an error
178 OldCompletionCallback* user_callback_; 179 CompletionCallback callback_;
179 180
180 // In the client callback, the client can do anything, including 181 // In the client callback, the client can do anything, including
181 // destroying this class, so any pending callback must be issued 182 // destroying this class, so any pending callback must be issued
182 // after everything else is done. When it is time to issue the client 183 // after everything else is done. When it is time to issue the client
183 // callback, move it from |user_callback_| to |scheduled_callback_|. 184 // callback, move it from |callback_| to |scheduled_callback_|.
184 OldCompletionCallback* scheduled_callback_; 185 CompletionCallback scheduled_callback_;
185 186
186 // The underlying socket. 187 // The underlying socket.
187 ClientSocketHandle* const connection_; 188 ClientSocketHandle* const connection_;
188 189
189 BoundNetLog net_log_; 190 BoundNetLog net_log_;
190 191
191 // Callback to be used when doing IO. 192 // Callback to be used when doing IO.
192 CompletionCallback io_callback_; 193 CompletionCallback io_callback_;
193 194
194 // Stores an encoded chunk for chunked uploads. 195 // Stores an encoded chunk for chunked uploads.
195 // Note: This should perhaps be improved to not create copies of the data. 196 // Note: This should perhaps be improved to not create copies of the data.
196 scoped_refptr<IOBuffer> chunk_buf_; 197 scoped_refptr<IOBuffer> chunk_buf_;
197 size_t chunk_length_; 198 size_t chunk_length_;
198 size_t chunk_length_without_encoding_; 199 size_t chunk_length_without_encoding_;
199 bool sent_last_chunk_; 200 bool sent_last_chunk_;
200 201
201 DISALLOW_COPY_AND_ASSIGN(HttpStreamParser); 202 DISALLOW_COPY_AND_ASSIGN(HttpStreamParser);
202 }; 203 };
203 204
204 } // namespace net 205 } // namespace net
205 206
206 #endif // NET_HTTP_HTTP_STREAM_PARSER_H_ 207 #endif // NET_HTTP_HTTP_STREAM_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698