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

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

Issue 3079002: Refactor SpdyHttpStream to implement HttpStream. Required adding a new... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | net/http/http_basic_stream.cc » ('j') | net/spdy/spdy_http_stream.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // HttpBasicStream is a simple implementation of HttpStream. It assumes it is 5 // HttpBasicStream is a simple implementation of HttpStream. It assumes it is
6 // not sharing a sharing with any other HttpStreams, therefore it just reads and 6 // not sharing a sharing with any other HttpStreams, therefore it just reads and
7 // writes directly to the Http Stream. 7 // writes directly to the Http Stream.
8 8
9 #ifndef NET_HTTP_HTTP_BASIC_STREAM_H_ 9 #ifndef NET_HTTP_HTTP_BASIC_STREAM_H_
10 #define NET_HTTP_HTTP_BASIC_STREAM_H_ 10 #define NET_HTTP_HTTP_BASIC_STREAM_H_
11 #pragma once 11 #pragma once
12 12
13 #include <string> 13 #include <string>
14 14
15 #include "base/basictypes.h" 15 #include "base/basictypes.h"
16 #include "net/base/io_buffer.h" 16 #include "net/base/io_buffer.h"
17 #include "net/http/http_stream.h" 17 #include "net/http/http_stream.h"
18 #include "net/http/http_stream_parser.h" 18 #include "net/http/http_stream_parser.h"
19 19
20 namespace net { 20 namespace net {
21 21
22 class BoundNetLog; 22 class BoundNetLog;
23 class ClientSocketHandle; 23 class ClientSocketHandle;
24 struct HttpRequestInfo; 24 struct HttpRequestInfo;
25 class HttpResponseInfo; 25 class HttpResponseInfo;
26 class UploadDataStream; 26 class UploadDataStream;
27 27
28 class HttpBasicStream : public HttpStream { 28 class HttpBasicStream : public HttpStream {
29 public: 29 public:
30 HttpBasicStream(ClientSocketHandle* handle, const BoundNetLog& net_log); 30 explicit HttpBasicStream(ClientSocketHandle* connection);
31 virtual ~HttpBasicStream(); 31 virtual ~HttpBasicStream();
32 32
33 // HttpStream methods: 33 // HttpStream methods:
34 virtual int SendRequest(const HttpRequestInfo* request, 34 virtual int InitializeStream(const HttpRequestInfo* request_info,
35 const std::string& headers, 35 const BoundNetLog& net_log,
36 CompletionCallback* callback);
vandebo (ex-Chrome) 2010/07/28 23:30:39 nit: callback is unused
37
38 virtual int SendRequest(const std::string& headers,
36 UploadDataStream* request_body, 39 UploadDataStream* request_body,
37 HttpResponseInfo* response, 40 HttpResponseInfo* response,
38 CompletionCallback* callback); 41 CompletionCallback* callback);
39 42
40 virtual uint64 GetUploadProgress() const; 43 virtual uint64 GetUploadProgress() const;
41 44
42 virtual int ReadResponseHeaders(CompletionCallback* callback); 45 virtual int ReadResponseHeaders(CompletionCallback* callback);
43 46
44 virtual HttpResponseInfo* GetResponseInfo() const; 47 virtual HttpResponseInfo* GetResponseInfo() const;
45 48
46 virtual int ReadResponseBody(IOBuffer* buf, int buf_len, 49 virtual int ReadResponseBody(IOBuffer* buf, int buf_len,
47 CompletionCallback* callback); 50 CompletionCallback* callback);
48 51
49 virtual bool IsResponseBodyComplete() const; 52 virtual bool IsResponseBodyComplete() const;
50 53
51 virtual bool CanFindEndOfResponse() const; 54 virtual bool CanFindEndOfResponse() const;
52 55
53 virtual bool IsMoreDataBuffered() const; 56 virtual bool IsMoreDataBuffered() const;
54 57
55 private: 58 private:
56 scoped_refptr<GrowableIOBuffer> read_buf_; 59 scoped_refptr<GrowableIOBuffer> read_buf_;
57 60
58 scoped_ptr<HttpStreamParser> parser_; 61 scoped_ptr<HttpStreamParser> parser_;
59 62
63 ClientSocketHandle* connection_;
64
60 DISALLOW_COPY_AND_ASSIGN(HttpBasicStream); 65 DISALLOW_COPY_AND_ASSIGN(HttpBasicStream);
61 }; 66 };
62 67
63 } // namespace net 68 } // namespace net
64 69
65 #endif // NET_HTTP_HTTP_BASIC_STREAM_H_ 70 #endif // NET_HTTP_HTTP_BASIC_STREAM_H_
OLDNEW
« no previous file with comments | « no previous file | net/http/http_basic_stream.cc » ('j') | net/spdy/spdy_http_stream.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698