OLD | NEW |
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_RESPONSE_BODY_DRAINER_H_ | 5 #ifndef NET_HTTP_HTTP_RESPONSE_BODY_DRAINER_H_ |
6 #define NET_HTTP_HTTP_RESPONSE_BODY_DRAINER_H_ | 6 #define NET_HTTP_HTTP_RESPONSE_BODY_DRAINER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/timer.h" | 12 #include "base/timer.h" |
13 #include "net/base/completion_callback.h" | 13 #include "net/base/completion_callback.h" |
14 #include "net/base/net_api.h" | 14 #include "net/base/net_export.h" |
15 #include "net/http/http_network_session.h" | 15 #include "net/http/http_network_session.h" |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 class HttpStream; | 19 class HttpStream; |
20 class IOBuffer; | 20 class IOBuffer; |
21 | 21 |
22 class NET_TEST HttpResponseBodyDrainer { | 22 class NET_EXPORT_PRIVATE HttpResponseBodyDrainer { |
23 public: | 23 public: |
24 // The size in bytes of the buffer we use to drain the response body that | 24 // The size in bytes of the buffer we use to drain the response body that |
25 // we want to throw away. The response body is typically a small page just a | 25 // we want to throw away. The response body is typically a small page just a |
26 // few hundred bytes long. We set a limit to prevent it from taking too long, | 26 // few hundred bytes long. We set a limit to prevent it from taking too long, |
27 // since we may as well just create a new socket then. | 27 // since we may as well just create a new socket then. |
28 static const int kDrainBodyBufferSize = 16384; | 28 static const int kDrainBodyBufferSize = 16384; |
29 static const int kTimeoutInSeconds = 5; | 29 static const int kTimeoutInSeconds = 5; |
30 | 30 |
31 explicit HttpResponseBodyDrainer(HttpStream* stream); | 31 explicit HttpResponseBodyDrainer(HttpStream* stream); |
32 ~HttpResponseBodyDrainer(); | 32 ~HttpResponseBodyDrainer(); |
(...skipping 27 matching lines...) Expand all Loading... |
60 CompletionCallback* user_callback_; | 60 CompletionCallback* user_callback_; |
61 base::OneShotTimer<HttpResponseBodyDrainer> timer_; | 61 base::OneShotTimer<HttpResponseBodyDrainer> timer_; |
62 HttpNetworkSession* session_; | 62 HttpNetworkSession* session_; |
63 | 63 |
64 DISALLOW_COPY_AND_ASSIGN(HttpResponseBodyDrainer); | 64 DISALLOW_COPY_AND_ASSIGN(HttpResponseBodyDrainer); |
65 }; | 65 }; |
66 | 66 |
67 } // namespace net | 67 } // namespace net |
68 | 68 |
69 #endif // NET_HTTP_HTTP_RESPONSE_BODY_DRAINER_H_ | 69 #endif // NET_HTTP_HTTP_RESPONSE_BODY_DRAINER_H_ |
OLD | NEW |