Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(546)

Side by Side Diff: chrome/browser/predictors/resource_prefetch_predictor.h

Issue 2227723002: predictors: Also track "no-cache" and "must-revalidate" resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ 5 #ifndef CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_
6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ 6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // it to disk in the DB thread through the ResourcePrefetchPredictorTables. It 59 // it to disk in the DB thread through the ResourcePrefetchPredictorTables. It
60 // initiates resource prefetching using the ResourcePrefetcherManager. Owned 60 // initiates resource prefetching using the ResourcePrefetcherManager. Owned
61 // by profile. 61 // by profile.
62 // * ResourcePrefetcherManager - Manages the ResourcePrefetchers that do the 62 // * ResourcePrefetcherManager - Manages the ResourcePrefetchers that do the
63 // prefetching on the IO thread. The manager is owned by the 63 // prefetching on the IO thread. The manager is owned by the
64 // ResourcePrefetchPredictor and interfaces between the predictor on the UI 64 // ResourcePrefetchPredictor and interfaces between the predictor on the UI
65 // thread and the prefetchers on the IO thread. 65 // thread and the prefetchers on the IO thread.
66 // * ResourcePrefetcher - Lives entirely on the IO thread, owned by the 66 // * ResourcePrefetcher - Lives entirely on the IO thread, owned by the
67 // ResourcePrefetcherManager, and issues net::URLRequest to fetch resources. 67 // ResourcePrefetcherManager, and issues net::URLRequest to fetch resources.
68 // 68 //
69 // TODO(shishir): Do speculative prefetching for https resources and/or https 69 // TODO(shishir): Do speculative prefetching for https resources and/or https
pasko 2016/08/09 09:31:11 this is done
Benoit L 2016/08/09 12:24:38 Done.
70 // main frame urls. 70 // main frame urls.
71 // TODO(zhenw): Currently only main frame requests/redirects/responses are 71 // TODO(zhenw): Currently only main frame requests/redirects/responses are
72 // recorded. Consider recording sub-frame responses independently or together 72 // recorded. Consider recording sub-frame responses independently or together
73 // with main frame. 73 // with main frame.
74 class ResourcePrefetchPredictor 74 class ResourcePrefetchPredictor
75 : public KeyedService, 75 : public KeyedService,
76 public history::HistoryServiceObserver, 76 public history::HistoryServiceObserver,
77 public base::SupportsWeakPtr<ResourcePrefetchPredictor> { 77 public base::SupportsWeakPtr<ResourcePrefetchPredictor> {
78 public: 78 public:
79 // Stores the data that we need to get from the URLRequest. 79 // Stores the data that we need to get from the URLRequest.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 static bool IsHandledMainPage(net::URLRequest* request); 180 static bool IsHandledMainPage(net::URLRequest* request);
181 181
182 // Returns true if the subresource request is supported for prediction. 182 // Returns true if the subresource request is supported for prediction.
183 static bool IsHandledSubresource(net::URLRequest* request, 183 static bool IsHandledSubresource(net::URLRequest* request,
184 content::ResourceType resource_type); 184 content::ResourceType resource_type);
185 185
186 // Returns true if the subresource has a supported type. 186 // Returns true if the subresource has a supported type.
187 static bool IsHandledResourceType(content::ResourceType resource_type, 187 static bool IsHandledResourceType(content::ResourceType resource_type,
188 const std::string& mime_type); 188 const std::string& mime_type);
189 189
190 // Returns true if the request (should have a response in it) is cacheable. 190 // Returns true if the request (should have a response in it) is "no-store".
191 static bool IsCacheable(const net::URLRequest* request); 191 static bool IsNoStore(const net::URLRequest* request);
192 192
193 // KeyedService methods override. 193 // KeyedService methods override.
194 void Shutdown() override; 194 void Shutdown() override;
195 195
196 // Functions called on different network events pertaining to the loading of 196 // Functions called on different network events pertaining to the loading of
197 // main frame resource or sub resources. 197 // main frame resource or sub resources.
198 void OnMainFrameRequest(const URLRequestSummary& request); 198 void OnMainFrameRequest(const URLRequestSummary& request);
199 void OnMainFrameResponse(const URLRequestSummary& response); 199 void OnMainFrameResponse(const URLRequestSummary& response);
200 void OnMainFrameRedirect(const URLRequestSummary& response); 200 void OnMainFrameRedirect(const URLRequestSummary& response);
201 void OnSubresourceResponse(const URLRequestSummary& response); 201 void OnSubresourceResponse(const URLRequestSummary& response);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 333
334 ScopedObserver<history::HistoryService, history::HistoryServiceObserver> 334 ScopedObserver<history::HistoryService, history::HistoryServiceObserver>
335 history_service_observer_; 335 history_service_observer_;
336 336
337 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictor); 337 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictor);
338 }; 338 };
339 339
340 } // namespace predictors 340 } // namespace predictors
341 341
342 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ 342 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698