| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 IOS_WEB_NET_REQUEST_TRACKER_IMPL_H_ | 5 #ifndef IOS_WEB_NET_REQUEST_TRACKER_IMPL_H_ |
| 6 #define IOS_WEB_NET_REQUEST_TRACKER_IMPL_H_ | 6 #define IOS_WEB_NET_REQUEST_TRACKER_IMPL_H_ |
| 7 | 7 |
| 8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 void TrimToURL(const GURL& url, id user_info); | 277 void TrimToURL(const GURL& url, id user_info); |
| 278 | 278 |
| 279 // Sets page_url_ to the new URL if it's a valid history state change (i.e. | 279 // Sets page_url_ to the new URL if it's a valid history state change (i.e. |
| 280 // the URL's have the same origin) and if the tab is currently loading. | 280 // the URL's have the same origin) and if the tab is currently loading. |
| 281 void HistoryStateChangeToURL(const GURL& full_url); | 281 void HistoryStateChangeToURL(const GURL& full_url); |
| 282 | 282 |
| 283 // Note that the page started by a call to Trim is no longer loading. | 283 // Note that the page started by a call to Trim is no longer loading. |
| 284 // |load_success| indicates if the page successfully loaded. | 284 // |load_success| indicates if the page successfully loaded. |
| 285 void StopPageLoad(const GURL& url, bool load_success); | 285 void StopPageLoad(const GURL& url, bool load_success); |
| 286 | 286 |
| 287 // Cancels all the requests in |live_requests_|. | |
| 288 void CancelRequests(); | |
| 289 | |
| 290 #pragma mark Private Consumer API | 287 #pragma mark Private Consumer API |
| 291 // Private methods that call into delegate methods. | 288 // Private methods that call into delegate methods. |
| 292 | 289 |
| 293 // Notify* methods are posted to the UI thread by the provider API | 290 // Notify* methods are posted to the UI thread by the provider API |
| 294 // methods. | 291 // methods. |
| 295 | 292 |
| 296 // Has the delegate handle |headers| for |request_url|. | 293 // Has the delegate handle |headers| for |request_url|. |
| 297 void NotifyResponseHeaders(net::HttpResponseHeaders* headers, | 294 void NotifyResponseHeaders(net::HttpResponseHeaders* headers, |
| 298 const GURL& request_url); | 295 const GURL& request_url); |
| 299 | 296 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 // should be done on the main thread. | 333 // should be done on the main thread. |
| 337 id<CRWRequestTrackerDelegate> delegate_; // Weak. | 334 id<CRWRequestTrackerDelegate> delegate_; // Weak. |
| 338 | 335 |
| 339 #pragma mark Non thread-safe fields, only accessed from the IO thread. | 336 #pragma mark Non thread-safe fields, only accessed from the IO thread. |
| 340 // All the tracked requests for the page, indexed by net::URLRequest (Cast as | 337 // All the tracked requests for the page, indexed by net::URLRequest (Cast as |
| 341 // a void* to avoid the temptation of accessing it from the wrong thread). | 338 // a void* to avoid the temptation of accessing it from the wrong thread). |
| 342 // This map is not exhaustive: it is only meant to estimate the loading | 339 // This map is not exhaustive: it is only meant to estimate the loading |
| 343 // progress, and thus requests corresponding to old navigation events are not | 340 // progress, and thus requests corresponding to old navigation events are not |
| 344 // in it. | 341 // in it. |
| 345 std::map<const void*, TrackerCounts*> counts_by_request_; | 342 std::map<const void*, TrackerCounts*> counts_by_request_; |
| 346 // All the live requests associated with the tracker. | |
| 347 std::set<net::URLRequest*> live_requests_; | |
| 348 // A list of all the TrackerCounts, including the finished ones. | 343 // A list of all the TrackerCounts, including the finished ones. |
| 349 std::vector<std::unique_ptr<TrackerCounts>> counts_; | 344 std::vector<std::unique_ptr<TrackerCounts>> counts_; |
| 350 // The system shall never allow the page load estimate to go back. | 345 // The system shall never allow the page load estimate to go back. |
| 351 float previous_estimate_; | 346 float previous_estimate_; |
| 352 // Index of the first request to consider for building the estimation. | 347 // Index of the first request to consider for building the estimation. |
| 353 unsigned int estimate_start_index_; | 348 unsigned int estimate_start_index_; |
| 354 // How many notifications are currently queued, to avoid notifying too often. | 349 // How many notifications are currently queued, to avoid notifying too often. |
| 355 int notification_depth_; | 350 int notification_depth_; |
| 356 // The tracker containing the error currently presented to the user. | 351 // The tracker containing the error currently presented to the user. |
| 357 TrackerCounts* current_ssl_error_; | 352 TrackerCounts* current_ssl_error_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 384 // Flag to synchronize deletion and callback creation. Lives on the IO thread. | 379 // Flag to synchronize deletion and callback creation. Lives on the IO thread. |
| 385 // True when this tracker has beed Close()d. If this is the case, no further | 380 // True when this tracker has beed Close()d. If this is the case, no further |
| 386 // references to it should be generated (for example by binding it into a | 381 // references to it should be generated (for example by binding it into a |
| 387 // callback), and the expectation is that it will soon be deleted. | 382 // callback), and the expectation is that it will soon be deleted. |
| 388 bool is_closing_; | 383 bool is_closing_; |
| 389 }; | 384 }; |
| 390 | 385 |
| 391 } // namespace web | 386 } // namespace web |
| 392 | 387 |
| 393 #endif // IOS_WEB_NET_REQUEST_TRACKER_IMPL_H_ | 388 #endif // IOS_WEB_NET_REQUEST_TRACKER_IMPL_H_ |
| OLD | NEW |