| 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 #include <map> | 11 #include <map> |
| 12 #include <memory> |
| 11 #include <set> | 13 #include <set> |
| 14 #include <vector> |
| 12 | 15 |
| 13 #include "base/callback_forward.h" | 16 #include "base/callback_forward.h" |
| 14 #import "base/mac/scoped_nsobject.h" | 17 #import "base/mac/scoped_nsobject.h" |
| 15 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_vector.h" | |
| 17 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 18 #import "ios/net/request_tracker.h" | 20 #import "ios/net/request_tracker.h" |
| 19 #import "ios/web/net/crw_request_tracker_delegate.h" | 21 #import "ios/web/net/crw_request_tracker_delegate.h" |
| 20 #include "ios/web/public/web_thread.h" | 22 #include "ios/web/public/web_thread.h" |
| 21 #include "net/url_request/url_request_context_getter.h" | 23 #include "net/url_request/url_request_context_getter.h" |
| 22 #include "url/gurl.h" | 24 #include "url/gurl.h" |
| 23 | 25 |
| 24 @class SSLCarrier; | 26 @class SSLCarrier; |
| 25 @class CRWSSLCarrier; | 27 @class CRWSSLCarrier; |
| 26 struct TrackerCounts; | 28 struct TrackerCounts; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 #pragma mark Non thread-safe fields, only accessed from the IO thread. | 339 #pragma mark Non thread-safe fields, only accessed from the IO thread. |
| 338 // All the tracked requests for the page, indexed by net::URLRequest (Cast as | 340 // All the tracked requests for the page, indexed by net::URLRequest (Cast as |
| 339 // a void* to avoid the temptation of accessing it from the wrong thread). | 341 // a void* to avoid the temptation of accessing it from the wrong thread). |
| 340 // This map is not exhaustive: it is only meant to estimate the loading | 342 // This map is not exhaustive: it is only meant to estimate the loading |
| 341 // progress, and thus requests corresponding to old navigation events are not | 343 // progress, and thus requests corresponding to old navigation events are not |
| 342 // in it. | 344 // in it. |
| 343 std::map<const void*, TrackerCounts*> counts_by_request_; | 345 std::map<const void*, TrackerCounts*> counts_by_request_; |
| 344 // All the live requests associated with the tracker. | 346 // All the live requests associated with the tracker. |
| 345 std::set<net::URLRequest*> live_requests_; | 347 std::set<net::URLRequest*> live_requests_; |
| 346 // A list of all the TrackerCounts, including the finished ones. | 348 // A list of all the TrackerCounts, including the finished ones. |
| 347 ScopedVector<TrackerCounts> counts_; | 349 std::vector<std::unique_ptr<TrackerCounts>> counts_; |
| 348 // The system shall never allow the page load estimate to go back. | 350 // The system shall never allow the page load estimate to go back. |
| 349 float previous_estimate_; | 351 float previous_estimate_; |
| 350 // Index of the first request to consider for building the estimation. | 352 // Index of the first request to consider for building the estimation. |
| 351 unsigned int estimate_start_index_; | 353 unsigned int estimate_start_index_; |
| 352 // How many notifications are currently queued, to avoid notifying too often. | 354 // How many notifications are currently queued, to avoid notifying too often. |
| 353 int notification_depth_; | 355 int notification_depth_; |
| 354 // The tracker containing the error currently presented to the user. | 356 // The tracker containing the error currently presented to the user. |
| 355 TrackerCounts* current_ssl_error_; | 357 TrackerCounts* current_ssl_error_; |
| 356 // Set to |YES| if the page has mixed content | 358 // Set to |YES| if the page has mixed content |
| 357 bool has_mixed_content_; | 359 bool has_mixed_content_; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 382 // Flag to synchronize deletion and callback creation. Lives on the IO thread. | 384 // Flag to synchronize deletion and callback creation. Lives on the IO thread. |
| 383 // True when this tracker has beed Close()d. If this is the case, no further | 385 // True when this tracker has beed Close()d. If this is the case, no further |
| 384 // references to it should be generated (for example by binding it into a | 386 // references to it should be generated (for example by binding it into a |
| 385 // callback), and the expectation is that it will soon be deleted. | 387 // callback), and the expectation is that it will soon be deleted. |
| 386 bool is_closing_; | 388 bool is_closing_; |
| 387 }; | 389 }; |
| 388 | 390 |
| 389 } // namespace web | 391 } // namespace web |
| 390 | 392 |
| 391 #endif // IOS_WEB_NET_REQUEST_TRACKER_IMPL_H_ | 393 #endif // IOS_WEB_NET_REQUEST_TRACKER_IMPL_H_ |
| OLD | NEW |