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