| 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_NET_HTTP_PIPELINING_COMPATIBILITY_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_NET_HTTP_PIPELINING_COMPATIBILITY_CLIENT_H_ |
| 6 #define CHROME_BROWSER_NET_HTTP_PIPELINING_COMPATIBILITY_CLIENT_H_ | 6 #define CHROME_BROWSER_NET_HTTP_PIPELINING_COMPATIBILITY_CLIENT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 // Called when all bytes have been received. Compares the |response_| to | 90 // Called when all bytes have been received. Compares the |response_| to |
| 91 // |info_|'s expected response. | 91 // |info_|'s expected response. |
| 92 void DoReadFinished(); | 92 void DoReadFinished(); |
| 93 | 93 |
| 94 // Called when this request has determined its result. Returns the result to | 94 // Called when this request has determined its result. Returns the result to |
| 95 // the |client_|. | 95 // the |client_|. |
| 96 void Finished(Status result); | 96 void Finished(Status result); |
| 97 | 97 |
| 98 const int request_id_; | 98 const int request_id_; |
| 99 net::URLRequest request_; | 99 scoped_ptr<net::URLRequest> request_; |
| 100 const RequestInfo info_; | 100 const RequestInfo info_; |
| 101 HttpPipeliningCompatibilityClient* client_; | 101 HttpPipeliningCompatibilityClient* client_; |
| 102 bool finished_; | |
| 103 scoped_refptr<net::IOBuffer> read_buffer_; | 102 scoped_refptr<net::IOBuffer> read_buffer_; |
| 104 std::string response_; | 103 std::string response_; |
| 105 }; | 104 }; |
| 106 | 105 |
| 107 // Called when a Request determines its result. Reports to UMA. | 106 // Called when a Request determines its result. Reports to UMA. |
| 108 void OnRequestFinished(int request_id, Status status); | 107 void OnRequestFinished(int request_id, Status status); |
| 109 | 108 |
| 110 // Called when a Request encounters a network error. Reports to UMA. | 109 // Called when a Request encounters a network error. Reports to UMA. |
| 111 void ReportNetworkError(int request_id, int error_code); | 110 void ReportNetworkError(int request_id, int error_code); |
| 112 | 111 |
| 113 // Called when a Request determines its HTTP response code. Reports to UMA. | 112 // Called when a Request determines its HTTP response code. Reports to UMA. |
| 114 void ReportResponseCode(int request_id, int response_code); | 113 void ReportResponseCode(int request_id, int response_code); |
| 115 | 114 |
| 116 // Returns the full UMA metric name based on |request_id| and |description|. | 115 // Returns the full UMA metric name based on |request_id| and |description|. |
| 117 std::string GetMetricName(int request_id, const char* description); | 116 std::string GetMetricName(int request_id, const char* description); |
| 118 | 117 |
| 119 ScopedVector<Request> requests_; | 118 ScopedVector<Request> requests_; |
| 120 net::CompletionCallback finished_callback_; | 119 net::CompletionCallback finished_callback_; |
| 121 size_t num_finished_; | 120 size_t num_finished_; |
| 122 scoped_ptr<net::HttpTransactionFactory> http_transaction_factory_; | 121 scoped_ptr<net::HttpTransactionFactory> http_transaction_factory_; |
| 123 scoped_refptr<net::URLRequestContext> url_request_context_; | 122 scoped_refptr<net::URLRequestContext> url_request_context_; |
| 124 }; | 123 }; |
| 125 | 124 |
| 126 } // namespace chrome_browser_net | 125 } // namespace chrome_browser_net |
| 127 | 126 |
| 128 #endif // CHROME_BROWSER_NET_HTTP_PIPELINING_COMPATIBILITY_CLIENT_H_ | 127 #endif // CHROME_BROWSER_NET_HTTP_PIPELINING_COMPATIBILITY_CLIENT_H_ |
| OLD | NEW |