| 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 // Called after every raw read. If |bytes_read| is > 0, this indicates | 353 // Called after every raw read. If |bytes_read| is > 0, this indicates |
| 354 // a successful read of |bytes_read| unfiltered bytes. If |bytes_read| | 354 // a successful read of |bytes_read| unfiltered bytes. If |bytes_read| |
| 355 // is 0, this indicates that there is no additional data to read. | 355 // is 0, this indicates that there is no additional data to read. |
| 356 // If |bytes_read| is negative, no bytes were read. | 356 // If |bytes_read| is negative, no bytes were read. |
| 357 void GatherRawReadStats(int bytes_read); | 357 void GatherRawReadStats(int bytes_read); |
| 358 | 358 |
| 359 // Updates the profiling info and notifies observers that an additional | 359 // Updates the profiling info and notifies observers that an additional |
| 360 // |bytes_read| unfiltered bytes have been read for this job. | 360 // |bytes_read| unfiltered bytes have been read for this job. |
| 361 void RecordBytesRead(int bytes_read); | 361 void RecordBytesRead(int bytes_read); |
| 362 | 362 |
| 363 // NotifyDone marks that request is done. It is really a glorified | 363 // OnDone marks that request is done. It is really a glorified |
| 364 // set_status, but also does internal state checking and job tracking. It | 364 // set_status, but also does internal state checking and job tracking. It |
| 365 // should be called once per request, when the job is finished doing all IO. | 365 // should be called once per request, when the job is finished doing all IO. |
| 366 void NotifyDone(const URLRequestStatus& status); | 366 // |
| 367 // If |notify_done| is true, will notify the URLRequest if there was an error |
| 368 // asynchronously. Otherwise, the caller will need to do this itself, |
| 369 // possibly through a synchronous return value. |
| 370 // TODO(mmenke): Remove |notify_done|, and make caller handle notification. |
| 371 void OnDone(const URLRequestStatus& status, bool notify_done); |
| 367 | 372 |
| 368 // Some work performed by NotifyDone must be completed asynchronously so | 373 // Takes care of the notification initiated by OnDone() to avoid re-entering |
| 369 // as to avoid re-entering URLRequest::Delegate. This method performs that | 374 // the URLRequest::Delegate. |
| 370 // work. | 375 void NotifyDone(); |
| 371 void CompleteNotifyDone(); | |
| 372 | 376 |
| 373 // Subclasses may implement this method to record packet arrival times. | 377 // Subclasses may implement this method to record packet arrival times. |
| 374 // The default implementation does nothing. Only invoked when bytes have been | 378 // The default implementation does nothing. Only invoked when bytes have been |
| 375 // read since the last invocation. | 379 // read since the last invocation. |
| 376 virtual void UpdatePacketReadTimes(); | 380 virtual void UpdatePacketReadTimes(); |
| 377 | 381 |
| 378 // Computes a new RedirectInfo based on receiving a redirect response of | 382 // Computes a new RedirectInfo based on receiving a redirect response of |
| 379 // |location| and |http_status_code|. | 383 // |location| and |http_status_code|. |
| 380 RedirectInfo ComputeRedirectInfo(const GURL& location, int http_status_code); | 384 RedirectInfo ComputeRedirectInfo(const GURL& location, int http_status_code); |
| 381 | 385 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 CompletionCallback read_raw_callback_; | 438 CompletionCallback read_raw_callback_; |
| 435 | 439 |
| 436 base::WeakPtrFactory<URLRequestJob> weak_factory_; | 440 base::WeakPtrFactory<URLRequestJob> weak_factory_; |
| 437 | 441 |
| 438 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); | 442 DISALLOW_COPY_AND_ASSIGN(URLRequestJob); |
| 439 }; | 443 }; |
| 440 | 444 |
| 441 } // namespace net | 445 } // namespace net |
| 442 | 446 |
| 443 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ | 447 #endif // NET_URL_REQUEST_URL_REQUEST_JOB_H_ |
| OLD | NEW |