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_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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/debug/leak_tracker.h" | 14 #include "base/debug/leak_tracker.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/optional.h" | 17 #include "base/optional.h" |
18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
19 #include "base/supports_user_data.h" | 19 #include "base/supports_user_data.h" |
20 #include "base/threading/non_thread_safe.h" | 20 #include "base/threading/thread_checker.h" |
21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
22 #include "net/base/auth.h" | 22 #include "net/base/auth.h" |
23 #include "net/base/completion_callback.h" | 23 #include "net/base/completion_callback.h" |
24 #include "net/base/load_states.h" | 24 #include "net/base/load_states.h" |
25 #include "net/base/load_timing_info.h" | 25 #include "net/base/load_timing_info.h" |
26 #include "net/base/net_error_details.h" | 26 #include "net/base/net_error_details.h" |
27 #include "net/base/net_export.h" | 27 #include "net/base/net_export.h" |
28 #include "net/base/network_delegate.h" | 28 #include "net/base/network_delegate.h" |
29 #include "net/base/request_priority.h" | 29 #include "net/base/request_priority.h" |
30 #include "net/base/upload_progress.h" | 30 #include "net/base/upload_progress.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // A class representing the asynchronous load of a data stream from an URL. | 62 // A class representing the asynchronous load of a data stream from an URL. |
63 // | 63 // |
64 // The lifetime of an instance of this class is completely controlled by the | 64 // The lifetime of an instance of this class is completely controlled by the |
65 // consumer, and the instance is not required to live on the heap or be | 65 // consumer, and the instance is not required to live on the heap or be |
66 // allocated in any special way. It is also valid to delete an URLRequest | 66 // allocated in any special way. It is also valid to delete an URLRequest |
67 // object during the handling of a callback to its delegate. Of course, once | 67 // object during the handling of a callback to its delegate. Of course, once |
68 // the URLRequest is deleted, no further callbacks to its delegate will occur. | 68 // the URLRequest is deleted, no further callbacks to its delegate will occur. |
69 // | 69 // |
70 // NOTE: All usage of all instances of this class should be on the same thread. | 70 // NOTE: All usage of all instances of this class should be on the same thread. |
71 // | 71 // |
72 class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe), | 72 class NET_EXPORT URLRequest : public base::SupportsUserData { |
73 public base::SupportsUserData { | |
74 public: | 73 public: |
75 // Callback function implemented by protocol handlers to create new jobs. | 74 // Callback function implemented by protocol handlers to create new jobs. |
76 // The factory may return NULL to indicate an error, which will cause other | 75 // The factory may return NULL to indicate an error, which will cause other |
77 // factories to be queried. If no factory handles the request, then the | 76 // factories to be queried. If no factory handles the request, then the |
78 // default job will be used. | 77 // default job will be used. |
79 typedef URLRequestJob* (ProtocolFactory)(URLRequest* request, | 78 typedef URLRequestJob* (ProtocolFactory)(URLRequest* request, |
80 NetworkDelegate* network_delegate, | 79 NetworkDelegate* network_delegate, |
81 const std::string& scheme); | 80 const std::string& scheme); |
82 | 81 |
83 // A ReferrerPolicy for the request can be set with | 82 // A ReferrerPolicy for the request can be set with |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 LoadTimingInfo load_timing_info_; | 854 LoadTimingInfo load_timing_info_; |
856 | 855 |
857 // The proxy server used for this request, if any. | 856 // The proxy server used for this request, if any. |
858 ProxyServer proxy_server_; | 857 ProxyServer proxy_server_; |
859 | 858 |
860 // The raw header size of the response. | 859 // The raw header size of the response. |
861 int raw_header_size_; | 860 int raw_header_size_; |
862 | 861 |
863 const NetworkTrafficAnnotationTag traffic_annotation_; | 862 const NetworkTrafficAnnotationTag traffic_annotation_; |
864 | 863 |
| 864 THREAD_CHECKER(thread_checker_); |
| 865 |
865 DISALLOW_COPY_AND_ASSIGN(URLRequest); | 866 DISALLOW_COPY_AND_ASSIGN(URLRequest); |
866 }; | 867 }; |
867 | 868 |
868 } // namespace net | 869 } // namespace net |
869 | 870 |
870 #endif // NET_URL_REQUEST_URL_REQUEST_H_ | 871 #endif // NET_URL_REQUEST_URL_REQUEST_H_ |
OLD | NEW |