| 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/callback.h" | 10 #include "base/callback.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 mojom::URLLoaderClient* client, | 63 mojom::URLLoaderClient* client, |
| 64 const net::NetworkTrafficAnnotationTag& traffic_annotation, | 64 const net::NetworkTrafficAnnotationTag& traffic_annotation, |
| 65 scoped_refptr<base::SingleThreadTaskRunner> task_runner = | 65 scoped_refptr<base::SingleThreadTaskRunner> task_runner = |
| 66 base::ThreadTaskRunnerHandle::Get()); | 66 base::ThreadTaskRunnerHandle::Get()); |
| 67 | 67 |
| 68 ~ThrottlingURLLoader() override; | 68 ~ThrottlingURLLoader() override; |
| 69 | 69 |
| 70 void FollowRedirect(); | 70 void FollowRedirect(); |
| 71 void SetPriority(net::RequestPriority priority, int32_t intra_priority_value); | 71 void SetPriority(net::RequestPriority priority, int32_t intra_priority_value); |
| 72 | 72 |
| 73 // Disconnects the client connection and releases the URLLoader. |
| 74 void DisconnectClient(); |
| 75 |
| 73 private: | 76 private: |
| 74 ThrottlingURLLoader( | 77 ThrottlingURLLoader( |
| 75 std::vector<std::unique_ptr<URLLoaderThrottle>> throttles, | 78 std::vector<std::unique_ptr<URLLoaderThrottle>> throttles, |
| 76 mojom::URLLoaderClient* client, | 79 mojom::URLLoaderClient* client, |
| 77 const net::NetworkTrafficAnnotationTag& traffic_annotation); | 80 const net::NetworkTrafficAnnotationTag& traffic_annotation); |
| 78 | 81 |
| 79 // Either of the two sets of arguments below is valid but not both: | 82 // Either of the two sets of arguments below is valid but not both: |
| 80 // - |factory|, |routing_id|, |request_id| and |options|; | 83 // - |factory|, |routing_id|, |request_id| and |options|; |
| 81 // - |start_loader_callback|. | 84 // - |start_loader_callback|. |
| 82 void Start(mojom::URLLoaderFactory* factory, | 85 void Start(mojom::URLLoaderFactory* factory, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 void CancelWithError(int error_code) override; | 118 void CancelWithError(int error_code) override; |
| 116 void Resume() override; | 119 void Resume() override; |
| 117 | 120 |
| 118 enum DeferredStage { | 121 enum DeferredStage { |
| 119 DEFERRED_NONE, | 122 DEFERRED_NONE, |
| 120 DEFERRED_START, | 123 DEFERRED_START, |
| 121 DEFERRED_REDIRECT, | 124 DEFERRED_REDIRECT, |
| 122 DEFERRED_RESPONSE | 125 DEFERRED_RESPONSE |
| 123 }; | 126 }; |
| 124 DeferredStage deferred_stage_ = DEFERRED_NONE; | 127 DeferredStage deferred_stage_ = DEFERRED_NONE; |
| 125 bool cancelled_by_throttle_ = false; | 128 bool loader_cancelled_ = false; |
| 126 | 129 |
| 127 std::unique_ptr<URLLoaderThrottle> throttle_; | 130 std::unique_ptr<URLLoaderThrottle> throttle_; |
| 128 | 131 |
| 129 mojom::URLLoaderClient* forwarding_client_; | 132 mojom::URLLoaderClient* forwarding_client_; |
| 130 mojo::Binding<mojom::URLLoaderClient> client_binding_; | 133 mojo::Binding<mojom::URLLoaderClient> client_binding_; |
| 131 | 134 |
| 132 mojom::URLLoaderPtr url_loader_; | 135 mojom::URLLoaderPtr url_loader_; |
| 133 | 136 |
| 134 struct StartInfo { | 137 struct StartInfo { |
| 135 StartInfo(mojom::URLLoaderFactory* in_url_loader_factory, | 138 StartInfo(mojom::URLLoaderFactory* in_url_loader_factory, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 std::unique_ptr<PriorityInfo> priority_info_; | 194 std::unique_ptr<PriorityInfo> priority_info_; |
| 192 | 195 |
| 193 const net::NetworkTrafficAnnotationTag traffic_annotation_; | 196 const net::NetworkTrafficAnnotationTag traffic_annotation_; |
| 194 | 197 |
| 195 DISALLOW_COPY_AND_ASSIGN(ThrottlingURLLoader); | 198 DISALLOW_COPY_AND_ASSIGN(ThrottlingURLLoader); |
| 196 }; | 199 }; |
| 197 | 200 |
| 198 } // namespace content | 201 } // namespace content |
| 199 | 202 |
| 200 #endif // CONTENT_COMMON_THROTTLING_URL_LOADER_H_ | 203 #endif // CONTENT_COMMON_THROTTLING_URL_LOADER_H_ |
| OLD | NEW |