| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 CONTENT_COMMON_THROTTLING_URL_LOADER_H_ | 5 #ifndef CONTENT_COMMON_THROTTLING_URL_LOADER_H_ |
| 6 #define CONTENT_COMMON_THROTTLING_URL_LOADER_H_ | 6 #define CONTENT_COMMON_THROTTLING_URL_LOADER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // |factory| and |client| must stay alive during the lifetime of the returned | 34 // |factory| and |client| must stay alive during the lifetime of the returned |
| 35 // object. | 35 // object. |
| 36 static std::unique_ptr<ThrottlingURLLoader> CreateLoaderAndStart( | 36 static std::unique_ptr<ThrottlingURLLoader> CreateLoaderAndStart( |
| 37 mojom::URLLoaderFactory* factory, | 37 mojom::URLLoaderFactory* factory, |
| 38 std::vector<std::unique_ptr<URLLoaderThrottle>> throttles, | 38 std::vector<std::unique_ptr<URLLoaderThrottle>> throttles, |
| 39 int32_t routing_id, | 39 int32_t routing_id, |
| 40 int32_t request_id, | 40 int32_t request_id, |
| 41 uint32_t options, | 41 uint32_t options, |
| 42 std::unique_ptr<ResourceRequest> url_request, | 42 std::unique_ptr<ResourceRequest> url_request, |
| 43 mojom::URLLoaderClient* client, | 43 mojom::URLLoaderClient* client, |
| 44 const net::MutableNetworkTrafficAnnotationTag& traffic_annotation, |
| 44 scoped_refptr<base::SingleThreadTaskRunner> task_runner = | 45 scoped_refptr<base::SingleThreadTaskRunner> task_runner = |
| 45 base::ThreadTaskRunnerHandle::Get()); | 46 base::ThreadTaskRunnerHandle::Get()); |
| 46 | 47 |
| 47 ~ThrottlingURLLoader() override; | 48 ~ThrottlingURLLoader() override; |
| 48 | 49 |
| 49 void FollowRedirect(); | 50 void FollowRedirect(); |
| 50 void SetPriority(net::RequestPriority priority, int32_t intra_priority_value); | 51 void SetPriority(net::RequestPriority priority, int32_t intra_priority_value); |
| 51 | 52 |
| 52 private: | 53 private: |
| 53 ThrottlingURLLoader(std::vector<std::unique_ptr<URLLoaderThrottle>> throttles, | 54 ThrottlingURLLoader( |
| 54 mojom::URLLoaderClient* client); | 55 std::vector<std::unique_ptr<URLLoaderThrottle>> throttles, |
| 56 mojom::URLLoaderClient* client, |
| 57 const net::MutableNetworkTrafficAnnotationTag& traffic_annotation); |
| 55 | 58 |
| 56 void Start(mojom::URLLoaderFactory* factory, | 59 void Start(mojom::URLLoaderFactory* factory, |
| 57 int32_t routing_id, | 60 int32_t routing_id, |
| 58 int32_t request_id, | 61 int32_t request_id, |
| 59 uint32_t options, | 62 uint32_t options, |
| 60 std::unique_ptr<ResourceRequest> url_request, | 63 std::unique_ptr<ResourceRequest> url_request, |
| 61 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 64 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 62 | 65 |
| 63 // mojom::URLLoaderClient implementation: | 66 // mojom::URLLoaderClient implementation: |
| 64 void OnReceiveResponse(const ResourceResponseHead& response_head, | 67 void OnReceiveResponse(const ResourceResponseHead& response_head, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 PriorityInfo(net::RequestPriority in_priority, | 147 PriorityInfo(net::RequestPriority in_priority, |
| 145 int32_t in_intra_priority_value); | 148 int32_t in_intra_priority_value); |
| 146 ~PriorityInfo(); | 149 ~PriorityInfo(); |
| 147 | 150 |
| 148 net::RequestPriority priority; | 151 net::RequestPriority priority; |
| 149 int32_t intra_priority_value; | 152 int32_t intra_priority_value; |
| 150 }; | 153 }; |
| 151 // Set if request is deferred and SetPriority() is called. | 154 // Set if request is deferred and SetPriority() is called. |
| 152 std::unique_ptr<PriorityInfo> priority_info_; | 155 std::unique_ptr<PriorityInfo> priority_info_; |
| 153 | 156 |
| 157 const net::MutableNetworkTrafficAnnotationTag traffic_annotation_; |
| 158 |
| 154 DISALLOW_COPY_AND_ASSIGN(ThrottlingURLLoader); | 159 DISALLOW_COPY_AND_ASSIGN(ThrottlingURLLoader); |
| 155 }; | 160 }; |
| 156 | 161 |
| 157 } // namespace content | 162 } // namespace content |
| 158 | 163 |
| 159 #endif // CONTENT_COMMON_THROTTLING_URL_LOADER_H_ | 164 #endif // CONTENT_COMMON_THROTTLING_URL_LOADER_H_ |
| OLD | NEW |