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

Unified Diff: net/http/http_pipelined_stream.h

Issue 7289006: Basic HTTP pipelining support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added unit tests Created 9 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 side-by-side diff with in-line comments
Download patch
Index: net/http/http_pipelined_stream.h
diff --git a/net/http/http_pipelined_stream.h b/net/http/http_pipelined_stream.h
new file mode 100644
index 0000000000000000000000000000000000000000..cc09a59ce9687ffdf87304ceeaad6cde6e2dfb63
--- /dev/null
+++ b/net/http/http_pipelined_stream.h
@@ -0,0 +1,95 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_HTTP_HTTP_PIPELINED_STREAM_H_
+#define NET_HTTP_HTTP_PIPELINED_STREAM_H_
+#pragma once
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "net/http/http_stream.h"
+
+namespace net {
+
+class BoundNetLog;
+class HttpPipelinedConnectionImpl;
+class HttpResponseInfo;
+struct HttpRequestInfo;
+class HttpRequestHeaders;
mmenke 2011/08/23 19:05:25 nit: Alphabetize.
James Simonsen 2011/08/26 22:19:07 Done.
+class HttpStreamParser;
+class IOBuffer;
+class UploadDataStream;
+
+// HttpPipelinedStream is the pipelined implementation of HttpStream. It has
+// very little code in it. Instead, it serves as the client's interface to the
+// pipelined connection, where all the work happens.
+//
+// In the case of pipelining failures, these functions may return
+// ERR_PIPELINE_EVICTION. In that case, the client should retry the HTTP
+// request without pipelining.
+class HttpPipelinedStream : public HttpStream {
+ public:
+ HttpPipelinedStream(HttpPipelinedConnectionImpl* pipeline,
+ int pipeline_id);
+ virtual ~HttpPipelinedStream();
+
+ // HttpStream methods:
+ virtual int InitializeStream(const HttpRequestInfo* request_info,
+ const BoundNetLog& net_log,
+ CompletionCallback* callback) OVERRIDE;
+
+ virtual int SendRequest(const HttpRequestHeaders& headers,
+ UploadDataStream* request_body,
+ HttpResponseInfo* response,
+ CompletionCallback* callback) OVERRIDE;
+
+ virtual uint64 GetUploadProgress() const OVERRIDE;
+
+ virtual int ReadResponseHeaders(CompletionCallback* callback) OVERRIDE;
+
+ virtual const HttpResponseInfo* GetResponseInfo() const OVERRIDE;
+
+ virtual int ReadResponseBody(IOBuffer* buf, int buf_len,
+ CompletionCallback* callback) OVERRIDE;
+
+ virtual void Close(bool not_reusable) OVERRIDE;
+
+ virtual HttpStream* RenewStreamForAuth() OVERRIDE;
+
+ virtual bool IsResponseBodyComplete() const OVERRIDE;
+
+ virtual bool CanFindEndOfResponse() const OVERRIDE;
+
+ virtual bool IsMoreDataBuffered() const OVERRIDE;
+
+ virtual bool IsConnectionReused() const OVERRIDE;
+
+ virtual void SetConnectionReused() OVERRIDE;
+
+ virtual bool IsConnectionReusable() const OVERRIDE;
+
+ virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE;
+
+ virtual void GetSSLCertRequestInfo(
+ SSLCertRequestInfo* cert_request_info) OVERRIDE;
+
+ virtual bool IsSpdyHttpStream() const OVERRIDE;
+
+ virtual void LogNumRttVsBytesMetrics() const OVERRIDE;
+
+ private:
+ HttpPipelinedConnectionImpl* pipeline_;
+
+ int pipeline_id_;
+
+ const HttpRequestInfo* request_info_;
+
+ DISALLOW_COPY_AND_ASSIGN(HttpPipelinedStream);
+};
+
+} // namespace net
+
+#endif // NET_HTTP_HTTP_PIPELINED_STREAM_H_

Powered by Google App Engine
This is Rietveld 408576698