OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_H_ |
6 #define NET_URL_REQUEST_URL_REQUEST_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 // error. Otherwise, it is a value defined by the operating system (e.g., an | 370 // error. Otherwise, it is a value defined by the operating system (e.g., an |
371 // error code returned by GetLastError() on windows). | 371 // error code returned by GetLastError() on windows). |
372 const URLRequestStatus& status() const { return status_; } | 372 const URLRequestStatus& status() const { return status_; } |
373 | 373 |
374 // This method is called to start the request. The delegate will receive | 374 // This method is called to start the request. The delegate will receive |
375 // a OnResponseStarted callback when the request is started. | 375 // a OnResponseStarted callback when the request is started. |
376 void Start(); | 376 void Start(); |
377 | 377 |
378 // This method may be called at any time after Start() has been called to | 378 // This method may be called at any time after Start() has been called to |
379 // cancel the request. This method may be called many times, and it has | 379 // cancel the request. This method may be called many times, and it has |
380 // no effect once the response has completed. | 380 // no effect once the response has completed. It is guaranteed that no |
| 381 // methods of the delegate will be called after the request has been |
| 382 // cancelled, including during the call to Cancel itself. |
381 void Cancel(); | 383 void Cancel(); |
382 | 384 |
383 // Cancels the request and sets the error to |os_error| (see net_error_list.h | 385 // Cancels the request and sets the error to |os_error| (see net_error_list.h |
384 // for values). | 386 // for values). |
385 void SimulateError(int os_error); | 387 void SimulateError(int os_error); |
386 | 388 |
387 // Cancels the request and sets the error to |os_error| (see net_error_list.h | 389 // Cancels the request and sets the error to |os_error| (see net_error_list.h |
388 // for values) and attaches |ssl_info| as the SSLInfo for that request. This | 390 // for values) and attaches |ssl_info| as the SSLInfo for that request. This |
389 // is useful to attach a certificate and certificate error to a canceled | 391 // is useful to attach a certificate and certificate error to a canceled |
390 // request. | 392 // request. |
391 void SimulateSSLError(int os_error, const net::SSLInfo& ssl_info); | 393 void SimulateSSLError(int os_error, const net::SSLInfo& ssl_info); |
392 | 394 |
393 // Read initiates an asynchronous read from the response, and must only | 395 // Read initiates an asynchronous read from the response, and must only |
394 // be called after the OnResponseStarted callback is received with a | 396 // be called after the OnResponseStarted callback is received with a |
395 // successful status. | 397 // successful status. |
396 // If data is available, Read will return true, and the data and length will | 398 // If data is available, Read will return true, and the data and length will |
397 // be returned immediately. If data is not available, Read returns false, | 399 // be returned immediately. If data is not available, Read returns false, |
398 // and an asynchronous Read is initiated. The Read is finished when | 400 // and an asynchronous Read is initiated. The Read is finished when |
399 // the caller receives the OnReadComplete callback. OnReadComplete will be | 401 // the caller receives the OnReadComplete callback. Unless the request was |
400 // always be called, even if there was a failure. | 402 // cancelled, OnReadComplete will always be called, even if the read failed. |
401 // | 403 // |
402 // The buf parameter is a buffer to receive the data. If the operation | 404 // The buf parameter is a buffer to receive the data. If the operation |
403 // completes asynchronously, the implementation will reference the buffer | 405 // completes asynchronously, the implementation will reference the buffer |
404 // until OnReadComplete is called. The buffer must be at least max_bytes in | 406 // until OnReadComplete is called. The buffer must be at least max_bytes in |
405 // length. | 407 // length. |
406 // | 408 // |
407 // The max_bytes parameter is the maximum number of bytes to read. | 409 // The max_bytes parameter is the maximum number of bytes to read. |
408 // | 410 // |
409 // The bytes_read parameter is an output parameter containing the | 411 // The bytes_read parameter is an output parameter containing the |
410 // the number of bytes read. A value of 0 indicates that there is no | 412 // the number of bytes read. A value of 0 indicates that there is no |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 #define URLREQUEST_COUNT_DTOR() url_request_metrics.object_count-- | 572 #define URLREQUEST_COUNT_DTOR() url_request_metrics.object_count-- |
571 | 573 |
572 #else // disable leak checking in release builds... | 574 #else // disable leak checking in release builds... |
573 | 575 |
574 #define URLREQUEST_COUNT_CTOR() | 576 #define URLREQUEST_COUNT_CTOR() |
575 #define URLREQUEST_COUNT_DTOR() | 577 #define URLREQUEST_COUNT_DTOR() |
576 | 578 |
577 #endif // #ifndef NDEBUG | 579 #endif // #ifndef NDEBUG |
578 | 580 |
579 #endif // NET_URL_REQUEST_URL_REQUEST_H_ | 581 #endif // NET_URL_REQUEST_URL_REQUEST_H_ |
OLD | NEW |