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

Side by Side Diff: net/url_request/url_request_http_job.h

Issue 1662763002: [ON HOLD] Implement pull-based design for content decoding (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add filter_source_stream_unittest.cc and address other comments Created 4 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
OLDNEW
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 NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ 5 #ifndef NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_
6 #define NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ 6 #define NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "net/base/auth.h" 19 #include "net/base/auth.h"
20 #include "net/base/completion_callback.h" 20 #include "net/base/completion_callback.h"
21 #include "net/base/net_error_details.h" 21 #include "net/base/net_error_details.h"
22 #include "net/base/net_export.h" 22 #include "net/base/net_export.h"
23 #include "net/base/sdch_manager.h" 23 #include "net/base/sdch_manager.h"
24 #include "net/cookies/cookie_store.h" 24 #include "net/cookies/cookie_store.h"
25 #include "net/filter/filter.h" 25 #include "net/filter/sdch_policy_delegate.h"
26 #include "net/http/http_request_info.h" 26 #include "net/http/http_request_info.h"
27 #include "net/socket/connection_attempts.h" 27 #include "net/socket/connection_attempts.h"
28 #include "net/url_request/url_request_backoff_manager.h" 28 #include "net/url_request/url_request_backoff_manager.h"
29 #include "net/url_request/url_request_job.h" 29 #include "net/url_request/url_request_job.h"
30 #include "net/url_request/url_request_throttler_entry_interface.h" 30 #include "net/url_request/url_request_throttler_entry_interface.h"
31 31
32 namespace net { 32 namespace net {
33 33
34 class HttpRequestHeaders; 34 class HttpRequestHeaders;
35 class HttpResponseHeaders; 35 class HttpResponseHeaders;
(...skipping 18 matching lines...) Expand all
54 NetworkDelegate* network_delegate, 54 NetworkDelegate* network_delegate,
55 const HttpUserAgentSettings* http_user_agent_settings); 55 const HttpUserAgentSettings* http_user_agent_settings);
56 56
57 ~URLRequestHttpJob() override; 57 ~URLRequestHttpJob() override;
58 58
59 // Overridden from URLRequestJob: 59 // Overridden from URLRequestJob:
60 void SetPriority(RequestPriority priority) override; 60 void SetPriority(RequestPriority priority) override;
61 void Start() override; 61 void Start() override;
62 void Kill() override; 62 void Kill() override;
63 void GetConnectionAttempts(ConnectionAttempts* out) const override; 63 void GetConnectionAttempts(ConnectionAttempts* out) const override;
64 std::unique_ptr<SourceStream> SetUpSourceStream() override;
64 65
65 RequestPriority priority() const { 66 RequestPriority priority() const {
66 return priority_; 67 return priority_;
67 } 68 }
68 69
69 private: 70 private:
70 enum CompletionCause { 71 enum CompletionCause {
71 ABORTED, 72 ABORTED,
72 FINISHED 73 FINISHED
73 }; 74 };
74 75
75 typedef base::RefCountedData<bool> SharedBoolean; 76 typedef base::RefCountedData<bool> SharedBoolean;
76 77
77 class HttpFilterContext; 78 class SdchContext;
78 79
79 // Shadows URLRequestJob's version of this method. 80 // Shadows URLRequestJob's version of this method.
80 void NotifyBeforeNetworkStart(bool* defer); 81 void NotifyBeforeNetworkStart(bool* defer);
81 82
82 // Shadows URLRequestJob's version of this method so we can grab cookies. 83 // Shadows URLRequestJob's version of this method so we can grab cookies.
83 void NotifyHeadersComplete(); 84 void NotifyHeadersComplete();
84 85
85 void DestroyTransaction(); 86 void DestroyTransaction();
86 87
87 void AddExtraHeaders(); 88 void AddExtraHeaders();
(...skipping 30 matching lines...) Expand all
118 void SetExtraRequestHeaders(const HttpRequestHeaders& headers) override; 119 void SetExtraRequestHeaders(const HttpRequestHeaders& headers) override;
119 LoadState GetLoadState() const override; 120 LoadState GetLoadState() const override;
120 UploadProgress GetUploadProgress() const override; 121 UploadProgress GetUploadProgress() const override;
121 bool GetMimeType(std::string* mime_type) const override; 122 bool GetMimeType(std::string* mime_type) const override;
122 bool GetCharset(std::string* charset) override; 123 bool GetCharset(std::string* charset) override;
123 void GetResponseInfo(HttpResponseInfo* info) override; 124 void GetResponseInfo(HttpResponseInfo* info) override;
124 void GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override; 125 void GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override;
125 bool GetRemoteEndpoint(IPEndPoint* endpoint) const override; 126 bool GetRemoteEndpoint(IPEndPoint* endpoint) const override;
126 int GetResponseCode() const override; 127 int GetResponseCode() const override;
127 void PopulateNetErrorDetails(NetErrorDetails* details) const override; 128 void PopulateNetErrorDetails(NetErrorDetails* details) const override;
128 std::unique_ptr<Filter> SetupFilter() const override;
129 bool CopyFragmentOnRedirect(const GURL& location) const override; 129 bool CopyFragmentOnRedirect(const GURL& location) const override;
130 bool IsSafeRedirect(const GURL& location) override; 130 bool IsSafeRedirect(const GURL& location) override;
131 bool NeedsAuth() override; 131 bool NeedsAuth() override;
132 void GetAuthChallengeInfo(scoped_refptr<AuthChallengeInfo>*) override; 132 void GetAuthChallengeInfo(scoped_refptr<AuthChallengeInfo>*) override;
133 void SetAuth(const AuthCredentials& credentials) override; 133 void SetAuth(const AuthCredentials& credentials) override;
134 void CancelAuth() override; 134 void CancelAuth() override;
135 void ContinueWithCertificate(X509Certificate* client_cert, 135 void ContinueWithCertificate(X509Certificate* client_cert,
136 SSLPrivateKey* client_private_key) override; 136 SSLPrivateKey* client_private_key) override;
137 void ContinueDespiteLastError() override; 137 void ContinueDespiteLastError() override;
138 void ResumeNetworkStart() override; 138 void ResumeNetworkStart() override;
139 int ReadRawData(IOBuffer* buf, int buf_size) override; 139 int ReadRawData(IOBuffer* buf, int buf_size) override;
140 void StopCaching() override; 140 void StopCaching() override;
141 bool GetFullRequestHeaders(HttpRequestHeaders* headers) const override; 141 bool GetFullRequestHeaders(HttpRequestHeaders* headers) const override;
142 int64_t GetTotalReceivedBytes() const override; 142 int64_t GetTotalReceivedBytes() const override;
143 int64_t GetTotalSentBytes() const override; 143 int64_t GetTotalSentBytes() const override;
144 void DoneReading() override; 144 void DoneReading() override;
145 void DoneReadingRedirectResponse() override; 145 void DoneReadingRedirectResponse() override;
146 146
147 HostPortPair GetSocketAddress() const override; 147 HostPortPair GetSocketAddress() const override;
148 void NotifyURLRequestDestroyed() override; 148 void NotifyURLRequestDestroyed() override;
149 149
150 void RecordTimer(); 150 void RecordTimer();
151 void ResetTimer(); 151 void ResetTimer();
152 152
153 void UpdatePacketReadTimes() override; 153 void UpdatePacketReadTimes() override;
154 void RecordPacketStats(FilterContext::StatisticSelector statistic) const; 154 void RecordPacketStats(
155 SdchPolicyDelegate::Context::StatisticSelector statistic) const;
155 156
156 // Starts the transaction if extensions using the webrequest API do not 157 // Starts the transaction if extensions using the webrequest API do not
157 // object. 158 // object.
158 void StartTransaction(); 159 void StartTransaction();
159 // If |result| is OK, calls StartTransactionInternal. Otherwise notifies 160 // If |result| is OK, calls StartTransactionInternal. Otherwise notifies
160 // cancellation. 161 // cancellation.
161 void MaybeStartTransactionInternal(int result); 162 void MaybeStartTransactionInternal(int result);
162 void StartTransactionInternal(); 163 void StartTransactionInternal();
163 164
164 void RecordPerfHistograms(CompletionCause reason); 165 void RecordPerfHistograms(CompletionCause reason);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 // Since we don't save all packet times in packet_times_, we save the 240 // Since we don't save all packet times in packet_times_, we save the
240 // last time for use in histograms. 241 // last time for use in histograms.
241 base::Time final_packet_time_; 242 base::Time final_packet_time_;
242 243
243 // The start time for the job, ignoring re-starts. 244 // The start time for the job, ignoring re-starts.
244 base::TimeTicks start_time_; 245 base::TimeTicks start_time_;
245 246
246 // When the transaction finished reading the request headers. 247 // When the transaction finished reading the request headers.
247 base::TimeTicks receive_headers_end_; 248 base::TimeTicks receive_headers_end_;
248 249
249 std::unique_ptr<HttpFilterContext> filter_context_; 250 std::unique_ptr<SdchPolicyDelegate> sdch_delegate_;
250 251
251 CompletionCallback on_headers_received_callback_; 252 CompletionCallback on_headers_received_callback_;
252 253
253 // We allow the network delegate to modify a copy of the response headers. 254 // We allow the network delegate to modify a copy of the response headers.
254 // This prevents modifications of headers that are shared with the underlying 255 // This prevents modifications of headers that are shared with the underlying
255 // layers of the network stack. 256 // layers of the network stack.
256 scoped_refptr<HttpResponseHeaders> override_response_headers_; 257 scoped_refptr<HttpResponseHeaders> override_response_headers_;
257 258
258 // The network delegate can mark a URL as safe for redirection. 259 // The network delegate can mark a URL as safe for redirection.
259 // The reference fragment of the original URL is not appended to the redirect 260 // The reference fragment of the original URL is not appended to the redirect
(...skipping 19 matching lines...) Expand all
279 int64_t total_sent_bytes_from_previous_transactions_; 280 int64_t total_sent_bytes_from_previous_transactions_;
280 281
281 base::WeakPtrFactory<URLRequestHttpJob> weak_factory_; 282 base::WeakPtrFactory<URLRequestHttpJob> weak_factory_;
282 283
283 DISALLOW_COPY_AND_ASSIGN(URLRequestHttpJob); 284 DISALLOW_COPY_AND_ASSIGN(URLRequestHttpJob);
284 }; 285 };
285 286
286 } // namespace net 287 } // namespace net
287 288
288 #endif // NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_ 289 #endif // NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698