| Index: chrome/browser/predictors/resource_prefetcher.h
|
| diff --git a/chrome/browser/predictors/resource_prefetcher.h b/chrome/browser/predictors/resource_prefetcher.h
|
| index caba0981c0891b679d98deb0d018c650c034531b..cc80802900facd51c181e93ca83effd6469cc770 100644
|
| --- a/chrome/browser/predictors/resource_prefetcher.h
|
| +++ b/chrome/browser/predictors/resource_prefetcher.h
|
| @@ -10,12 +10,14 @@
|
| #include <list>
|
| #include <map>
|
| #include <memory>
|
| +#include <string>
|
| #include <utility>
|
| #include <vector>
|
|
|
| #include "base/macros.h"
|
| #include "base/memory/scoped_vector.h"
|
| #include "base/threading/thread_checker.h"
|
| +#include "base/time/time.h"
|
| #include "chrome/browser/predictors/resource_prefetch_common.h"
|
| #include "net/url_request/redirect_info.h"
|
| #include "net/url_request/url_request.h"
|
| @@ -44,6 +46,27 @@ constexpr char kResourcePrefetchPredictorPrefetchedSizeHistogram[] =
|
| // - Lives entirely on the IO thread.
|
| class ResourcePrefetcher : public net::URLRequest::Delegate {
|
| public:
|
| + struct PrefetchedRequestStats {
|
| + PrefetchedRequestStats(const GURL& resource_url,
|
| + bool was_cached,
|
| + size_t total_received_bytes);
|
| + ~PrefetchedRequestStats();
|
| +
|
| + GURL resource_url;
|
| + bool was_cached;
|
| + size_t total_received_bytes;
|
| + };
|
| +
|
| + struct PrefetcherStats {
|
| + explicit PrefetcherStats(const GURL& url);
|
| + ~PrefetcherStats();
|
| + PrefetcherStats(const PrefetcherStats& other);
|
| +
|
| + GURL url;
|
| + base::TimeTicks start_time;
|
| + std::vector<PrefetchedRequestStats> requests_stats;
|
| + };
|
| +
|
| // Used to communicate when the prefetching is done. All methods are invoked
|
| // on the IO thread.
|
| class Delegate {
|
| @@ -52,7 +75,9 @@ class ResourcePrefetcher : public net::URLRequest::Delegate {
|
|
|
| // Called when the ResourcePrefetcher is finished, i.e. there is nothing
|
| // pending in flight.
|
| - virtual void ResourcePrefetcherFinished(ResourcePrefetcher* prefetcher) = 0;
|
| + virtual void ResourcePrefetcherFinished(
|
| + ResourcePrefetcher* prefetcher,
|
| + std::unique_ptr<PrefetcherStats> stats) = 0;
|
|
|
| virtual net::URLRequestContext* GetURLRequestContext() = 0;
|
| };
|
| @@ -129,6 +154,7 @@ class ResourcePrefetcher : public net::URLRequest::Delegate {
|
| inflight_requests_;
|
| std::list<GURL> request_queue_;
|
| std::map<std::string, size_t> host_inflight_counts_;
|
| + std::unique_ptr<PrefetcherStats> stats_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ResourcePrefetcher);
|
| };
|
|
|