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 NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
6 #define NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 // completed. |synchronous| true if the read completed synchronously. | 338 // completed. |synchronous| true if the read completed synchronously. |
339 // See the documentation for |Read| above for the contract of this method. | 339 // See the documentation for |Read| above for the contract of this method. |
340 void SourceStreamReadComplete(bool synchronous, int result); | 340 void SourceStreamReadComplete(bool synchronous, int result); |
341 | 341 |
342 // Invokes ReadRawData and records bytes read if the read completes | 342 // Invokes ReadRawData and records bytes read if the read completes |
343 // synchronously. | 343 // synchronously. |
344 int ReadRawDataHelper(IOBuffer* buf, | 344 int ReadRawDataHelper(IOBuffer* buf, |
345 int buf_size, | 345 int buf_size, |
346 const CompletionCallback& callback); | 346 const CompletionCallback& callback); |
347 | 347 |
| 348 // Returns OK if |new_url| is a valid redirect target and an error code |
| 349 // otherwise. |
| 350 int CanFollowRedirect(const GURL& new_url); |
| 351 |
348 // Called in response to a redirect that was not canceled to follow the | 352 // Called in response to a redirect that was not canceled to follow the |
349 // redirect. The current job will be replaced with a new job loading the | 353 // redirect. The current job will be replaced with a new job loading the |
350 // given redirect destination. | 354 // given redirect destination. |
351 void FollowRedirect(const RedirectInfo& redirect_info); | 355 void FollowRedirect(const RedirectInfo& redirect_info); |
352 | 356 |
353 // Called after every raw read. If |bytes_read| is > 0, this indicates | 357 // Called after every raw read. If |bytes_read| is > 0, this indicates |
354 // a successful read of |bytes_read| unfiltered bytes. If |bytes_read| | 358 // a successful read of |bytes_read| unfiltered bytes. If |bytes_read| |
355 // is 0, this indicates that there is no additional data to read. | 359 // is 0, this indicates that there is no additional data to read. |
356 // If |bytes_read| is negative, no bytes were read. | 360 // If |bytes_read| is negative, no bytes were read. |
357 void GatherRawReadStats(int bytes_read); | 361 void GatherRawReadStats(int bytes_read); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 // in progress, so we are able to pass those bytes to job observers. | 414 // in progress, so we are able to pass those bytes to job observers. |
411 scoped_refptr<IOBuffer> raw_read_buffer_; | 415 scoped_refptr<IOBuffer> raw_read_buffer_; |
412 | 416 |
413 // Used by HandleResponseIfNecessary to track whether we've sent the | 417 // Used by HandleResponseIfNecessary to track whether we've sent the |
414 // OnResponseStarted callback and potentially redirect callbacks as well. | 418 // OnResponseStarted callback and potentially redirect callbacks as well. |
415 bool has_handled_response_; | 419 bool has_handled_response_; |
416 | 420 |
417 // Expected content size | 421 // Expected content size |
418 int64_t expected_content_size_; | 422 int64_t expected_content_size_; |
419 | 423 |
420 // Set when a redirect is deferred. | 424 // Set when a redirect is deferred. Redirects are deferred after validity |
| 425 // checks are performed, so this field must not be modified. |
421 RedirectInfo deferred_redirect_info_; | 426 RedirectInfo deferred_redirect_info_; |
422 | 427 |
423 // The network delegate to use with this request, if any. | 428 // The network delegate to use with this request, if any. |
424 NetworkDelegate* network_delegate_; | 429 NetworkDelegate* network_delegate_; |
425 | 430 |
426 // The value from GetTotalReceivedBytes() the last time | 431 // The value from GetTotalReceivedBytes() the last time |
427 // MaybeNotifyNetworkBytes() was called. Used to calculate how bytes have been | 432 // MaybeNotifyNetworkBytes() was called. Used to calculate how bytes have been |
428 // newly received since the last notification. | 433 // newly received since the last notification. |
429 int64_t last_notified_total_received_bytes_; | 434 int64_t last_notified_total_received_bytes_; |
430 | 435 |
431 // The value from GetTotalSentBytes() the last time MaybeNotifyNetworkBytes() | 436 // The value from GetTotalSentBytes() the last time MaybeNotifyNetworkBytes() |
432 // was called. Used to calculate how bytes have been newly sent since the last | 437 // was called. Used to calculate how bytes have been newly sent since the last |
433 // notification. | 438 // notification. |
434 int64_t last_notified_total_sent_bytes_; | 439 int64_t last_notified_total_sent_bytes_; |
435 | 440 |
436 // Non-null if ReadRawData() returned ERR_IO_PENDING, and the read has not | 441 // Non-null if ReadRawData() returned ERR_IO_PENDING, and the read has not |
437 // completed. | 442 // completed. |
438 CompletionCallback read_raw_callback_; | 443 CompletionCallback read_raw_callback_; |
439 | 444 |
440 base::WeakPtrFactory<URLRequestJob> weak_factory_; | 445 base::WeakPtrFactory<URLRequestJob> weak_factory_; |
441 | 446 |
442 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); | 447 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); |
443 }; | 448 }; |
444 | 449 |
445 } // namespace net | 450 } // namespace net |
446 | 451 |
447 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 452 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
OLD | NEW |